Branch: Tag:

2014-06-29

2014-06-29 14:58:49 by Henrik Grubbström (Grubba) <grubba@grubba.org>

SSL: Support EXTENSION_encrypt_then_mac.

This draft extension improves security for old CBC suites by
hashing the encrypted data including the padding. This works
around the various TLS padding attacks.

104:   //! between the server and client.   int ecc_point_format = POINT_uncompressed;    + //! Negotiated encrypt-then-mac mode. + int encrypt_then_mac = 0; +    /*    * End of extensions.    */
359:    }    }    +  if (encrypt_then_mac) { +  // Check if enrypt-then-mac is valid for the suite. +  if (((sizeof(CIPHER_SUITES[suite]) == 3) && +  ((< CIPHER_rc4, CIPHER_rc4_40 >)[CIPHER_SUITES[suite][1]])) || +  ((sizeof(CIPHER_SUITES[suite]) == 4) && +  (CIPHER_SUITES[suite][3] != MODE_cbc))) { +  // Encrypt-then-MAC not allowed with non-CBC suites. +  encrypt_then_mac = 0; +  SSL3_DEBUG_MSG("Encrypt-then-MAC: Disabled (not valid for suite).\n"); +  } else { +  SSL3_DEBUG_MSG("Encrypt-then-MAC: Enabled.\n"); +  } +  } +     return set_cipher_suite(suite, version, signature_algorithms,    max_hash_size);   }