mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 16:55:43 +01:00
Merge pull request #4068 from stevew817/backport/pr-4008
[Backport 2.16] Avoid unreferenced items in ECDSA when ALT is in use
This commit is contained in:
commit
5d453ee882
@ -247,6 +247,9 @@ static void ecdsa_restart_det_free( mbedtls_ecdsa_restart_det_ctx *ctx )
|
|||||||
|
|
||||||
#endif /* MBEDTLS_ECP_RESTARTABLE */
|
#endif /* MBEDTLS_ECP_RESTARTABLE */
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECDSA_DETERMINISTIC) || \
|
||||||
|
!defined(MBEDTLS_ECDSA_SIGN_ALT) || \
|
||||||
|
!defined(MBEDTLS_ECDSA_VERIFY_ALT)
|
||||||
/*
|
/*
|
||||||
* Derive a suitable integer for group grp from a buffer of length len
|
* Derive a suitable integer for group grp from a buffer of length len
|
||||||
* SEC1 4.1.3 step 5 aka SEC1 4.1.4 step 3
|
* SEC1 4.1.3 step 5 aka SEC1 4.1.4 step 3
|
||||||
@ -269,6 +272,7 @@ static int derive_mpi( const mbedtls_ecp_group *grp, mbedtls_mpi *x,
|
|||||||
cleanup:
|
cleanup:
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
|
#endif /* ECDSA_DETERMINISTIC || !ECDSA_SIGN_ALT || !ECDSA_VERIFY_ALT */
|
||||||
|
|
||||||
#if !defined(MBEDTLS_ECDSA_SIGN_ALT)
|
#if !defined(MBEDTLS_ECDSA_SIGN_ALT)
|
||||||
/*
|
/*
|
||||||
@ -780,6 +784,8 @@ int mbedtls_ecdsa_write_signature_restartable( mbedtls_ecdsa_context *ctx,
|
|||||||
(void) md_alg;
|
(void) md_alg;
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDSA_SIGN_ALT)
|
#if defined(MBEDTLS_ECDSA_SIGN_ALT)
|
||||||
|
(void) rs_ctx;
|
||||||
|
|
||||||
MBEDTLS_MPI_CHK( mbedtls_ecdsa_sign( &ctx->grp, &r, &s, &ctx->d,
|
MBEDTLS_MPI_CHK( mbedtls_ecdsa_sign( &ctx->grp, &r, &s, &ctx->d,
|
||||||
hash, hlen, f_rng, p_rng ) );
|
hash, hlen, f_rng, p_rng ) );
|
||||||
#else
|
#else
|
||||||
@ -888,6 +894,8 @@ int mbedtls_ecdsa_read_signature_restartable( mbedtls_ecdsa_context *ctx,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
#if defined(MBEDTLS_ECDSA_VERIFY_ALT)
|
#if defined(MBEDTLS_ECDSA_VERIFY_ALT)
|
||||||
|
(void) rs_ctx;
|
||||||
|
|
||||||
if( ( ret = mbedtls_ecdsa_verify( &ctx->grp, hash, hlen,
|
if( ( ret = mbedtls_ecdsa_verify( &ctx->grp, hash, hlen,
|
||||||
&ctx->Q, &r, &s ) ) != 0 )
|
&ctx->Q, &r, &s ) ) != 0 )
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user