From 44480ca15db7e79c14b3832ccfb5c01c5fef969b Mon Sep 17 00:00:00 2001 From: Saleem Rashid Date: Fri, 15 Dec 2017 21:23:39 +0000 Subject: [PATCH] nem: Fix NEM_ENCRYPTED_SIZE Include the extra padding block for multiples of AES_BLOCK_SIZE --- nem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nem.h b/nem.h index b6e419726..67de2e630 100644 --- a/nem.h +++ b/nem.h @@ -52,7 +52,7 @@ #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_DECRYPTED_SIZE(buffer, size) ((size) - ((buffer)[(size) - 1]))