Browse Source

Generated files: fixes

Fixups from updating scripts that generate the files.
Include settings.h for ARM32 assembly.
ARM32 SHA-512 ASM has only one function, Transform_Sha512_Len(). The
implementation is dependent on defines.
Sean Parkinson 2 years ago
parent
commit
a242424abe

+ 1 - 1
wolfcrypt/src/fe_448.c

@@ -1,6 +1,6 @@
 /* fe_448.c
  *
- * Copyright (C) 2006-2021 wolfSSL Inc.
+ * Copyright (C) 2006-2022 wolfSSL Inc.
  *
  * This file is part of wolfSSL.
  *

+ 12 - 7
wolfcrypt/src/fe_x25519_128.i

@@ -1,6 +1,6 @@
 /* fe_x25519_128.i
  *
- * Copyright (C) 2006-2021 wolfSSL Inc.
+ * Copyright (C) 2006-2022 wolfSSL Inc.
  *
  * This file is part of wolfSSL.
  *
@@ -19,6 +19,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  */
 
+/* Generated using (from wolfssl):
+ *   cd ../scripts
+ *   ruby ./x25519/fe_x25519_128_gen.rb > ../wolfssl/wolfcrypt/src/fe_x25519_128.i
+ */
+
 void fe_init(void)
 {
 }
@@ -189,9 +194,9 @@ void fe_copy(fe r, const fe a)
 
 /* Constant time, conditional swap of field elements a and b.
  *
- * a  A field element.
- * b  A field element.
- * c  If 1 then swap and if 0 then don't swap.
+ * f  A field element.
+ * g  A field element.
+ * b  If 1 then swap and if 0 then don't swap.
  */
 void fe_cswap(fe f, fe g, int b)
 {
@@ -501,9 +506,9 @@ void fe_neg(fe r, const fe a)
 /* Constant time, conditional move of b into a.
  * a is not changed if the condition is 0.
  *
- * a  A field element.
- * b  A field element.
- * c  If 1 then copy and if 0 then don't copy.
+ * f  A field element.
+ * g  A field element.
+ * b  If 1 then copy and if 0 then don't copy.
  */
 void fe_cmov(fe f, const fe g, int b)
 {

+ 1 - 1
wolfcrypt/src/ge_448.c

@@ -1,6 +1,6 @@
 /* ge_448.c
  *
- * Copyright (C) 2006-2021 wolfSSL Inc.
+ * Copyright (C) 2006-2022 wolfSSL Inc.
  *
  * This file is part of wolfSSL.
  *

+ 9 - 2
wolfcrypt/src/port/arm/armv8-32-curve25519.S

@@ -23,8 +23,13 @@
  *   cd ../scripts
  *   ruby ./x25519/x25519.rb arm32 ../wolfssl/wolfcrypt/src/port/arm/armv8-32-curve25519.S
  */
-#if defined(WOLFSSL_ARMASM) && defined(HAVE_CURVE25519)
+
+#include <wolfssl/wolfcrypt/settings.h>
+
+#ifdef WOLFSSL_ARMASM
 #ifndef __aarch64__
+#ifdef HAVE_CURVE25519
+
 	.text
 	.align	2
 	.globl	fe_init
@@ -6007,8 +6012,10 @@ fe_ge_sub:
 	add	sp, sp, #0x60
 	pop	{r4, r5, r6, r7, r8, r9, r10, r11, pc}
 	.size	fe_ge_sub,.-fe_ge_sub
+
+#endif /* HAVE_CURVE25519 */
 #endif /* !__aarch64__ */
-#endif /* WOLFSSL_ARMASM && HAVE_CURVE25519 */
+#endif /* WOLFSSL_ARMASM */
 
 #if defined(__linux__) && defined(__ELF__)
 .section	.note.GNU-stack,"",%progbits

+ 9 - 2
wolfcrypt/src/port/arm/armv8-32-curve25519.c

@@ -23,7 +23,10 @@
  *   cd ../scripts
  *   ruby ./x25519/x25519.rb arm32 ../wolfssl/wolfcrypt/src/port/arm/armv8-32-curve25519.c
  */
-#if defined(WOLFSSL_ARMASM) && defined(HAVE_CURVE25519)
+
+#include <wolfssl/wolfcrypt/settings.h>
+
+#ifdef WOLFSSL_ARMASM
 #ifndef __aarch64__
 #include <stdint.h>
 #ifdef HAVE_CONFIG_H
@@ -32,6 +35,8 @@
 #include <wolfssl/wolfcrypt/settings.h>
 #include <wolfssl/wolfcrypt/fe_operations.h>
 
+#ifdef HAVE_CURVE25519
+
 void fe_init()
 {
     __asm__ __volatile__ (
@@ -5572,5 +5577,7 @@ void fe_ge_sub(fe rx, fe ry, fe rz, fe rt, const fe px, const fe py, const fe pz
     (void)qyminusx;
 }
 
+
+#endif /* HAVE_CURVE25519 */
 #endif /* !__aarch64__ */
-#endif /* WOLFSSL_ARMASM && HAVE_CURVE25519 */
+#endif /* WOLFSSL_ARMASM */

+ 7 - 2
wolfcrypt/src/port/arm/armv8-32-sha512-asm.S

@@ -23,8 +23,12 @@
  *   cd ../scripts
  *   ruby ./sha2/sha512.rb arm32 ../wolfssl/wolfcrypt/src/port/arm/armv8-32-sha512-asm.S
  */
-#if defined(WOLFSSL_ARMASM) && defined(WOLFSSL_SHA512)
+
+#include <wolfssl/wolfcrypt/settings.h>
+
+#ifdef WOLFSSL_ARMASM
 #ifndef __aarch64__
+#ifdef WOLFSSL_SHA512
 #ifdef WOLFSSL_ARMASM_NO_NEON
 	.text
 	.type	L_SHA512_transform_len_k, %object
@@ -5330,8 +5334,9 @@ L_sha512_len_neon_start:
 	bx	lr
 	.size	Transform_Sha512_Len,.-Transform_Sha512_Len
 #endif /* !WOLFSSL_ARMASM_NO_NEON */
+#endif /* WOLFSSL_SHA512 */
 #endif /* !__aarch64__ */
-#endif /* WOLFSSL_ARMASM && WOLFSSL_SHA512 */
+#endif /* WOLFSSL_ARMASM */
 
 #if defined(__linux__) && defined(__ELF__)
 .section	.note.GNU-stack,"",%progbits

+ 7 - 2
wolfcrypt/src/port/arm/armv8-32-sha512-asm.c

@@ -23,13 +23,17 @@
  *   cd ../scripts
  *   ruby ./sha2/sha512.rb arm32 ../wolfssl/wolfcrypt/src/port/arm/armv8-32-sha512-asm.c
  */
-#if defined(WOLFSSL_ARMASM) && defined(WOLFSSL_SHA512)
+
+#include <wolfssl/wolfcrypt/settings.h>
+
+#ifdef WOLFSSL_ARMASM
 #ifndef __aarch64__
 #include <stdint.h>
 #ifdef HAVE_CONFIG_H
     #include <config.h>
 #endif /* HAVE_CONFIG_H */
 #include <wolfssl/wolfcrypt/settings.h>
+#ifdef WOLFSSL_SHA512
 #include <wolfssl/wolfcrypt/sha512.h>
 
 #ifdef WOLFSSL_ARMASM_NO_NEON
@@ -4775,5 +4779,6 @@ void Transform_Sha512_Len(wc_Sha512* sha512, const byte* data, word32 len)
 }
 
 #endif /* !WOLFSSL_ARMASM_NO_NEON */
+#endif /* WOLFSSL_SHA512 */
 #endif /* !__aarch64__ */
-#endif /* WOLFSSL_ARMASM && WOLFSSL_SHA512 */
+#endif /* WOLFSSL_ARMASM */

+ 5 - 0
wolfcrypt/src/port/arm/armv8-sha512.c

@@ -147,6 +147,7 @@ static int InitSha512_256(wc_Sha512* sha512)
 #ifdef WOLFSSL_SHA512
 
 #ifdef WOLFSSL_ARMASM
+#ifdef __aarch64__
 #ifndef WOLFSSL_ARMASM_CRYPTO_SHA512
     extern void Transform_Sha512_Len_neon(wc_Sha512* sha512, const byte* data,
         word32 len);
@@ -156,6 +157,10 @@ static int InitSha512_256(wc_Sha512* sha512)
         word32 len);
     #define Transform_Sha512_Len    Transform_Sha512_Len_crypto
 #endif
+#else
+extern void Transform_Sha512_Len(wc_Sha512* sha512, const byte* data,
+    word32 len);
+#endif
 #endif
 
 static int InitSha512_Family(wc_Sha512* sha512, void* heap, int devId,