diff options
Diffstat (limited to 'ed25519')
-rw-r--r-- | ed25519/ed25519_fpga_model.cpp | 25 | ||||
-rw-r--r-- | ed25519/ed25519_fpga_model.h | 3 |
2 files changed, 21 insertions, 7 deletions
diff --git a/ed25519/ed25519_fpga_model.cpp b/ed25519/ed25519_fpga_model.cpp index 69c184c..d0b5a25 100644 --- a/ed25519/ed25519_fpga_model.cpp +++ b/ed25519/ed25519_fpga_model.cpp @@ -40,7 +40,7 @@ //------------------------------------------------------------------------------ // Mode Switch //------------------------------------------------------------------------------ -#define USE_MICROCODE +//#define USE_MICROCODE //------------------------------------------------------------------------------ @@ -63,11 +63,12 @@ static FPGA_WORD fpga_model_ed25519_bswap (FPGA_WORD w); //------------------------------------------------------------------------------ // Locals //------------------------------------------------------------------------------ -static FPGA_BUFFER ed25519_d_1, ed25519_q_y_1; -static FPGA_BUFFER ed25519_d_2, ed25519_q_y_2; -static FPGA_BUFFER ed25519_d_3, ed25519_q_y_3; -static FPGA_BUFFER ed25519_d_4, ed25519_q_y_4; -static FPGA_BUFFER ed25519_d_5, ed25519_q_y_5; +static FPGA_BUFFER ed25519_d_1, ed25519_q_y_1; // #1 from RFC +static FPGA_BUFFER ed25519_d_2, ed25519_q_y_2; // #2 from RFC +static FPGA_BUFFER ed25519_d_3, ed25519_q_y_3; // #3 from RFC +static FPGA_BUFFER ed25519_d_4, ed25519_q_y_4; // #4 from RFC +static FPGA_BUFFER ed25519_d_5, ed25519_q_y_5; // #5 from RFC +static FPGA_BUFFER ed25519_d_6, ed25519_q_y_6; // randomized //------------------------------------------------------------------------------ @@ -127,6 +128,14 @@ int main() // + // test base point multiplier: Q = d * G + // + printf("Trying to derive public key from private key...\n\n"); + ok = test_ed25519_base_point_multiplier(&ed25519_d_6, &ed25519_q_y_6); + if (!ok) return EXIT_FAILURE; + + + // // everything went just fine // return EXIT_SUCCESS; @@ -144,12 +153,14 @@ static void fpga_model_ed25519_init() FPGA_WORD tmp_d_3[FPGA_OPERAND_NUM_WORDS] = ED25519_D_HASHED_LSB_3; FPGA_WORD tmp_d_4[FPGA_OPERAND_NUM_WORDS] = ED25519_D_HASHED_LSB_4; FPGA_WORD tmp_d_5[FPGA_OPERAND_NUM_WORDS] = ED25519_D_HASHED_LSB_5; + FPGA_WORD tmp_d_6[FPGA_OPERAND_NUM_WORDS] = ED25519_D_HASHED_LSB_6; FPGA_WORD tmp_q_y_1[FPGA_OPERAND_NUM_WORDS] = ED25519_Q_Y_1; FPGA_WORD tmp_q_y_2[FPGA_OPERAND_NUM_WORDS] = ED25519_Q_Y_2; FPGA_WORD tmp_q_y_3[FPGA_OPERAND_NUM_WORDS] = ED25519_Q_Y_3; FPGA_WORD tmp_q_y_4[FPGA_OPERAND_NUM_WORDS] = ED25519_Q_Y_4; FPGA_WORD tmp_q_y_5[FPGA_OPERAND_NUM_WORDS] = ED25519_Q_Y_5; + FPGA_WORD tmp_q_y_6[FPGA_OPERAND_NUM_WORDS] = ED25519_Q_Y_6; /* fill buffers for large multi-word integers */ for ( w_src = 0, w_dst = FPGA_OPERAND_NUM_WORDS - 1; @@ -161,6 +172,7 @@ static void fpga_model_ed25519_init() ed25519_d_3.words[w_dst] = tmp_d_3[w_src]; ed25519_d_4.words[w_dst] = tmp_d_4[w_src]; ed25519_d_5.words[w_dst] = tmp_d_5[w_src]; + ed25519_d_6.words[w_dst] = tmp_d_6[w_src]; // public key is in reverse order ed25519_q_y_1.words[w_dst] = fpga_model_ed25519_bswap(tmp_q_y_1[w_dst]); @@ -168,6 +180,7 @@ static void fpga_model_ed25519_init() ed25519_q_y_3.words[w_dst] = fpga_model_ed25519_bswap(tmp_q_y_3[w_dst]); ed25519_q_y_4.words[w_dst] = fpga_model_ed25519_bswap(tmp_q_y_4[w_dst]); ed25519_q_y_5.words[w_dst] = fpga_model_ed25519_bswap(tmp_q_y_5[w_dst]); + ed25519_q_y_6.words[w_dst] = fpga_model_ed25519_bswap(tmp_q_y_6[w_dst]); } } diff --git a/ed25519/ed25519_fpga_model.h b/ed25519/ed25519_fpga_model.h index edc554c..e5959e8 100644 --- a/ed25519/ed25519_fpga_model.h +++ b/ed25519/ed25519_fpga_model.h @@ -42,7 +42,8 @@ //------------------------------------------------------------------------------ #include "curve25519_fpga_model.h" #include "ed25519_fpga_curve.h" -#include "ed25519_test_vectors.h" +#include "ed25519_test_vectors_rfc8032.h" +#include "ed25519_test_vector_randomized.h" //------------------------------------------------------------------------------ |