From ad16c553fbf8518c67c24cf1e821a5529175739f Mon Sep 17 00:00:00 2001 From: Moritz Wettermann Date: Tue, 30 Apr 2024 15:45:50 +0200 Subject: [PATCH] [crypto] Rename variable of verification result in P-384 Verify Signed-off-by: Moritz Wettermann --- sw/otbn/crypto/p384_ecdsa_verify.s | 6 +++--- sw/otbn/crypto/p384_verify.s | 12 ++++++------ sw/otbn/crypto/tests/p384_ecdsa_verify_test.s | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sw/otbn/crypto/p384_ecdsa_verify.s b/sw/otbn/crypto/p384_ecdsa_verify.s index 4dbe77dec4b663..676b40e71b8849 100644 --- a/sw/otbn/crypto/p384_ecdsa_verify.s +++ b/sw/otbn/crypto/p384_ecdsa_verify.s @@ -38,7 +38,7 @@ start: * @param[in] dmem[s]: s part of signature * @param[in] dmem[x]: x-coordinate of public key * @param[in] dmem[y]: y-coordinate of public key - * @param[out] dmem[rnd]: x1 coordinate to be compared to rs + * @param[out] dmem[x_r]: x1 coordinate to be compared to rs * * !!! Attention !!! - before signature verification p384_curve_point_valid * binary has to be executed to check if the provided public key is valid. @@ -53,9 +53,9 @@ ecdsa_verify: .bss /* result of verify (x1 coordinate) */ -.globl rnd +.globl x_r .balign 32 -rnd: +x_r: .zero 64 .data diff --git a/sw/otbn/crypto/p384_verify.s b/sw/otbn/crypto/p384_verify.s index 80c008407660d3..c657d250d08468 100644 --- a/sw/otbn/crypto/p384_verify.s +++ b/sw/otbn/crypto/p384_verify.s @@ -100,7 +100,7 @@ store_proj: * @param[in] dmem[msg]: message to be verified in dmem * @param[in] dmem[x]: x-coordinate of public key in dmem * @param[in] dmem[y]: y-coordinate of public key in dmem - * @param[out] dmem[rnd]: verification result: reduced affine x1-coordinate + * @param[out] dmem[x_r]: verification result: reduced affine x1-coordinate * * Scratchpad memory layout: * The routine expects at least 896 bytes of scratchpad memory at dmem @@ -131,7 +131,7 @@ p384_verify: la x7, s /* get dmem pointer of verification result (x1-coordinate) */ - la x8, rnd + la x8, x_r /* get dmem pointer of message */ la x9, msg @@ -405,7 +405,7 @@ p384_verify: bn.sel w4, w16, w4, C bn.sel w5, w17, w5, C - /* store affine x-coordinate in dmem: dmem[dptr_rnd] <= x1 = [w5,w4] */ + /* store affine x-coordinate in dmem: dmem[x_r] <= x1 = [w5,w4] */ li x2, 4 bn.sid x2++, 0(x8) bn.sid x2++, 32(x8) @@ -457,9 +457,9 @@ y: .zero 64 /* verification result (x1-coordinate) */ -.globl rnd -.weak rnd -rnd: +.globl x_r +.weak x_r +x_r: .zero 64 /* Scratchpad memory */ diff --git a/sw/otbn/crypto/tests/p384_ecdsa_verify_test.s b/sw/otbn/crypto/tests/p384_ecdsa_verify_test.s index fb3b7b4e1ac31f..770b9c78cf91e2 100644 --- a/sw/otbn/crypto/tests/p384_ecdsa_verify_test.s +++ b/sw/otbn/crypto/tests/p384_ecdsa_verify_test.s @@ -19,7 +19,7 @@ p384_ecdsa_verify_test: /* load signature to wregs for comparison with reference */ li x2, 0 - la x3, rnd + la x3, x_r bn.lid x2++, 0(x3) bn.lid x2, 32(x3) @@ -113,7 +113,7 @@ y: .word 0xaaafcad2 .zero 16 -/* signature verification result x_res (rnd) */ -.globl rnd -rnd: +/* signature verification result x_res (x_r) */ +.globl x_r +x_r: .zero 64