mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
Re-introduce ENUM validation in gcm.c
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com>
This commit is contained in:
@ -52,12 +52,6 @@
|
|||||||
|
|
||||||
#if !defined(MBEDTLS_GCM_ALT)
|
#if !defined(MBEDTLS_GCM_ALT)
|
||||||
|
|
||||||
/* Parameter validation macros */
|
|
||||||
#define GCM_VALIDATE_RET( cond ) \
|
|
||||||
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_GCM_BAD_INPUT )
|
|
||||||
#define GCM_VALIDATE( cond ) \
|
|
||||||
MBEDTLS_INTERNAL_VALIDATE( cond )
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize a context
|
* Initialize a context
|
||||||
*/
|
*/
|
||||||
@ -142,7 +136,8 @@ int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx,
|
|||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
const mbedtls_cipher_info_t *cipher_info;
|
const mbedtls_cipher_info_t *cipher_info;
|
||||||
|
|
||||||
GCM_VALIDATE_RET( keybits == 128 || keybits == 192 || keybits == 256 );
|
if( keybits != 128 && keybits != 192 && keybits != 256 )
|
||||||
|
return MBEDTLS_ERR_GCM_BAD_INPUT;
|
||||||
|
|
||||||
cipher_info = mbedtls_cipher_info_from_values( cipher, keybits,
|
cipher_info = mbedtls_cipher_info_from_values( cipher, keybits,
|
||||||
MBEDTLS_MODE_ECB );
|
MBEDTLS_MODE_ECB );
|
||||||
|
Reference in New Issue
Block a user