diff --git a/client/emv/emv_roca.c b/client/emv/emv_roca.c index 53fd91c15..ad39d1043 100644 --- a/client/emv/emv_roca.c +++ b/client/emv/emv_roca.c @@ -73,6 +73,15 @@ mbedtls_mpi_uint mpi_get_uint(const mbedtls_mpi *X) { 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) { mbedtls_mpi t_modulus; @@ -83,6 +92,7 @@ bool emv_rocacheck(const unsigned char *buf, size_t buflen) { rocacheck_init(); 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++) {