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
ddc981c4
Commit
ddc981c4
authored
May 31, 2018
by
Hubert Chathi
Browse files
fix a length check and add some missing length checks
parent
6d868354
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cipher.cpp
View file @
ddc981c4
...
...
@@ -70,8 +70,9 @@ size_t aes_sha_256_cipher_encrypt(
)
{
auto
*
c
=
reinterpret_cast
<
const
_olm_cipher_aes_sha_256
*>
(
cipher
);
if
(
aes_sha_256_cipher_encrypt_ciphertext_length
(
cipher
,
plaintext_length
)
<
ciphertext_length
)
{
if
(
ciphertext_length
<
aes_sha_256_cipher_encrypt_ciphertext_length
(
cipher
,
plaintext_length
)
||
output_length
<
MAC_LENGTH
)
{
return
std
::
size_t
(
-
1
);
}
...
...
@@ -109,6 +110,12 @@ size_t aes_sha_256_cipher_decrypt(
uint8_t
const
*
ciphertext
,
size_t
ciphertext_length
,
uint8_t
*
plaintext
,
size_t
max_plaintext_length
)
{
if
(
max_plaintext_length
<
aes_sha_256_cipher_decrypt_max_plaintext_length
(
cipher
,
ciphertext_length
)
||
input_length
<
MAC_LENGTH
)
{
return
std
::
size_t
(
-
1
);
}
auto
*
c
=
reinterpret_cast
<
const
_olm_cipher_aes_sha_256
*>
(
cipher
);
DerivedKeys
keys
;
...
...
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