mbedtls: Fix a case for mpi_montgomery_exp_calc() when Z is not init

Closes: IDF-1870

Closes: IDFGH-3671

Closes: https://github.com/espressif/esp-idf/issues/5605
This commit is contained in:
KonstantinKondrashov
2020-07-07 02:01:44 +08:00
parent bd72a9ab2b
commit c519d78e00
2 changed files with 44 additions and 12 deletions

View File

@@ -318,7 +318,7 @@ static int mont(mbedtls_mpi* Z, const mbedtls_mpi* X, const mbedtls_mpi* Y, cons
mpi_to_mem_block(RSA_MEM_RB_BLOCK_BASE, Y, hw_words);
start_op(RSA_MULT_START_REG);
Z->s = 1; // The sign of Z will be = M->s (but M->s is always 1)
MBEDTLS_MPI_CHK( mbedtls_mpi_grow(Z, hw_words) );
wait_op_complete(RSA_MULT_START_REG);