* Do not add any algorithms in other modes (avoid modified algorithms).
* View first: "The order of encryption and authentication for
* protecting communications" by Hugo Krawczyk - CRYPTO 2001
+ *
+ * Make sure to updated MAX_CIPHER_BLOCK_SIZE and MAX_CIPHER_KEY_SIZE as well.
*/
static const gnutls_cipher_entry algorithms[] = {
{"AES-256-CBC", GNUTLS_CIPHER_AES_256_CBC, 16, 32, CIPHER_BLOCK, 16, 0},
int pos, ret;
int block_size;
char buf[65];
+ /* avoid using malloc */
+ opaque key_block[2 * MAX_HASH_SIZE + 2 * MAX_CIPHER_KEY_SIZE + 2 * MAX_CIPHER_BLOCK_SIZE];
if (session->cipher_specs.generated_keys != 0)
{
if (export_flag == 0)
block_size += 2 * IV_size;
- /* avoid using malloc */
- opaque key_block[block_size];
-
memcpy (rnd, session->security_parameters.server_random,
GNUTLS_RANDOM_SIZE);
memcpy (&rnd[GNUTLS_RANDOM_SIZE],
}
else if (IV_size > 0 && export_flag != 0)
{
- opaque iv_block[IV_size * 2];
+ opaque iv_block[MAX_CIPHER_BLOCK_SIZE * 2];
if (session->security_parameters.version == GNUTLS_SSL3)
{ /* SSL 3 */
/* The maximum digest size of hash algorithms.
*/
#define MAX_HASH_SIZE 64
+#define MAX_CIPHER_BLOCK_SIZE 16
+#define MAX_CIPHER_KEY_SIZE 32
#define MAX_LOG_SIZE 1024 /* maximum size of log message */
#define MAX_SRP_USERNAME 128