From 53014b4a47adcd959640c3934d4e503021f6c21c Mon Sep 17 00:00:00 2001 From: "Pavel V. Shatov (Meister)" Date: Sun, 1 Apr 2018 23:38:07 +0300 Subject: Added more test vectors to trigger the virtually never taken path in the curve point addition routine. --- stm32_driver/ecdsa256_driver_sample.c | 63 +++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 11 deletions(-) (limited to 'stm32_driver/ecdsa256_driver_sample.c') diff --git a/stm32_driver/ecdsa256_driver_sample.c b/stm32_driver/ecdsa256_driver_sample.c index 8047e98..fcfd3ae 100644 --- a/stm32_driver/ecdsa256_driver_sample.c +++ b/stm32_driver/ecdsa256_driver_sample.c @@ -1,5 +1,5 @@ // -// simple driver to test "ecdsa384" core in hardware +// simple driver to test "ecdsa256" core in hardware // // @@ -31,7 +31,7 @@ // curve selection #define USE_CURVE 1 -#include "ecdsa_model.h" +#include "../../../user/shatov/ecdsa_fpga_model/ecdsa_model.h" #define BUF_NUM_WORDS (OPERAND_WIDTH / (sizeof(uint32_t) << 3)) // 8 @@ -50,9 +50,16 @@ static const uint32_t p256_i[BUF_NUM_WORDS] = ECDSA_ONE; static const uint32_t p256_gx[BUF_NUM_WORDS] = ECDSA_G_X; static const uint32_t p256_gy[BUF_NUM_WORDS] = ECDSA_G_Y; +static const uint32_t p256_hx[BUF_NUM_WORDS] = ECDSA_H_X; +static const uint32_t p256_hy[BUF_NUM_WORDS] = ECDSA_H_Y; + static const uint32_t p256_z[BUF_NUM_WORDS] = ECDSA_ZERO; static const uint32_t p256_n[BUF_NUM_WORDS] = ECDSA_N; +static uint32_t p256_2[BUF_NUM_WORDS]; // 2 +static uint32_t p256_n1[BUF_NUM_WORDS]; // n + 1 +static uint32_t p256_n2[BUF_NUM_WORDS]; // n + 2 + // // prototypes // @@ -88,20 +95,54 @@ int main() while (1); } + // prepare more numbers + size_t w; + for (w=0; w