Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Olm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
Olm
Commits
3540926b
Commit
3540926b
authored
8 years ago
by
manuroe
Browse files
Options
Downloads
Patches
Plain Diff
OLMKit: Reset intermediate buffers to zeroes
parent
aa12cbca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
xcode/OLMKit/OLMAccount.m
+2
-0
2 additions, 0 deletions
xcode/OLMKit/OLMAccount.m
xcode/OLMKit/OLMOutboundGroupSession.m
+2
-0
2 additions, 0 deletions
xcode/OLMKit/OLMOutboundGroupSession.m
xcode/OLMKit/OLMSession.m
+2
-0
2 additions, 0 deletions
xcode/OLMKit/OLMSession.m
with
6 additions
and
0 deletions
xcode/OLMKit/OLMAccount.m
+
2
−
0
View file @
3540926b
...
...
@@ -66,6 +66,7 @@
size_t
randomLength
=
olm_create_account_random_length
(
_account
);
NSMutableData
*
random
=
[
OLMUtility
randomBytesOfLength
:
randomLength
];
size_t
accountResult
=
olm_create_account
(
_account
,
random
.
mutableBytes
,
random
.
length
);
[
random
resetBytesInRange
:
NSMakeRange
(
0
,
random
.
length
)];
if
(
accountResult
==
olm_error
())
{
const
char
*
error
=
olm_account_last_error
(
_account
);
NSLog
(
@"error creating account: %s"
,
error
);
...
...
@@ -147,6 +148,7 @@
size_t
randomLength
=
olm_account_generate_one_time_keys_random_length
(
_account
,
numberOfKeys
);
NSMutableData
*
random
=
[
OLMUtility
randomBytesOfLength
:
randomLength
];
size_t
result
=
olm_account_generate_one_time_keys
(
_account
,
numberOfKeys
,
random
.
mutableBytes
,
random
.
length
);
[
random
resetBytesInRange
:
NSMakeRange
(
0
,
random
.
length
)];
if
(
result
==
olm_error
())
{
const
char
*
error
=
olm_account_last_error
(
_account
);
NSLog
(
@"error generating keys: %s"
,
error
);
...
...
This diff is collapsed.
Click to expand it.
xcode/OLMKit/OLMOutboundGroupSession.m
+
2
−
0
View file @
3540926b
...
...
@@ -55,6 +55,7 @@
NSMutableData
*
random
=
[
OLMUtility
randomBytesOfLength
:
olm_init_outbound_group_session_random_length
(
session
)];
size_t
result
=
olm_init_outbound_group_session
(
session
,
random
.
mutableBytes
,
random
.
length
);
[
random
resetBytesInRange
:
NSMakeRange
(
0
,
random
.
length
)];
if
(
result
==
olm_error
())
{
const
char
*
error
=
olm_outbound_group_session_last_error
(
session
);
NSLog
(
@"olm_init_outbound_group_session error: %s"
,
error
);
...
...
@@ -97,6 +98,7 @@
return
nil
;
}
NSString
*
sessionKey
=
[[
NSString
alloc
]
initWithData
:
sessionKeyData
encoding
:
NSUTF8StringEncoding
];
[
sessionKeyData
resetBytesInRange
:
NSMakeRange
(
0
,
sessionKeyData
.
length
)];
return
sessionKey
;
}
...
...
This diff is collapsed.
Click to expand it.
xcode/OLMKit/OLMSession.m
+
2
−
0
View file @
3540926b
...
...
@@ -78,6 +78,7 @@
NSData
*
idKey
=
[
theirIdentityKey
dataUsingEncoding
:
NSUTF8StringEncoding
];
NSData
*
otKey
=
[
theirOneTimeKey
dataUsingEncoding
:
NSUTF8StringEncoding
];
size_t
result
=
olm_create_outbound_session
(
_session
,
account
.
account
,
idKey
.
bytes
,
idKey
.
length
,
otKey
.
bytes
,
otKey
.
length
,
random
.
mutableBytes
,
random
.
length
);
[
random
resetBytesInRange
:
NSMakeRange
(
0
,
random
.
length
)];
if
(
result
==
olm_error
())
{
const
char
*
olm_error
=
olm_session_last_error
(
_session
);
...
...
@@ -215,6 +216,7 @@
return
nil
;
}
size_t
result
=
olm_encrypt
(
_session
,
plaintextData
.
bytes
,
plaintextData
.
length
,
random
.
mutableBytes
,
random
.
length
,
ciphertext
.
mutableBytes
,
ciphertext
.
length
);
[
random
resetBytesInRange
:
NSMakeRange
(
0
,
random
.
length
)];
if
(
result
==
olm_error
())
{
const
char
*
olm_error
=
olm_session_last_error
(
_session
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment