1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/crypto/ocb: fix max data condition

This commit is contained in:
Alexandre Abadie 2019-11-06 12:14:05 +01:00
parent d9ca9f3ef2
commit 607aa6fbcd
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -319,8 +319,7 @@ int32_t cipher_decrypt_ocb(cipher_t *cipher, uint8_t *auth_data,
uint8_t tag_len, uint8_t *nonce, size_t nonce_len,
uint8_t *input, size_t input_len, uint8_t *output)
{
if (input_len - tag_len > INT32_MAX) {
if (input_len > (uint32_t)(INT32_MAX + tag_len)) {
// We would not be able to return the proper output length for data this long
return OCB_ERR_INVALID_DATA_LENGTH;
}