Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
matrix-org
Olm
Commits
90bbdec8
Commit
90bbdec8
authored
Oct 17, 2018
by
manuroe
Browse files
OLMKit: Zero only critical buffers out
parent
2ea2bc8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
xcode/OLMKit/OLMPkDecryption.m
View file @
90bbdec8
...
...
@@ -69,8 +69,6 @@
}
NSString
*
publicKey
=
[[
NSString
alloc
]
initWithData
:
publicKeyData
encoding
:
NSUTF8StringEncoding
];
[
publicKeyData
resetBytesInRange
:
NSMakeRange
(
0
,
publicKeyData
.
length
)];
return
publicKey
;
}
...
...
@@ -90,6 +88,7 @@
size_t
result
=
olm_pk_key_from_private
(
session
,
publicKeyData
.
mutableBytes
,
publicKeyData
.
length
,
random
.
mutableBytes
,
randomLength
);
[
random
resetBytesInRange
:
NSMakeRange
(
0
,
randomLength
)];
if
(
result
==
olm_error
())
{
const
char
*
olm_error
=
olm_pk_decryption_last_error
(
session
);
NSLog
(
@"[OLMPkDecryption] generateKey: olm_pk_key_from_private error: %s"
,
olm_error
);
...
...
@@ -107,8 +106,6 @@
}
NSString
*
publicKey
=
[[
NSString
alloc
]
initWithData
:
publicKeyData
encoding
:
NSUTF8StringEncoding
];
[
publicKeyData
resetBytesInRange
:
NSMakeRange
(
0
,
publicKeyData
.
length
)];
return
publicKey
;
}
...
...
@@ -218,6 +215,7 @@
key
.
bytes
,
key
.
length
,
pickle
.
mutableBytes
,
pickle
.
length
,
ephemeralBuffer
.
mutableBytes
,
ephemeralLength
);
[
pickle
resetBytesInRange
:
NSMakeRange
(
0
,
pickle
.
length
)];
if
(
result
==
olm_error
())
{
const
char
*
olm_error
=
olm_pk_decryption_last_error
(
session
);
NSString
*
errorString
=
[
NSString
stringWithUTF8String
:
olm_error
];
...
...
@@ -248,6 +246,8 @@
}
NSString
*
pickleString
=
[[
NSString
alloc
]
initWithData
:
pickled
encoding
:
NSUTF8StringEncoding
];
[
pickled
resetBytesInRange
:
NSMakeRange
(
0
,
pickled
.
length
)];
return
pickleString
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment