1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 05:28:40 +00:00

nem: Fix NEM_ENCRYPTED_SIZE

Include the extra padding block for multiples of AES_BLOCK_SIZE
This commit is contained in:
Saleem Rashid 2017-12-15 21:23:39 +00:00 committed by Pavol Rusnak
parent d41556d7fc
commit 44480ca15d

2
nem.h
View File

@ -52,7 +52,7 @@
#define NEM_SALT_SIZE sizeof(ed25519_public_key) #define NEM_SALT_SIZE sizeof(ed25519_public_key)
#define NEM_ENCRYPTED_SIZE(size) (((size) + AES_BLOCK_SIZE - 1) / AES_BLOCK_SIZE * AES_BLOCK_SIZE) #define NEM_ENCRYPTED_SIZE(size) (((size) + AES_BLOCK_SIZE) / AES_BLOCK_SIZE * AES_BLOCK_SIZE)
#define NEM_ENCRYPTED_PAYLOAD_SIZE(size) (AES_BLOCK_SIZE + NEM_SALT_SIZE + NEM_ENCRYPTED_SIZE(size)) #define NEM_ENCRYPTED_PAYLOAD_SIZE(size) (AES_BLOCK_SIZE + NEM_SALT_SIZE + NEM_ENCRYPTED_SIZE(size))
#define NEM_DECRYPTED_SIZE(buffer, size) ((size) - ((buffer)[(size) - 1])) #define NEM_DECRYPTED_SIZE(buffer, size) ((size) - ((buffer)[(size) - 1]))