That prevents incorrect data reaching nettle which has only
assertion checks (leading to an abort).
Issue found using oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=389
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
gnutls_datum_t dkey, d_iv;
cipher_hd_st ch;
uint8_t key[16];
+ const unsigned block_size = 8;
if (enc_params->cipher != GNUTLS_CIPHER_DES_CBC)
return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR);
+ if (encrypted_data->size % block_size != 0)
+ return gnutls_assert_val(GNUTLS_E_ILLEGAL_PARAMETER);
+
/* generate the key
*/
pbkdf1_md5(password, password_len, kdf_params->salt, kdf_params->iter_count, sizeof(key), key);