mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 04:14:23 +01:00
Use mbedtls_mpi_lset() more
Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
bc96a79854
commit
1c6a439783
@ -648,7 +648,7 @@ static int ecp_mod_p256k1( mbedtls_mpi * );
|
|||||||
|
|
||||||
#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
|
#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
|
||||||
/* Constants used by ecp_use_curve25519() */
|
/* Constants used by ecp_use_curve25519() */
|
||||||
static const unsigned char curve25519_a24[] = { 0x01, 0xDB, 0x42 };
|
static const mbedtls_mpi_sint curve25519_a24 = 0x01DB42;
|
||||||
static const unsigned char curve25519_part_of_n[] = {
|
static const unsigned char curve25519_part_of_n[] = {
|
||||||
0x14, 0xDE, 0xF9, 0xDE, 0xA2, 0xF7, 0x9C, 0xD6,
|
0x14, 0xDE, 0xF9, 0xDE, 0xA2, 0xF7, 0x9C, 0xD6,
|
||||||
0x58, 0x12, 0x63, 0x1A, 0x5C, 0xF5, 0xD3, 0xED,
|
0x58, 0x12, 0x63, 0x1A, 0x5C, 0xF5, 0xD3, 0xED,
|
||||||
@ -662,8 +662,7 @@ static int ecp_use_curve25519( mbedtls_ecp_group *grp )
|
|||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
|
|
||||||
/* Actually ( A + 2 ) / 4 */
|
/* Actually ( A + 2 ) / 4 */
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &grp->A,
|
MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &grp->A, curve25519_a24 ) );
|
||||||
curve25519_a24, sizeof( curve25519_a24 ) ) );
|
|
||||||
|
|
||||||
/* P = 2^255 - 19 */
|
/* P = 2^255 - 19 */
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &grp->P, 1 ) );
|
MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &grp->P, 1 ) );
|
||||||
@ -695,7 +694,7 @@ cleanup:
|
|||||||
|
|
||||||
#if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
|
#if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
|
||||||
/* Constants used by ecp_use_curve448() */
|
/* Constants used by ecp_use_curve448() */
|
||||||
static const unsigned char curve448_a24[] = { 0x98, 0xAA };
|
static const mbedtls_mpi_sint curve448_a24 = 0x98AA;
|
||||||
static const unsigned char curve448_part_of_n[] = {
|
static const unsigned char curve448_part_of_n[] = {
|
||||||
0x83, 0x35, 0xDC, 0x16, 0x3B, 0xB1, 0x24,
|
0x83, 0x35, 0xDC, 0x16, 0x3B, 0xB1, 0x24,
|
||||||
0xB6, 0x51, 0x29, 0xC9, 0x6F, 0xDE, 0x93,
|
0xB6, 0x51, 0x29, 0xC9, 0x6F, 0xDE, 0x93,
|
||||||
@ -714,8 +713,7 @@ static int ecp_use_curve448( mbedtls_ecp_group *grp )
|
|||||||
mbedtls_mpi_init( &Ns );
|
mbedtls_mpi_init( &Ns );
|
||||||
|
|
||||||
/* Actually ( A + 2 ) / 4 */
|
/* Actually ( A + 2 ) / 4 */
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &grp->A,
|
MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &grp->A, curve448_a24 ) );
|
||||||
curve448_a24, sizeof( curve448_a24 ) ) );
|
|
||||||
|
|
||||||
/* P = 2^448 - 2^224 - 1 */
|
/* P = 2^448 - 2^224 - 1 */
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &grp->P, 1 ) );
|
MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &grp->P, 1 ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user