[Cryptech-Commits] [sw/libhal] 01/04: Cleanup.

git at cryptech.is git at cryptech.is
Thu Mar 9 05:56:30 UTC 2017


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch pymux
in repository sw/libhal.

commit 00d93e0898d5ba5ff3c749105569b23a16c7b0cc
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Wed Mar 8 23:23:41 2017 -0500

    Cleanup.
---
 ecdsa.c | 31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

diff --git a/ecdsa.c b/ecdsa.c
index 3ca377b..16d2b27 100644
--- a/ecdsa.c
+++ b/ecdsa.c
@@ -89,36 +89,17 @@
 #endif
 
 /*
- * Whether to use experimental Verilog ECDSA-P256 point multiplier.
+ * Whether to use the Verilog point multipliers.
  */
 
 #ifndef HAL_ECDSA_VERILOG_ECDSA256_MULTIPLIER
 #define HAL_ECDSA_VERILOG_ECDSA256_MULTIPLIER 1
 #endif
 
-#if HAL_ECDSA_VERILOG_ECDSA256_MULTIPLIER
-static int verilog_ecdsa256_multiplier = 1;
-#endif
-
-/*
- * Whether to use experimental Verilog ECDSA-P384 point multiplier.
- */
-
 #ifndef HAL_ECDSA_VERILOG_ECDSA384_MULTIPLIER
 #define HAL_ECDSA_VERILOG_ECDSA384_MULTIPLIER 1
 #endif
 
-#if HAL_ECDSA_VERILOG_ECDSA384_MULTIPLIER
-static int verilog_ecdsa384_multiplier = 1;
-#endif
-
-/*
- * Whether to include Verilog point multiplier code at all.
- */
-
-#define HAL_ECDSA_ANY_VERILOG_MULTIPLIER \
-  (HAL_ECDSA_VERILOG_ECDSA256_MULTIPLIER | HAL_ECDSA_VERILOG_ECDSA384_MULTIPLIER)
-
 /*
  * Whether we want debug output.
  */
@@ -790,7 +771,7 @@ static inline hal_error_t get_random(void *buffer, const size_t length)
  * the corresponding public key.
  */
 
-#if HAL_ECDSA_ANY_VERILOG_MULTIPLIER
+#if HAL_ECDSA_VERILOG_ECDSA256_MULTIPLIER || HAL_ECDSA_VERILOG_ECDSA384_MULTIPLIER
 
 typedef struct {
   size_t bytes;
@@ -864,8 +845,7 @@ static inline hal_error_t verilog_p256_point_pick_random(fp_int *k, ec_point_t *
       .y_addr = ECDSA256_ADDR_Y
   };
 
-  if (verilog_ecdsa256_multiplier)
-    return verilog_point_pick_random(&p256_driver, k, P);
+  return verilog_point_pick_random(&p256_driver, k, P);
 
 #endif
 
@@ -884,8 +864,7 @@ static inline hal_error_t verilog_p384_point_pick_random(fp_int *k, ec_point_t *
     .y_addr = ECDSA384_ADDR_Y
   };
 
-  if (verilog_ecdsa384_multiplier)
-    return verilog_point_pick_random(&p384_driver, k, P);
+  return verilog_point_pick_random(&p384_driver, k, P);
 
 #endif
 
@@ -936,7 +915,7 @@ static hal_error_t point_pick_random(const ecdsa_curve_t * const curve,
 
   memset(k_buf, 0, sizeof(k_buf));
 
-#if HAL_ECDSA_ANY_VERILOG_MULTIPLIER
+#if HAL_ECDSA_VERILOG_ECDSA256_MULTIPLIER || HAL_ECDSA_VERILOG_ECDSA384_MULTIPLIER
   switch (curve->curve) {
 
   case HAL_CURVE_P256:



More information about the Commits mailing list