arch/risc-v/esp32c3: Remove the bignum test from the driver.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
parent
91cb9dafaf
commit
e424241d09
@ -1045,13 +1045,4 @@ endmenu # Partition Configuration
|
||||
|
||||
endif
|
||||
|
||||
menu "BIGNUM"
|
||||
depends on ESP32C3_BIGNUM_ACCELERATOR
|
||||
|
||||
config ESP32C3_BIGNUM_ACCELERATOR_TEST
|
||||
bool "BIGNUM driver test"
|
||||
default n
|
||||
|
||||
endmenu # ESP32C3_BIGNUM_ACCELERATOR
|
||||
|
||||
endif # ARCH_CHIP_ESP32C3
|
||||
|
@ -3815,253 +3815,5 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Test Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32C3_BIGNUM_ACCELERATOR_TEST
|
||||
|
||||
#define GCD_PAIR_COUNT 3
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32c3_mpi_self_test
|
||||
*
|
||||
* Description:
|
||||
* Checkup routine
|
||||
*
|
||||
* Input Parameters:
|
||||
* verbose - The result output or not
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32c3_mpi_self_test(int verbose)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
struct esp32c3_mpi_s A;
|
||||
struct esp32c3_mpi_s E;
|
||||
struct esp32c3_mpi_s N;
|
||||
struct esp32c3_mpi_s X;
|
||||
struct esp32c3_mpi_s Y;
|
||||
struct esp32c3_mpi_s U;
|
||||
struct esp32c3_mpi_s V;
|
||||
|
||||
const int gcd_pairs[GCD_PAIR_COUNT][3] =
|
||||
{
|
||||
{
|
||||
693, 609, 21
|
||||
},
|
||||
|
||||
{
|
||||
1764, 868, 28
|
||||
},
|
||||
|
||||
{
|
||||
768454923, 542167814, 1
|
||||
}
|
||||
};
|
||||
|
||||
esp32c3_mpi_init(&A);
|
||||
esp32c3_mpi_init(&E);
|
||||
esp32c3_mpi_init(&N);
|
||||
esp32c3_mpi_init(&X);
|
||||
esp32c3_mpi_init(&Y);
|
||||
esp32c3_mpi_init(&U);
|
||||
esp32c3_mpi_init(&V);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_read_string(&A, 16,
|
||||
"EFE021C2645FD1DC586E69184AF4A31E" \
|
||||
"D5F53E93B5F123FA41680867BA110131" \
|
||||
"944FE7952E2517337780CB0DB80E61AA" \
|
||||
"E7C8DDC6C5C6AADEB34EB38A2F40D5E6"), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_read_string(&E, 16,
|
||||
"B2E7EFD37075B9F03FF989C7C5051C20" \
|
||||
"34D2A323810251127E7BF8625A4F49A5" \
|
||||
"F3E27F4DA8BD59C47D6DAABA4C8127BD" \
|
||||
"5B5C25763222FEFCCFC38B832366C29E"), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_read_string(&N, 16,
|
||||
"0066A198186C18C10B2F5ED9B522752A" \
|
||||
"9830B69916E535C8F047518A889A43A5" \
|
||||
"94B6BED27A168D31D4A52F88925AA8F5"), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_mul_mpi(&X, &A, &N), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_read_string(&U, 16,
|
||||
"602AB7ECA597A3D6B56FF9829A5E8B85" \
|
||||
"9E857EA95A03512E2BAE7391688D264A" \
|
||||
"A5663B0341DB9CCFD2C4C5F421FEC814" \
|
||||
"8001B72E848A38CAE1C65F78E56ABDEF" \
|
||||
"E12D3C039B8A02D6BE593F0BBBDA56F1" \
|
||||
"ECF677152EF804370C1A305CAF3B5BF1" \
|
||||
"30879B56C61DE584A0F53A2447A51E"), cleanup);
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, " MPI test #1 (mul_mpi): ");
|
||||
}
|
||||
|
||||
if (esp32c3_mpi_cmp_mpi(&X, &U) != 0)
|
||||
{
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "failed\n");
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "passed\n");
|
||||
}
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_div_mpi(&X, &Y, &A, &N), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_read_string(&U, 16,
|
||||
"256567336059E52CAE22925474705F39A94"), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_read_string(&V, 16,
|
||||
"6613F26162223DF488E9CD48CC132C7A" \
|
||||
"0AC93C701B001B092E4E5B9F73BCD27B" \
|
||||
"9EE50D0657C77F374E903CDFA4C642"), cleanup);
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, " MPI test #2 (div_mpi): ");
|
||||
}
|
||||
|
||||
if (esp32c3_mpi_cmp_mpi(&X, &U) != 0 ||
|
||||
esp32c3_mpi_cmp_mpi(&Y, &V) != 0)
|
||||
{
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "failed\n");
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "passed\n");
|
||||
}
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_exp_mod(&X, &A, &E, &N, NULL), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_read_string(&U, 16,
|
||||
"36E139AEA55215609D2816998ED020BB" \
|
||||
"BD96C37890F65171D948E9BC7CBAA4D9" \
|
||||
"325D24D6A3C12710F10A09FA08AB87"), cleanup);
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, " MPI test #3 (exp_mod): ");
|
||||
}
|
||||
|
||||
if (esp32c3_mpi_cmp_mpi(&X, &U) != 0)
|
||||
{
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "failed\n");
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "passed\n");
|
||||
}
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_inv_mod(&X, &A, &N), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_read_string(&U, 16,
|
||||
"003A0AAEDD7E784FC07D8F9EC6E3BFD5" \
|
||||
"C3DBA76456363A10869622EAC2DD84EC" \
|
||||
"C5B8A74DAC4D09E03B5E0BE779F2DF61"), cleanup);
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, " MPI test #4 (inv_mod): ");
|
||||
}
|
||||
|
||||
if (esp32c3_mpi_cmp_mpi(&X, &U) != 0)
|
||||
{
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "failed\n");
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "passed\n");
|
||||
}
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, " MPI test #5 (simple gcd): ");
|
||||
}
|
||||
|
||||
for (i = 0; i < GCD_PAIR_COUNT; i++)
|
||||
{
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_lset(&X, gcd_pairs[i][0]), cleanup);
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_lset(&Y, gcd_pairs[i][1]), cleanup);
|
||||
|
||||
ESP32C3_MPI_CHK(esp32c3_mpi_gcd(&A, &X, &Y), cleanup);
|
||||
|
||||
if (esp32c3_mpi_cmp_int(&A, gcd_pairs[i][2]) != 0)
|
||||
{
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "failed at %d\n", i);
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "passed\n");
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
if (ret != 0 && verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "Unexpected error, return code = %08X\n", ret);
|
||||
}
|
||||
|
||||
esp32c3_mpi_free(&A);
|
||||
esp32c3_mpi_free(&E);
|
||||
esp32c3_mpi_free(&N);
|
||||
esp32c3_mpi_free(&X);
|
||||
esp32c3_mpi_free(&Y);
|
||||
esp32c3_mpi_free(&U);
|
||||
esp32c3_mpi_free(&V);
|
||||
|
||||
if (verbose != 0)
|
||||
{
|
||||
syslog(LOG_INFO, "\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ESP32C3_BIGNUM_ACCELERATOR_TEST */
|
||||
|
||||
#endif /* CONFIG_ESP32C3_BIGNUM_ACCELERATOR */
|
||||
|
||||
|
@ -863,26 +863,6 @@ int esp32c3_mpi_inv_mod(struct esp32c3_mpi_s *X,
|
||||
const struct esp32c3_mpi_s *A,
|
||||
const struct esp32c3_mpi_s *N);
|
||||
|
||||
#ifdef CONFIG_ESP32C3_BIGNUM_ACCELERATOR_TEST
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32c3_mpi_self_test
|
||||
*
|
||||
* Description:
|
||||
* Checkup routine
|
||||
*
|
||||
* Input Parameters:
|
||||
* verbose - The result output or not
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32c3_mpi_self_test(int verbose);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -23,7 +23,6 @@ CONFIG_DEBUG_ASSERTIONS=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_ESP32C3_BIGNUM_ACCELERATOR=y
|
||||
CONFIG_ESP32C3_BIGNUM_ACCELERATOR_TEST=y
|
||||
CONFIG_ESP32C3_RSA_ACCELERATOR=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
|
Loading…
Reference in New Issue
Block a user