From 266984f6cb40b79e924eb31a48f055484b5626e2 Mon Sep 17 00:00:00 2001 From: "Pavel V. Shatov (Meister)" Date: Mon, 15 Oct 2018 16:01:34 +0300 Subject: Reworked Ed25519-specific microcode, added magic markers to allow automatic parsing. --- ed25519/ed25519_fpga_curve_microcode.cpp | 164 +++++++++++++++++++------------ 1 file changed, 100 insertions(+), 64 deletions(-) diff --git a/ed25519/ed25519_fpga_curve_microcode.cpp b/ed25519/ed25519_fpga_curve_microcode.cpp index 25826c5..37bbd1f 100644 --- a/ed25519/ed25519_fpga_curve_microcode.cpp +++ b/ed25519/ed25519_fpga_curve_microcode.cpp @@ -139,7 +139,10 @@ void fpga_curve_ed25519_base_scalar_multiply_microcode(const FPGA_BUFFER *K, FPG K_INT.words[FPGA_OPERAND_NUM_WORDS-1] &= 0x3FFFFFFF; K_INT.words[FPGA_OPERAND_NUM_WORDS-1] |= 0x40000000; - // initialization + + /* BEGIN_MICROCODE: PREPARE */ + + // initialize uop_move(BANK_HI, CONST_ZERO, BANK_LO, CYCLE_R0_X, BUF_LO, BUF_HI); uop_move(BANK_HI, CONST_ONE, BANK_LO, CYCLE_R0_Y, BUF_LO, BUF_HI); uop_move(BANK_HI, CONST_ONE, BANK_LO, CYCLE_R0_Z, BUF_LO, BUF_HI); @@ -150,6 +153,8 @@ void fpga_curve_ed25519_base_scalar_multiply_microcode(const FPGA_BUFFER *K, FPG uop_move(BANK_HI, CONST_ONE, BANK_LO, CYCLE_R1_Z, BUF_LO, BUF_HI); uop_move(BANK_HI, CONST_G_T, BANK_LO, CYCLE_R1_T, BUF_LO, BUF_HI); + /* END_MICROCODE */ + // multiply for (word_count=0; word_count