mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-30 15:32:58 +00:00
mbedtls_ecp_write_key: no FEATURE_UNAVAILABLE error
When exporting a key, MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE should not happen. This error indicates that the curve is not supported, but that would prevent the creation of the key. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
0315123cfb
commit
5bb04e03ac
@ -1339,8 +1339,6 @@ int mbedtls_ecp_read_key(mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key,
|
|||||||
* \return \c 0 on success.
|
* \return \c 0 on success.
|
||||||
* \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL if the \p key
|
* \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL if the \p key
|
||||||
representation is larger than the available space in \p buf.
|
representation is larger than the available space in \p buf.
|
||||||
* \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the operation for
|
|
||||||
* the group is not implemented.
|
|
||||||
* \return Another negative error code on different kinds of failure.
|
* \return Another negative error code on different kinds of failure.
|
||||||
*/
|
*/
|
||||||
int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key,
|
int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key,
|
||||||
|
@ -3305,7 +3305,7 @@ cleanup:
|
|||||||
int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key,
|
int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key,
|
||||||
unsigned char *buf, size_t buflen)
|
unsigned char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECP_MONTGOMERY_ENABLED)
|
#if defined(MBEDTLS_ECP_MONTGOMERY_ENABLED)
|
||||||
if (mbedtls_ecp_get_type(&key->grp) == MBEDTLS_ECP_TYPE_MONTGOMERY) {
|
if (mbedtls_ecp_get_type(&key->grp) == MBEDTLS_ECP_TYPE_MONTGOMERY) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user