cipher layer: IV length is not always block size

This commit is contained in:
Manuel Pégourié-Gonnard 2013-10-24 17:17:54 +02:00
parent e0dca4ad78
commit 0b58c150d6

View File

@ -152,10 +152,13 @@ enum {
POLARSSL_KEY_LENGTH_DES_EDE = 128, POLARSSL_KEY_LENGTH_DES_EDE = 128,
/** Key length, in bits (including parity), for DES in three-key EDE */ /** Key length, in bits (including parity), for DES in three-key EDE */
POLARSSL_KEY_LENGTH_DES_EDE3 = 192, 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. * 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 ); int (*get_padding)( unsigned char *input, size_t ilen, size_t *data_len );
/** Buffer for data that hasn't been encrypted yet */ /** 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 */ /** Number of bytes that still need processing */
size_t unprocessed_len; size_t unprocessed_len;