ECDH: Everest: align error code with ecdh.c

Arguably the value returned by Everest was more precise, but considering
we're in an LTS branch, I'd rather not change the value returned by
ecdh.c, and align the special case on the general case.

The added tests made it apparent that Everest and the generic code were
not returning the same value here. Alignment between the two values is
desirable to keep the test code simple and sweet.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2026-03-31 10:28:45 +02:00
parent fbabe53462
commit a2ca5fb23a

View File

@ -129,7 +129,7 @@ int mbedtls_x25519_calc_secret( mbedtls_x25519_context *ctx, size_t *olen,
*olen = MBEDTLS_X25519_KEY_SIZE_BYTES;
if( blen < *olen )
return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
/* scalarmult modifies this input, let's make a copy... */
unsigned char secret[MBEDTLS_X25519_KEY_SIZE_BYTES];