added mpi print
This commit is contained in:
@@ -73,6 +73,15 @@ mbedtls_mpi_uint mpi_get_uint(const mbedtls_mpi *X) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_mpi(const char *msg, int radix, const mbedtls_mpi *X) {
|
||||||
|
|
||||||
|
char Xchar[400] = {0};
|
||||||
|
size_t len = 0;
|
||||||
|
|
||||||
|
mbedtls_mpi_write_string(X, radix, Xchar, sizeof(Xchar), &len);
|
||||||
|
printf("%s[%d] %s\n", msg, len, Xchar);
|
||||||
|
}
|
||||||
|
|
||||||
bool emv_rocacheck(const unsigned char *buf, size_t buflen) {
|
bool emv_rocacheck(const unsigned char *buf, size_t buflen) {
|
||||||
|
|
||||||
mbedtls_mpi t_modulus;
|
mbedtls_mpi t_modulus;
|
||||||
@@ -83,6 +92,7 @@ bool emv_rocacheck(const unsigned char *buf, size_t buflen) {
|
|||||||
rocacheck_init();
|
rocacheck_init();
|
||||||
|
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary(&t_modulus, buf, buflen) );
|
MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary(&t_modulus, buf, buflen) );
|
||||||
|
print_mpi("--t_modulus:", 16, &t_modulus);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < ROCA_PRINTS_LENGTH; i++) {
|
for (int i = 0; i < ROCA_PRINTS_LENGTH; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user