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
fa1e9446
Commit
fa1e9446
authored
May 20, 2016
by
Richard van der Hoff
Browse files
Use _olm_unset instead of memset
memset is at risk of being optimised away, so use _olm_unset instead.
parent
173cbe11
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/inbound_group_session.c
View file @
fa1e9446
...
...
@@ -21,6 +21,7 @@
#include "olm/cipher.h"
#include "olm/error.h"
#include "olm/megolm.h"
#include "olm/memory.h"
#include "olm/message.h"
#include "olm/pickle.h"
#include "olm/pickle_encoding.h"
...
...
@@ -60,7 +61,7 @@ const char *olm_inbound_group_session_last_error(
size_t
olm_clear_inbound_group_session
(
OlmInboundGroupSession
*
session
)
{
mem
set
(
session
,
0
,
sizeof
(
OlmInboundGroupSession
));
_olm_un
set
(
session
,
sizeof
(
OlmInboundGroupSession
));
return
sizeof
(
OlmInboundGroupSession
);
}
...
...
@@ -85,7 +86,7 @@ size_t olm_init_inbound_group_session(
_olm_decode_base64
(
session_key
,
session_key_length
,
key_buf
);
megolm_init
(
&
session
->
initial_ratchet
,
key_buf
,
message_index
);
megolm_init
(
&
session
->
latest_ratchet
,
key_buf
,
message_index
);
mem
set
(
key_buf
,
0
,
MEGOLM_RATCHET_LENGTH
);
_olm_un
set
(
key_buf
,
MEGOLM_RATCHET_LENGTH
);
return
0
;
}
...
...
@@ -265,7 +266,7 @@ size_t olm_group_decrypt(
plaintext
,
max_plaintext_length
);
mem
set
(
&
tmp_megolm
,
0
,
sizeof
(
tmp_megolm
));
_olm_un
set
(
&
tmp_megolm
,
sizeof
(
tmp_megolm
));
if
(
r
==
(
size_t
)
-
1
)
{
session
->
last_error
=
OLM_BAD_MESSAGE_MAC
;
return
r
;
...
...
src/outbound_group_session.c
View file @
fa1e9446
...
...
@@ -22,6 +22,7 @@
#include "olm/cipher.h"
#include "olm/error.h"
#include "olm/megolm.h"
#include "olm/memory.h"
#include "olm/message.h"
#include "olm/pickle.h"
#include "olm/pickle_encoding.h"
...
...
@@ -63,7 +64,7 @@ const char *olm_outbound_group_session_last_error(
size_t
olm_clear_outbound_group_session
(
OlmOutboundGroupSession
*
session
)
{
mem
set
(
session
,
0
,
sizeof
(
OlmOutboundGroupSession
));
_olm_un
set
(
session
,
sizeof
(
OlmOutboundGroupSession
));
return
sizeof
(
OlmOutboundGroupSession
);
}
...
...
Write
Preview
Supports
Markdown
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