From f1cd108b1a432132c922fe62b6c9966f26fdec43 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Fri, 28 Dec 2018 18:09:20 +0200 Subject: [PATCH] move g_one to cycle --- client/emv/emv_roca.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/emv/emv_roca.c b/client/emv/emv_roca.c index 88a7b21ad..53fd91c15 100644 --- a/client/emv/emv_roca.c +++ b/client/emv/emv_roca.c @@ -84,18 +84,19 @@ bool emv_rocacheck(const unsigned char *buf, size_t buflen) { MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary(&t_modulus, buf, buflen) ); - mbedtls_mpi g_one; - mbedtls_mpi_init(&g_one); - MBEDTLS_MPI_CHK( mbedtls_mpi_read_string(&g_one, 10, "1") ); for (int i = 0; i < ROCA_PRINTS_LENGTH; i++) { printf("--roca:%d\n", i); mbedtls_mpi t_temp; mbedtls_mpi t_prime; + mbedtls_mpi g_one; mbedtls_mpi_init(&t_temp); mbedtls_mpi_init(&t_prime); + mbedtls_mpi_init(&g_one); + + MBEDTLS_MPI_CHK( mbedtls_mpi_read_string(&g_one, 10, "1") ); MBEDTLS_MPI_CHK( mbedtls_mpi_add_int(&t_prime, &t_prime, g_primes[i]) );