From 3f00ea77b8b9415632f399746bf25b0c48e78b35 Mon Sep 17 00:00:00 2001 From: maosiping Date: Mon, 24 Apr 2023 19:38:42 +0800 Subject: [PATCH] adapter 2.16.11 Signed-off-by: maosiping --- .../hisi_mbedtls-2.16.10.patch | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/sdk_linux/soc/src/interdrv/common/cipher/mbedtls_prepare/hisi_mbedtls-2.16.10.patch b/sdk_linux/soc/src/interdrv/common/cipher/mbedtls_prepare/hisi_mbedtls-2.16.10.patch index 88bea60..5b403d3 100644 --- a/sdk_linux/soc/src/interdrv/common/cipher/mbedtls_prepare/hisi_mbedtls-2.16.10.patch +++ b/sdk_linux/soc/src/interdrv/common/cipher/mbedtls_prepare/hisi_mbedtls-2.16.10.patch @@ -53,10 +53,10 @@ index 4d04b33..ddc2635 100755 * \brief Fill an MPI with a number of random bytes. * diff --git a/include/mbedtls/bn_mul.h b/include/mbedtls/bn_mul.h -index 9615090..e1bf798 100755 +index 6f1201b..ce4f9e1 100644 --- a/include/mbedtls/bn_mul.h +++ b/include/mbedtls/bn_mul.h -@@ -447,7 +447,7 @@ +@@ -487,7 +487,7 @@ * The Sparc(64) assembly is reported to be broken. * Disable it for now, until we're able to fix it. */ @@ -92,7 +92,7 @@ index 1f41b52..133ace5 100755 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) #define MBEDTLS_CIPHER_MODE_AEAD diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h -index 6e0d9e9..53c1a8b 100755 +index 3dfc347..a52337b 100755 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -53,12 +53,13 @@ @@ -1125,7 +1125,7 @@ index 10239fd..36227c7 100755 +#endif #endif /* MBEDTLS_ASN1_PARSE_C */ diff --git a/library/bignum.c b/library/bignum.c -index f133f6c..99abfa9 100755 +index 540f752..45c3579 100755 --- a/library/bignum.c +++ b/library/bignum.c @@ -72,13 +72,12 @@ @@ -1167,7 +1167,7 @@ index f133f6c..99abfa9 100755 /* * Swap the contents of X and Y */ -@@ -310,7 +312,9 @@ int mbedtls_mpi_safe_cond_assign( mbedtls_mpi *X, const mbedtls_mpi *Y, unsigned +@@ -369,7 +371,9 @@ int mbedtls_mpi_safe_cond_assign( mbedtls_mpi *X, const mbedtls_mpi *Y, unsigned cleanup: return( ret ); } @@ -1177,7 +1177,7 @@ index f133f6c..99abfa9 100755 /* * Conditionally swap X and Y, without leaking information * about whether the swap was made or not. -@@ -349,6 +353,7 @@ int mbedtls_mpi_safe_cond_swap( mbedtls_mpi *X, mbedtls_mpi *Y, unsigned char sw +@@ -422,6 +426,7 @@ int mbedtls_mpi_safe_cond_swap( mbedtls_mpi *X, mbedtls_mpi *Y, unsigned char sw cleanup: return( ret ); } @@ -1185,7 +1185,7 @@ index f133f6c..99abfa9 100755 /* * Set value from integer -@@ -567,6 +572,7 @@ cleanup: +@@ -630,6 +635,7 @@ cleanup: return( ret ); } @@ -1193,7 +1193,7 @@ index f133f6c..99abfa9 100755 /* * Helper to write the digits high-order first. */ -@@ -692,6 +698,7 @@ cleanup: +@@ -755,6 +761,7 @@ cleanup: return( ret ); } @@ -1201,7 +1201,7 @@ index f133f6c..99abfa9 100755 #if defined(MBEDTLS_FS_IO) /* -@@ -1834,6 +1841,7 @@ cleanup: +@@ -1909,6 +1916,7 @@ cleanup: return( ret ); } @@ -1209,7 +1209,7 @@ index f133f6c..99abfa9 100755 /* * Division by int: A = Q * b + R */ -@@ -1852,6 +1860,7 @@ int mbedtls_mpi_div_int( mbedtls_mpi *Q, mbedtls_mpi *R, +@@ -1927,6 +1935,7 @@ int mbedtls_mpi_div_int( mbedtls_mpi *Q, mbedtls_mpi *R, return( mbedtls_mpi_div_mpi( Q, R, A, &_B ) ); } @@ -1217,7 +1217,7 @@ index f133f6c..99abfa9 100755 /* * Modulo: R = A mod B -@@ -1879,6 +1888,7 @@ cleanup: +@@ -1954,6 +1963,7 @@ cleanup: return( ret ); } @@ -1225,7 +1225,7 @@ index f133f6c..99abfa9 100755 /* * Modulo: r = A mod b */ -@@ -2044,7 +2054,7 @@ static void mpi_montred( mbedtls_mpi *A, const mbedtls_mpi *N, +@@ -2185,7 +2195,7 @@ cleanup: /* * Sliding-window exponentiation: X = A^E mod N (HAC 14.85) */ @@ -1234,17 +1234,17 @@ index f133f6c..99abfa9 100755 const mbedtls_mpi *E, const mbedtls_mpi *N, mbedtls_mpi *_RR ) { -@@ -2053,7 +2063,8 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A, +@@ -2194,7 +2204,8 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A, size_t i, j, nblimbs; size_t bufsize, nbits; mbedtls_mpi_uint ei, mm, state; -- mbedtls_mpi RR, T, W[ 1 << MBEDTLS_MPI_WINDOW_SIZE ], Apos; -+ mbedtls_mpi RR, T, Apos; +- mbedtls_mpi RR, T, W[ 1 << MBEDTLS_MPI_WINDOW_SIZE ], WW, Apos; ++ mbedtls_mpi RR, T, WW, Apos; + mbedtls_mpi *W = NULL; int neg; MPI_VALIDATE_RET( X != NULL ); -@@ -2071,13 +2082,18 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A, +@@ -2212,6 +2223,12 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A, mbedtls_mpi_bitlen( N ) > MBEDTLS_MPI_MAX_BITS ) return ( MBEDTLS_ERR_MPI_BAD_INPUT_DATA ); @@ -1257,14 +1257,15 @@ index f133f6c..99abfa9 100755 /* * Init temps and window size */ - mpi_montg_init( &mm, N ); +@@ -2219,7 +2236,6 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A, mbedtls_mpi_init( &RR ); mbedtls_mpi_init( &T ); mbedtls_mpi_init( &Apos ); + mbedtls_mpi_init( &WW ); - memset( W, 0, sizeof( W ) ); i = mbedtls_mpi_bitlen( E ); -@@ -2259,6 +2275,12 @@ cleanup: +@@ -2412,6 +2428,12 @@ cleanup: if( _RR == NULL || _RR->p == NULL ) mbedtls_mpi_free( &RR ); @@ -1277,7 +1278,7 @@ index f133f6c..99abfa9 100755 return( ret ); } -@@ -2453,8 +2475,6 @@ cleanup: +@@ -2667,8 +2689,6 @@ cleanup: return( ret ); } @@ -1286,7 +1287,7 @@ index f133f6c..99abfa9 100755 static const int small_prime[] = { 3, 5, 7, 11, 13, 17, 19, 23, -@@ -2718,7 +2738,7 @@ int mbedtls_mpi_gen_prime( mbedtls_mpi *X, size_t nbits, int flags, +@@ -2932,7 +2952,7 @@ int mbedtls_mpi_gen_prime( mbedtls_mpi *X, size_t nbits, int flags, while( 1 ) { MBEDTLS_MPI_CHK( mbedtls_mpi_fill_random( X, n * ciL, f_rng, p_rng ) ); -- Gitee