From 0b58c150d6bcc352a11d70125cde4a111364ae59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 24 Oct 2013 17:17:54 +0200 Subject: [PATCH] cipher layer: IV length is not always block size --- include/polarssl/cipher.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/polarssl/cipher.h b/include/polarssl/cipher.h index d73445cc6..c7ad5b780 100644 --- a/include/polarssl/cipher.h +++ b/include/polarssl/cipher.h @@ -152,10 +152,13 @@ enum { POLARSSL_KEY_LENGTH_DES_EDE = 128, /** Key length, in bits (including parity), for DES in three-key EDE */ POLARSSL_KEY_LENGTH_DES_EDE3 = 192, - /** Maximum length of any IV, in bytes */ - POLARSSL_MAX_IV_LENGTH = 16, }; +/** Maximum length of any IV, in bytes */ +#define POLARSSL_MAX_IV_LENGTH 16 +/** Maximum block size of any cipher, in bytes */ +#define POLARSSL_MAX_BLOCK_LENGTH 16 + /** * Base cipher information. The non-mode specific functions and values. */ @@ -248,7 +251,7 @@ typedef struct { int (*get_padding)( unsigned char *input, size_t ilen, size_t *data_len ); /** Buffer for data that hasn't been encrypted yet */ - unsigned char unprocessed_data[POLARSSL_MAX_IV_LENGTH]; + unsigned char unprocessed_data[POLARSSL_MAX_BLOCK_LENGTH]; /** Number of bytes that still need processing */ size_t unprocessed_len;