Kaynağa Gözat

Merge pull request #5852 from SparkiDev/sp_c_perf_2

SP C, SP int: improve performance
David Garske 1 yıl önce
ebeveyn
işleme
d3441545ef
3 değiştirilmiş dosya ile 1077 ekleme ve 1025 silme
  1. 509 497
      wolfcrypt/src/sp_c32.c
  2. 544 524
      wolfcrypt/src/sp_c64.c
  3. 24 4
      wolfcrypt/src/sp_int.c

Dosya farkı çok büyük olduğundan ihmal edildi
+ 509 - 497
wolfcrypt/src/sp_c32.c


Dosya farkı çok büyük olduğundan ihmal edildi
+ 544 - 524
wolfcrypt/src/sp_c64.c


+ 24 - 4
wolfcrypt/src/sp_int.c

@@ -9219,7 +9219,9 @@ static int _sp_mul_12(const sp_int* a, const sp_int* b, sp_int* r)
 #endif /* SP_WORD_SIZE == 32 */
 #endif /* !WOLFSSL_HAVE_SP_ECC && HAVE_ECC */
 
-#if defined(SQR_MUL_ASM) && defined(WOLFSSL_SP_INT_LARGE_COMBA)
+#if defined(SQR_MUL_ASM) && (defined(WOLFSSL_SP_INT_LARGE_COMBA) || \
+    (!defined(WOLFSSL_SP_MATH) && defined(WOLFCRYPT_HAVE_SAKKE) && \
+    (SP_WORD_SIZE == 64)))
     #if SP_INT_DIGITS >= 32
 /* Multiply a by b and store in r: r = a * b
  *
@@ -9640,7 +9642,10 @@ static int _sp_mul_16(const sp_int* a, const sp_int* b, sp_int* r)
     return err;
 }
     #endif /* SP_INT_DIGITS >= 32 */
+#endif /* SQR_MUL_ASM && (WOLFSSL_SP_INT_LARGE_COMBA || !WOLFSSL_SP_MATH &&
+        * WOLFCRYPT_HAVE_SAKKE && SP_WORD_SIZE == 64 */
 
+#if defined(SQR_MUL_ASM) && defined(WOLFSSL_SP_INT_LARGE_COMBA)
     #if SP_INT_DIGITS >= 48
 /* Multiply a by b and store in r: r = a * b
  *
@@ -11189,13 +11194,18 @@ int sp_mul(const sp_int* a, const sp_int* b, sp_int* r)
 #endif /* SQR_MUL_ASM */
 #endif /* SP_WORD_SIZE == 32 */
 #endif /* !WOLFSSL_HAVE_SP_ECC && HAVE_ECC */
-#if defined(SQR_MUL_ASM) && defined(WOLFSSL_SP_INT_LARGE_COMBA)
+#if defined(SQR_MUL_ASM) && (defined(WOLFSSL_SP_INT_LARGE_COMBA) || \
+    (!defined(WOLFSSL_SP_MATH) && defined(WOLFCRYPT_HAVE_SAKKE) && \
+    (SP_WORD_SIZE == 64)))
     #if SP_INT_DIGITS >= 32
         if ((a->used == 16) && (b->used == 16)) {
             err = _sp_mul_16(a, b, r);
         }
         else
     #endif /* SP_INT_DIGITS >= 32 */
+#endif /* SQR_MUL_ASM && (WOLFSSL_SP_INT_LARGE_COMBA || !WOLFSSL_SP_MATH &&
+        * WOLFCRYPT_HAVE_SAKKE && SP_WORD_SIZE == 64 */
+#if defined(SQR_MUL_ASM) && defined(WOLFSSL_SP_INT_LARGE_COMBA)
     #if SP_INT_DIGITS >= 48
         if ((a->used == 24) && (b->used == 24)) {
             err = _sp_mul_24(a, b, r);
@@ -14401,7 +14411,9 @@ static int _sp_sqr_12(const sp_int* a, sp_int* r)
 #endif /* SP_WORD_SIZE == 32 */
 #endif /* !WOLFSSL_HAVE_SP_ECC && HAVE_ECC */
 
-#if defined(SQR_MUL_ASM) && defined(WOLFSSL_SP_INT_LARGE_COMBA)
+#if defined(SQR_MUL_ASM) && (defined(WOLFSSL_SP_INT_LARGE_COMBA) || \
+    (!defined(WOLFSSL_SP_MATH) && defined(WOLFCRYPT_HAVE_SAKKE) && \
+    (SP_WORD_SIZE == 64)))
     #if SP_INT_DIGITS >= 32
 /* Square a and store in r. r = a * a
  *
@@ -14729,7 +14741,10 @@ static int _sp_sqr_16(const sp_int* a, sp_int* r)
     return err;
 }
     #endif /* SP_INT_DIGITS >= 32 */
+#endif /* SQR_MUL_ASM && (WOLFSSL_SP_INT_LARGE_COMBA || !WOLFSSL_SP_MATH &&
+        * WOLFCRYPT_HAVE_SAKKE && SP_WORD_SIZE == 64 */
 
+#if defined(SQR_MUL_ASM) && defined(WOLFSSL_SP_INT_LARGE_COMBA)
     #if SP_INT_DIGITS >= 48
 /* Square a and store in r. r = a * a
  *
@@ -15930,13 +15945,18 @@ int sp_sqr(const sp_int* a, sp_int* r)
 #endif /* SQR_MUL_ASM */
 #endif /* SP_WORD_SIZE == 32 */
 #endif /* !WOLFSSL_HAVE_SP_ECC && HAVE_ECC */
-#if defined(SQR_MUL_ASM) && defined(WOLFSSL_SP_INT_LARGE_COMBA)
+#if defined(SQR_MUL_ASM) && (defined(WOLFSSL_SP_INT_LARGE_COMBA) || \
+    (!defined(WOLFSSL_SP_MATH) && defined(WOLFCRYPT_HAVE_SAKKE) && \
+    (SP_WORD_SIZE == 64)))
     #if SP_INT_DIGITS >= 32
         if (a->used == 16) {
             err = _sp_sqr_16(a, r);
         }
         else
     #endif /* SP_INT_DIGITS >= 32 */
+#endif /* SQR_MUL_ASM && (WOLFSSL_SP_INT_LARGE_COMBA || !WOLFSSL_SP_MATH &&
+        * WOLFCRYPT_HAVE_SAKKE && SP_WORD_SIZE == 64 */
+#if defined(SQR_MUL_ASM) && defined(WOLFSSL_SP_INT_LARGE_COMBA)
     #if SP_INT_DIGITS >= 48
         if (a->used == 24) {
             err = _sp_sqr_24(a, r);

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor