diff --git a/IDE/XCODE/Benchmark/wolfBench.xcodeproj/project.pbxproj b/IDE/XCODE/Benchmark/wolfBench.xcodeproj/project.pbxproj index 61a9b2de8..46767b6a3 100644 --- a/IDE/XCODE/Benchmark/wolfBench.xcodeproj/project.pbxproj +++ b/IDE/XCODE/Benchmark/wolfBench.xcodeproj/project.pbxproj @@ -10,7 +10,6 @@ 52114C8721B5A7320022ADA1 /* sp_c64.c in Sources */ = {isa = PBXBuildFile; fileRef = 52114C8621B5A7320022ADA1 /* sp_c64.c */; }; A46FE16F2493E8F800A25BE7 /* armv8-chacha.c in Sources */ = {isa = PBXBuildFile; fileRef = A46FE14C2493E8F500A25BE7 /* armv8-chacha.c */; }; A46FE1702493E8F800A25BE7 /* sp_int.c in Sources */ = {isa = PBXBuildFile; fileRef = A46FE14D2493E8F600A25BE7 /* sp_int.c */; }; - A46FE1732493E8F800A25BE7 /* armv8-poly1305.c in Sources */ = {isa = PBXBuildFile; fileRef = A46FE1502493E8F600A25BE7 /* armv8-poly1305.c */; }; A46FE1742493E8F800A25BE7 /* sp_cortexm.c in Sources */ = {isa = PBXBuildFile; fileRef = A46FE1512493E8F600A25BE7 /* sp_cortexm.c */; }; A46FE1752493E8F800A25BE7 /* blake2s.c in Sources */ = {isa = PBXBuildFile; fileRef = A46FE1522493E8F600A25BE7 /* blake2s.c */; }; A46FE1772493E8F800A25BE7 /* wc_pkcs11.c in Sources */ = {isa = PBXBuildFile; fileRef = A46FE1542493E8F600A25BE7 /* wc_pkcs11.c */; }; @@ -95,20 +94,20 @@ A4ADF9281FCE0C5600A06E90 /* ecc.c in Sources */ = {isa = PBXBuildFile; fileRef = A4ADF8CC1FCE0C5500A06E90 /* ecc.c */; }; A4ADF92A1FCE0C5600A06E90 /* coding.c in Sources */ = {isa = PBXBuildFile; fileRef = A4ADF8CE1FCE0C5500A06E90 /* coding.c */; }; A4ADF92C1FCE0C5600A06E90 /* ge_low_mem.c in Sources */ = {isa = PBXBuildFile; fileRef = A4ADF8D01FCE0C5500A06E90 /* ge_low_mem.c */; }; - A4CA2EA124C8AF97003CCC50 /* armv8-curve25519.c in Sources */ = {isa = PBXBuildFile; fileRef = A4CA2E9C24C8AF97003CCC50 /* armv8-curve25519.c */; }; A4CA2EA324C8AF97003CCC50 /* armv8-sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = A4CA2E9E24C8AF97003CCC50 /* armv8-sha512.c */; }; - A4CA2EA524C8B273003CCC50 /* armv8-sha512-asm.c in Sources */ = {isa = PBXBuildFile; fileRef = A4CA2EA424C8B273003CCC50 /* armv8-sha512-asm.c */; }; A4DFEC0D1FD4CAA300A7BB33 /* benchmark.c in Sources */ = {isa = PBXBuildFile; fileRef = A4DFEC0C1FD4CAA300A7BB33 /* benchmark.c */; }; A4DFEC101FD4CB8500A7BB33 /* armv8-sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = A4DFEC0E1FD4CB8500A7BB33 /* armv8-sha256.c */; }; A4DFEC111FD4CB8500A7BB33 /* armv8-aes.c in Sources */ = {isa = PBXBuildFile; fileRef = A4DFEC0F1FD4CB8500A7BB33 /* armv8-aes.c */; }; A4DFEC3C1FD6B9CC00A7BB33 /* test.c in Sources */ = {isa = PBXBuildFile; fileRef = A4DFEC3B1FD6B9CC00A7BB33 /* test.c */; }; + CB81DE1D24C9284700B98DA6 /* armv8-poly1305.c in Sources */ = {isa = PBXBuildFile; fileRef = CB81DE1C24C9284700B98DA6 /* armv8-poly1305.c */; }; + CB81DE1F24C93EC000B98DA6 /* armv8-curve25519.S in Sources */ = {isa = PBXBuildFile; fileRef = CB81DE1E24C93EC000B98DA6 /* armv8-curve25519.S */; }; + CB81DE2324C93FB300B98DA6 /* armv8-sha512-asm.S in Sources */ = {isa = PBXBuildFile; fileRef = CB81DE2224C93FB300B98DA6 /* armv8-sha512-asm.S */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 52114C8621B5A7320022ADA1 /* sp_c64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sp_c64.c; path = ../../../wolfcrypt/src/sp_c64.c; sourceTree = ""; }; A46FE14C2493E8F500A25BE7 /* armv8-chacha.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "armv8-chacha.c"; path = "../../../wolfcrypt/src/port/arm/armv8-chacha.c"; sourceTree = ""; }; A46FE14D2493E8F600A25BE7 /* sp_int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sp_int.c; path = ../../../wolfcrypt/src/sp_int.c; sourceTree = ""; }; - A46FE1502493E8F600A25BE7 /* armv8-poly1305.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "armv8-poly1305.c"; path = "../../../wolfcrypt/src/port/arm/armv8-poly1305.c"; sourceTree = ""; }; A46FE1512493E8F600A25BE7 /* sp_cortexm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sp_cortexm.c; path = ../../../wolfcrypt/src/sp_cortexm.c; sourceTree = ""; }; A46FE1522493E8F600A25BE7 /* blake2s.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = blake2s.c; path = ../../../wolfcrypt/src/blake2s.c; sourceTree = ""; }; A46FE1542493E8F600A25BE7 /* wc_pkcs11.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wc_pkcs11.c; path = ../../../wolfcrypt/src/wc_pkcs11.c; sourceTree = ""; }; @@ -198,13 +197,14 @@ A4ADF8CC1FCE0C5500A06E90 /* ecc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ecc.c; path = ../../../wolfcrypt/src/ecc.c; sourceTree = ""; }; A4ADF8CE1FCE0C5500A06E90 /* coding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = coding.c; path = ../../../wolfcrypt/src/coding.c; sourceTree = ""; }; A4ADF8D01FCE0C5500A06E90 /* ge_low_mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ge_low_mem.c; path = ../../../wolfcrypt/src/ge_low_mem.c; sourceTree = ""; }; - A4CA2E9C24C8AF97003CCC50 /* armv8-curve25519.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "armv8-curve25519.c"; path = "../../../wolfcrypt/src/port/arm/armv8-curve25519.c"; sourceTree = ""; }; A4CA2E9E24C8AF97003CCC50 /* armv8-sha512.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "armv8-sha512.c"; path = "../../../wolfcrypt/src/port/arm/armv8-sha512.c"; sourceTree = ""; }; - A4CA2EA424C8B273003CCC50 /* armv8-sha512-asm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "armv8-sha512-asm.c"; path = "../../../wolfcrypt/src/port/arm/armv8-sha512-asm.c"; sourceTree = ""; }; A4DFEC0C1FD4CAA300A7BB33 /* benchmark.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = benchmark.c; path = ../../../wolfcrypt/benchmark/benchmark.c; sourceTree = ""; }; A4DFEC0E1FD4CB8500A7BB33 /* armv8-sha256.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "armv8-sha256.c"; path = "../../../wolfcrypt/src/port/arm/armv8-sha256.c"; sourceTree = ""; }; A4DFEC0F1FD4CB8500A7BB33 /* armv8-aes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "armv8-aes.c"; path = "../../../wolfcrypt/src/port/arm/armv8-aes.c"; sourceTree = ""; }; A4DFEC3B1FD6B9CC00A7BB33 /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = test.c; path = ../../../wolfcrypt/test/test.c; sourceTree = ""; }; + CB81DE1C24C9284700B98DA6 /* armv8-poly1305.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "armv8-poly1305.c"; path = "../../../wolfcrypt/src/port/arm/armv8-poly1305.c"; sourceTree = ""; }; + CB81DE1E24C93EC000B98DA6 /* armv8-curve25519.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = "armv8-curve25519.S"; path = "../../../wolfcrypt/src/port/arm/armv8-curve25519.S"; sourceTree = ""; }; + CB81DE2224C93FB300B98DA6 /* armv8-sha512-asm.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = "armv8-sha512-asm.S"; path = "../../../wolfcrypt/src/port/arm/armv8-sha512-asm.S"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -279,11 +279,11 @@ A4ADF8921FCE0C4E00A06E90 /* arc4.c */, A4DFEC0F1FD4CB8500A7BB33 /* armv8-aes.c */, A46FE14C2493E8F500A25BE7 /* armv8-chacha.c */, - A4CA2E9C24C8AF97003CCC50 /* armv8-curve25519.c */, - A46FE1502493E8F600A25BE7 /* armv8-poly1305.c */, + CB81DE1E24C93EC000B98DA6 /* armv8-curve25519.S */, + CB81DE1C24C9284700B98DA6 /* armv8-poly1305.c */, A4DFEC0E1FD4CB8500A7BB33 /* armv8-sha256.c */, - A4CA2EA424C8B273003CCC50 /* armv8-sha512-asm.c */, A4CA2E9E24C8AF97003CCC50 /* armv8-sha512.c */, + CB81DE2224C93FB300B98DA6 /* armv8-sha512-asm.S */, A4ADF8A01FCE0C4F00A06E90 /* asm.c */, A4ADF8C21FCE0C5300A06E90 /* asn.c */, A4ADF8B11FCE0C5100A06E90 /* blake2b.c */, @@ -443,6 +443,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CB81DE2324C93FB300B98DA6 /* armv8-sha512-asm.S in Sources */, A4ADF9041FCE0C5600A06E90 /* des3.c in Sources */, A46FE18A2493E8F800A25BE7 /* ge_448.c in Sources */, A4ADF9121FCE0C5600A06E90 /* wc_port.c in Sources */, @@ -464,10 +465,11 @@ A4ADF8DB1FCE0C5600A06E90 /* hc128.c in Sources */, A4ADF8E31FCE0C5600A06E90 /* compress.c in Sources */, A4ADF8731FCE0C1C00A06E90 /* tls13.c in Sources */, - A4CA2EA124C8AF97003CCC50 /* armv8-curve25519.c in Sources */, A4ADF90D1FCE0C5600A06E90 /* blake2b.c in Sources */, A4ADF9071FCE0C5600A06E90 /* dh.c in Sources */, A46FE1912493E8F800A25BE7 /* sp_c32.c in Sources */, + CB81DE1D24C9284700B98DA6 /* armv8-poly1305.c in Sources */, + CB81DE1F24C93EC000B98DA6 /* armv8-curve25519.S in Sources */, A4ADF8F31FCE0C5600A06E90 /* rsa.c in Sources */, A46FE1752493E8F800A25BE7 /* blake2s.c in Sources */, A4ADF8FA1FCE0C5600A06E90 /* pkcs12.c in Sources */, @@ -483,7 +485,6 @@ A4ADF8D51FCE0C5600A06E90 /* md5.c in Sources */, A46FE1892493E8F800A25BE7 /* sp_dsp32.c in Sources */, A4ADF8DF1FCE0C5600A06E90 /* sha256.c in Sources */, - A4CA2EA524C8B273003CCC50 /* armv8-sha512-asm.c in Sources */, A4ADF8711FCE0C1C00A06E90 /* sniffer.c in Sources */, A46FE1882493E8F800A25BE7 /* sp_arm32.c in Sources */, A4ADF8701FCE0C1C00A06E90 /* tls.c in Sources */, @@ -509,7 +510,6 @@ A4ADF9051FCE0C5600A06E90 /* cmac.c in Sources */, 52114C8721B5A7320022ADA1 /* sp_c64.c in Sources */, A4ADF8F41FCE0C5600A06E90 /* pkcs7.c in Sources */, - A46FE1732493E8F800A25BE7 /* armv8-poly1305.c in Sources */, A4ADF90B1FCE0C5600A06E90 /* logging.c in Sources */, A4ADF8E01FCE0C5600A06E90 /* ecc_fp.c in Sources */, A4ADF8EB1FCE0C5600A06E90 /* chacha20_poly1305.c in Sources */, @@ -683,10 +683,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 2S2PAGNS5B; + DEVELOPMENT_TEAM = TJKX238PPD; INFOPLIST_FILE = wolfBench/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.wolfSSL.wolfBench; + PRODUCT_BUNDLE_IDENTIFIER = "com.wolfSSL.wolfBench-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -697,10 +697,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 2S2PAGNS5B; + DEVELOPMENT_TEAM = TJKX238PPD; INFOPLIST_FILE = wolfBench/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.wolfSSL.wolfBench; + PRODUCT_BUNDLE_IDENTIFIER = "com.wolfSSL.wolfBench-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/IDE/XCODE/user_settings.h b/IDE/XCODE/user_settings.h index 62da56ba3..53d8ebe11 100644 --- a/IDE/XCODE/user_settings.h +++ b/IDE/XCODE/user_settings.h @@ -56,7 +56,9 @@ #define HAVE_CHACHA #define HAVE_CURVE25519 - #define HAVE_ED25519 + #ifndef WOLFSSL_ARMASM + #define HAVE_ED25519 + #endif /* TLS extensions */ #define HAVE_ONE_TIME_AUTH diff --git a/wolfcrypt/src/port/arm/armv8-chacha.c b/wolfcrypt/src/port/arm/armv8-chacha.c index df76bece0..93387cd81 100644 --- a/wolfcrypt/src/port/arm/armv8-chacha.c +++ b/wolfcrypt/src/port/arm/armv8-chacha.c @@ -2186,17 +2186,15 @@ static WC_INLINE void wc_Chacha_encrypt_64(const word32* input, const byte* m, "BEQ L_chacha20_arm64_64_done_%= \n\t" "\n" "L_chacha20_arm64_64_lt_8_%=: \n\t" - "MOV x4, v0.D[0] \n\t" - "LSL x5, %[bytes], #3 \n\t" + "MOV x4, v0.D[0] \n\t" "\n" "L_chacha20_arm64_64_loop_lt_8_%=: \n\t" - "LDRB w6, [%[m], %[bytes]] \n\t" - "ROR x7, x4, x5 \n\t" - "EOR w6, w6, w7 \n\t" - "STRB w6, [%[c], %[bytes]] \n\t" - "SUBS %[bytes], %[bytes], #1 \n\t" - "SUB x5, x5, #8 \n\t" - "BGE L_chacha20_arm64_64_loop_lt_8_%= \n\t" + "LDRB w6, [%[m]], #1 \n\t" + "EOR w6, w6, w4 \n\t" + "STRB w6, [%[c]], #1 \n\t" + "SUBS %[bytes], %[bytes], #1 \n\t" + "LSR x4, x4, #8 \n\t" + "BGT L_chacha20_arm64_64_loop_lt_8_%= \n\t" "\n" "L_chacha20_arm64_64_done_%=: \n\t" : [input] "+r" (input), [m] "+r" (m), [c] "+r" (c), [bytes] "+r" (bytes64) diff --git a/wolfcrypt/src/port/arm/armv8-curve25519.S b/wolfcrypt/src/port/arm/armv8-curve25519.S index 36be60de5..e8da5267f 100644 --- a/wolfcrypt/src/port/arm/armv8-curve25519.S +++ b/wolfcrypt/src/port/arm/armv8-curve25519.S @@ -19,36 +19,66 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif /* HAVE_CONFIG_H */ +#include + /* Generated using (from wolfssl): * cd ../scripts * ruby ./x25519/x25519.rb arm64 ../wolfssl/wolfcrypt/src/port/arm/armv8-curve25519.S */ #ifdef WOLFSSL_ARMASM #ifdef __aarch64__ - .text - .align 2 - .globl fe_init - .type fe_init, %function +#ifndef __APPLE__ +.text +.globl fe_init +.type fe_init,@function +.align 2 fe_init: +#else +.section __TEXT,__text +.globl _fe_init +.p2align 2 +_fe_init: +#endif /* __APPLE__ */ ret +#ifndef __APPLE__ .size fe_init,.-fe_init - .text - .align 2 - .globl fe_frombytes - .type fe_frombytes, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_frombytes +.type fe_frombytes,@function +.align 2 fe_frombytes: +#else +.section __TEXT,__text +.globl _fe_frombytes +.p2align 2 +_fe_frombytes: +#endif /* __APPLE__ */ ldp x2, x3, [x1] ldp x4, x5, [x1, #16] and x5, x5, #0x7fffffffffffffff stp x2, x3, [x0] stp x4, x5, [x0, #16] ret +#ifndef __APPLE__ .size fe_frombytes,.-fe_frombytes - .text - .align 2 - .globl fe_tobytes - .type fe_tobytes, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_tobytes +.type fe_tobytes,@function +.align 2 fe_tobytes: +#else +.section __TEXT,__text +.globl _fe_tobytes +.p2align 2 +_fe_tobytes: +#endif /* __APPLE__ */ mov x7, #19 ldp x2, x3, [x1] ldp x4, x5, [x1, #16] @@ -65,45 +95,81 @@ fe_tobytes: stp x2, x3, [x0] stp x4, x5, [x0, #16] ret +#ifndef __APPLE__ .size fe_tobytes,.-fe_tobytes - .text - .align 2 - .globl fe_1 - .type fe_1, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_1 +.type fe_1,@function +.align 2 fe_1: +#else +.section __TEXT,__text +.globl _fe_1 +.p2align 2 +_fe_1: +#endif /* __APPLE__ */ # Set one mov x1, #1 stp x1, xzr, [x0] stp xzr, xzr, [x0, #16] ret +#ifndef __APPLE__ .size fe_1,.-fe_1 - .text - .align 2 - .globl fe_0 - .type fe_0, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_0 +.type fe_0,@function +.align 2 fe_0: +#else +.section __TEXT,__text +.globl _fe_0 +.p2align 2 +_fe_0: +#endif /* __APPLE__ */ # Set zero stp xzr, xzr, [x0] stp xzr, xzr, [x0, #16] ret +#ifndef __APPLE__ .size fe_0,.-fe_0 - .text - .align 2 - .globl fe_copy - .type fe_copy, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_copy +.type fe_copy,@function +.align 2 fe_copy: +#else +.section __TEXT,__text +.globl _fe_copy +.p2align 2 +_fe_copy: +#endif /* __APPLE__ */ # Copy ldp x2, x3, [x1] ldp x4, x5, [x1, #16] stp x2, x3, [x0] stp x4, x5, [x0, #16] ret +#ifndef __APPLE__ .size fe_copy,.-fe_copy - .text - .align 2 - .globl fe_sub - .type fe_sub, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_sub +.type fe_sub,@function +.align 2 fe_sub: +#else +.section __TEXT,__text +.globl _fe_sub +.p2align 2 +_fe_sub: +#endif /* __APPLE__ */ # Sub ldp x3, x4, [x1] ldp x5, x6, [x1, #16] @@ -126,12 +192,21 @@ fe_sub: stp x3, x4, [x0] stp x5, x6, [x0, #16] ret +#ifndef __APPLE__ .size fe_sub,.-fe_sub - .text - .align 2 - .globl fe_add - .type fe_add, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_add +.type fe_add,@function +.align 2 fe_add: +#else +.section __TEXT,__text +.globl _fe_add +.p2align 2 +_fe_add: +#endif /* __APPLE__ */ # Add ldp x3, x4, [x1] ldp x5, x6, [x1, #16] @@ -154,12 +229,21 @@ fe_add: stp x3, x4, [x0] stp x5, x6, [x0, #16] ret +#ifndef __APPLE__ .size fe_add,.-fe_add - .text - .align 2 - .globl fe_neg - .type fe_neg, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_neg +.type fe_neg,@function +.align 2 fe_neg: +#else +.section __TEXT,__text +.globl _fe_neg +.p2align 2 +_fe_neg: +#endif /* __APPLE__ */ ldp x2, x3, [x1] ldp x4, x5, [x1, #16] mov x6, #-19 @@ -173,12 +257,21 @@ fe_neg: stp x6, x7, [x0] stp x8, x9, [x0, #16] ret +#ifndef __APPLE__ .size fe_neg,.-fe_neg - .text - .align 2 - .globl fe_isnonzero - .type fe_isnonzero, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_isnonzero +.type fe_isnonzero,@function +.align 2 fe_isnonzero: +#else +.section __TEXT,__text +.globl _fe_isnonzero +.p2align 2 +_fe_isnonzero: +#endif /* __APPLE__ */ mov x6, #19 ldp x1, x2, [x0] ldp x3, x4, [x0, #16] @@ -196,12 +289,21 @@ fe_isnonzero: orr x3, x3, x4 orr x0, x0, x3 ret +#ifndef __APPLE__ .size fe_isnonzero,.-fe_isnonzero - .text - .align 2 - .globl fe_isnegative - .type fe_isnegative, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_isnegative +.type fe_isnegative,@function +.align 2 fe_isnegative: +#else +.section __TEXT,__text +.globl _fe_isnegative +.p2align 2 +_fe_isnegative: +#endif /* __APPLE__ */ mov x6, #19 ldp x1, x2, [x0] ldp x3, x4, [x0, #16] @@ -212,12 +314,21 @@ fe_isnegative: and x0, x1, #1 eor x0, x0, x5, lsr 63 ret +#ifndef __APPLE__ .size fe_isnegative,.-fe_isnegative - .text - .align 2 - .globl fe_cmov_table - .type fe_cmov_table, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_cmov_table +.type fe_cmov_table,@function +.align 2 fe_cmov_table: +#else +.section __TEXT,__text +.globl _fe_cmov_table +.p2align 2 +_fe_cmov_table: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-128]! add x29, sp, #0 str x17, [x29, #40] @@ -438,12 +549,21 @@ fe_cmov_table: ldr x28, [x29, #120] ldp x29, x30, [sp], #0x80 ret +#ifndef __APPLE__ .size fe_cmov_table,.-fe_cmov_table - .text - .align 2 - .globl fe_mul - .type fe_mul, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_mul +.type fe_mul,@function +.align 2 fe_mul: +#else +.section __TEXT,__text +.globl _fe_mul +.p2align 2 +_fe_mul: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-64]! add x29, sp, #0 str x17, [x29, #24] @@ -596,12 +716,21 @@ fe_mul: ldr x22, [x29, #56] ldp x29, x30, [sp], #0x40 ret +#ifndef __APPLE__ .size fe_mul,.-fe_mul - .text - .align 2 - .globl fe_sq - .type fe_sq, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_sq +.type fe_sq,@function +.align 2 fe_sq: +#else +.section __TEXT,__text +.globl _fe_sq +.p2align 2 +_fe_sq: +#endif /* __APPLE__ */ # Square ldp x13, x14, [x1] ldp x15, x16, [x1, #16] @@ -709,12 +838,21 @@ fe_sq: stp x5, x6, [x0] stp x7, x8, [x0, #16] ret +#ifndef __APPLE__ .size fe_sq,.-fe_sq - .text - .align 2 - .globl fe_invert - .type fe_invert, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_invert +.type fe_invert,@function +.align 2 fe_invert: +#else +.section __TEXT,__text +.globl _fe_invert +.p2align 2 +_fe_invert: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-176]! add x29, sp, #0 str x20, [x29, #168] @@ -722,124 +860,245 @@ fe_invert: str x0, [x29, #144] str x1, [x29, #152] add x0, x29, #16 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x0, x29, #48 add x1, x29, #16 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x1, x29, #48 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ ldr x1, [x29, #152] add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #16 add x1, x29, #16 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x50 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x0, x29, #48 add x1, x29, #48 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x50 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x20, #4 add x1, x29, #0x50 L_fe_invert1: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x20, x20, #1 cmp x20, #0 bne L_fe_invert1 add x0, x29, #48 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x50 add x1, x29, #48 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x20, #9 add x1, x29, #0x50 L_fe_invert2: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x20, x20, #1 cmp x20, #0 bne L_fe_invert2 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x70 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x20, #19 add x1, x29, #0x70 L_fe_invert3: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x20, x20, #1 cmp x20, #0 bne L_fe_invert3 add x0, x29, #0x50 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x20, #10 add x1, x29, #0x50 L_fe_invert4: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x20, x20, #1 cmp x20, #0 bne L_fe_invert4 add x0, x29, #48 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x50 add x1, x29, #48 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x20, #49 add x1, x29, #0x50 L_fe_invert5: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x20, x20, #1 cmp x20, #0 bne L_fe_invert5 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x70 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x20, #0x63 add x1, x29, #0x70 L_fe_invert6: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x20, x20, #1 cmp x20, #0 bne L_fe_invert6 add x0, x29, #0x50 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x20, #50 add x1, x29, #0x50 L_fe_invert7: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x20, x20, #1 cmp x20, #0 bne L_fe_invert7 add x0, x29, #48 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x20, #5 add x1, x29, #48 L_fe_invert8: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x20, x20, #1 cmp x20, #0 bne L_fe_invert8 ldr x0, [x29, #144] add x2, x29, #16 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ ldr x20, [x29, #168] ldp x29, x30, [sp], #0xb0 ret +#ifndef __APPLE__ .size fe_invert,.-fe_invert - .text - .align 2 - .globl curve25519 - .type curve25519, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl curve25519 +.type curve25519,@function +.align 2 curve25519: +#else +.section __TEXT,__text +.globl _curve25519 +.p2align 2 +_curve25519: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-288]! add x29, sp, #0 str x17, [x29, #200] @@ -2157,115 +2416,227 @@ L_curve25519_bits: # Invert add x0, x29, #48 add x1, x29, #16 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x0, x29, #0x50 add x1, x29, #48 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x1, x29, #0x50 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x1, x29, #16 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #48 add x1, x29, #48 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x70 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x0, x29, #0x50 add x1, x29, #0x50 add x2, x29, #0x70 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x70 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x24, #4 add x1, x29, #0x70 L_curve25519_inv_1: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x24, x24, #1 cmp x24, #0 bne L_curve25519_inv_1 add x0, x29, #0x50 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x70 add x1, x29, #0x50 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x24, #9 add x1, x29, #0x70 L_curve25519_inv_2: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x24, x24, #1 cmp x24, #0 bne L_curve25519_inv_2 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x90 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x24, #19 add x1, x29, #0x90 L_curve25519_inv_3: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x24, x24, #1 cmp x24, #0 bne L_curve25519_inv_3 add x0, x29, #0x70 add x2, x29, #0x70 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x24, #10 add x1, x29, #0x70 L_curve25519_inv_4: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x24, x24, #1 cmp x24, #0 bne L_curve25519_inv_4 add x0, x29, #0x50 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x70 add x1, x29, #0x50 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x24, #49 add x1, x29, #0x70 L_curve25519_inv_5: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x24, x24, #1 cmp x24, #0 bne L_curve25519_inv_5 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x90 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x24, #0x63 add x1, x29, #0x90 L_curve25519_inv_6: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x24, x24, #1 cmp x24, #0 bne L_curve25519_inv_6 add x0, x29, #0x70 add x2, x29, #0x70 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x24, #50 add x1, x29, #0x70 L_curve25519_inv_7: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x24, x24, #1 cmp x24, #0 bne L_curve25519_inv_7 add x0, x29, #0x50 add x2, x29, #0x50 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x24, #5 add x1, x29, #0x50 L_curve25519_inv_8: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x24, x24, #1 cmp x24, #0 bne L_curve25519_inv_8 add x0, x29, #16 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ ldr x0, [x29, #176] # Multiply ldp x6, x7, [x0] @@ -2417,12 +2788,21 @@ L_curve25519_inv_8: ldr x28, [x29, #280] ldp x29, x30, [sp], #0x120 ret +#ifndef __APPLE__ .size curve25519,.-curve25519 - .text - .align 2 - .globl fe_pow22523 - .type fe_pow22523, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_pow22523 +.type fe_pow22523,@function +.align 2 fe_pow22523: +#else +.section __TEXT,__text +.globl _fe_pow22523 +.p2align 2 +_fe_pow22523: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-144]! add x29, sp, #0 str x21, [x29, #136] @@ -2430,123 +2810,244 @@ fe_pow22523: str x0, [x29, #112] str x1, [x29, #120] add x0, x29, #16 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x0, x29, #48 add x1, x29, #16 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x1, x29, #48 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ ldr x1, [x29, #120] add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #16 add x1, x29, #16 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ add x1, x29, #48 add x2, x29, #16 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #48 add x1, x29, #16 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x21, #4 add x1, x29, #48 L_fe_pow22523_1: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x21, x21, #1 cmp x21, #0 bne L_fe_pow22523_1 add x0, x29, #16 add x2, x29, #16 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #48 add x1, x29, #16 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x21, #9 add x1, x29, #48 L_fe_pow22523_2: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x21, x21, #1 cmp x21, #0 bne L_fe_pow22523_2 add x2, x29, #16 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x50 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x21, #19 add x1, x29, #0x50 L_fe_pow22523_3: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x21, x21, #1 cmp x21, #0 bne L_fe_pow22523_3 add x0, x29, #48 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x21, #10 add x1, x29, #48 L_fe_pow22523_4: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x21, x21, #1 cmp x21, #0 bne L_fe_pow22523_4 add x0, x29, #16 add x2, x29, #16 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #48 add x1, x29, #16 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x21, #49 add x1, x29, #48 L_fe_pow22523_5: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x21, x21, #1 cmp x21, #0 bne L_fe_pow22523_5 add x2, x29, #16 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ add x0, x29, #0x50 +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ mov x21, #0x63 add x1, x29, #0x50 L_fe_pow22523_6: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x21, x21, #1 cmp x21, #0 bne L_fe_pow22523_6 add x0, x29, #48 add x2, x29, #48 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x21, #50 add x1, x29, #48 L_fe_pow22523_7: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x21, x21, #1 cmp x21, #0 bne L_fe_pow22523_7 add x0, x29, #16 add x2, x29, #16 +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ mov x21, #2 add x1, x29, #16 L_fe_pow22523_8: +#ifndef __APPLE__ bl fe_sq +#else + bl _fe_sq +#endif /* __APPLE__ */ sub x21, x21, #1 cmp x21, #0 bne L_fe_pow22523_8 ldr x0, [x29, #112] ldr x2, [x29, #120] +#ifndef __APPLE__ bl fe_mul +#else + bl _fe_mul +#endif /* __APPLE__ */ ldr x21, [x29, #136] ldp x29, x30, [sp], #0x90 ret +#ifndef __APPLE__ .size fe_pow22523,.-fe_pow22523 - .text - .align 2 - .globl fe_ge_to_p2 - .type fe_ge_to_p2, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_ge_to_p2 +.type fe_ge_to_p2,@function +.align 2 fe_ge_to_p2: +#else +.section __TEXT,__text +.globl _fe_ge_to_p2 +.p2align 2 +_fe_ge_to_p2: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-112]! add x29, sp, #0 str x17, [x29, #72] @@ -2990,12 +3491,21 @@ fe_ge_to_p2: ldr x22, [x29, #104] ldp x29, x30, [sp], #0x70 ret +#ifndef __APPLE__ .size fe_ge_to_p2,.-fe_ge_to_p2 - .text - .align 2 - .globl fe_ge_to_p3 - .type fe_ge_to_p3, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_ge_to_p3 +.type fe_ge_to_p3,@function +.align 2 fe_ge_to_p3: +#else +.section __TEXT,__text +.globl _fe_ge_to_p3 +.p2align 2 +_fe_ge_to_p3: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-160]! add x29, sp, #0 str x17, [x29, #88] @@ -3578,12 +4088,21 @@ fe_ge_to_p3: ldr x26, [x29, #152] ldp x29, x30, [sp], #0xa0 ret +#ifndef __APPLE__ .size fe_ge_to_p3,.-fe_ge_to_p3 - .text - .align 2 - .globl fe_ge_dbl - .type fe_ge_dbl, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_ge_dbl +.type fe_ge_dbl,@function +.align 2 fe_ge_dbl: +#else +.section __TEXT,__text +.globl _fe_ge_dbl +.p2align 2 +_fe_ge_dbl: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-176]! add x29, sp, #0 str x17, [x29, #88] @@ -4134,12 +4653,21 @@ fe_ge_dbl: ldr x28, [x29, #168] ldp x29, x30, [sp], #0xb0 ret +#ifndef __APPLE__ .size fe_ge_dbl,.-fe_ge_dbl - .text - .align 2 - .globl fe_ge_madd - .type fe_ge_madd, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_ge_madd +.type fe_ge_madd,@function +.align 2 fe_ge_madd: +#else +.section __TEXT,__text +.globl _fe_ge_madd +.p2align 2 +_fe_ge_madd: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-176]! add x29, sp, #0 str x17, [x29, #88] @@ -4709,12 +5237,21 @@ fe_ge_madd: ldr x28, [x29, #168] ldp x29, x30, [sp], #0xb0 ret +#ifndef __APPLE__ .size fe_ge_madd,.-fe_ge_madd - .text - .align 2 - .globl fe_ge_msub - .type fe_ge_msub, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_ge_msub +.type fe_ge_msub,@function +.align 2 fe_ge_msub: +#else +.section __TEXT,__text +.globl _fe_ge_msub +.p2align 2 +_fe_ge_msub: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-176]! add x29, sp, #0 str x17, [x29, #88] @@ -5284,12 +5821,21 @@ fe_ge_msub: ldr x28, [x29, #168] ldp x29, x30, [sp], #0xb0 ret +#ifndef __APPLE__ .size fe_ge_msub,.-fe_ge_msub - .text - .align 2 - .globl fe_ge_add - .type fe_ge_add, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_ge_add +.type fe_ge_add,@function +.align 2 fe_ge_add: +#else +.section __TEXT,__text +.globl _fe_ge_add +.p2align 2 +_fe_ge_add: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-176]! add x29, sp, #0 str x17, [x29, #88] @@ -5998,12 +6544,21 @@ fe_ge_add: ldr x28, [x29, #168] ldp x29, x30, [sp], #0xb0 ret +#ifndef __APPLE__ .size fe_ge_add,.-fe_ge_add - .text - .align 2 - .globl fe_ge_sub - .type fe_ge_sub, %function +#endif /* __APPLE__ */ +#ifndef __APPLE__ +.text +.globl fe_ge_sub +.type fe_ge_sub,@function +.align 2 fe_ge_sub: +#else +.section __TEXT,__text +.globl _fe_ge_sub +.p2align 2 +_fe_ge_sub: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-176]! add x29, sp, #0 str x17, [x29, #88] @@ -6712,7 +7267,9 @@ fe_ge_sub: ldr x28, [x29, #168] ldp x29, x30, [sp], #0xb0 ret +#ifndef __APPLE__ .size fe_ge_sub,.-fe_ge_sub +#endif /* __APPLE__ */ #endif /* __aarch64__ */ #endif /* WOLFSSL_ARMASM */ diff --git a/wolfcrypt/src/port/arm/armv8-curve25519.c b/wolfcrypt/src/port/arm/armv8-curve25519.c index 2695ec1ca..97d30025f 100644 --- a/wolfcrypt/src/port/arm/armv8-curve25519.c +++ b/wolfcrypt/src/port/arm/armv8-curve25519.c @@ -19,24 +19,19 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif /* HAVE_CONFIG_H */ +#include + /* Generated using (from wolfssl): * cd ../scripts * ruby ./x25519/x25519.rb arm64 ../wolfssl/wolfcrypt/src/port/arm/armv8-curve25519.c */ - -#ifdef HAVE_CONFIG_H - #include -#endif - -#include - #ifdef WOLFSSL_ARMASM #ifdef __aarch64__ - -#include #include - void fe_init() { __asm__ __volatile__ ( @@ -776,123 +771,235 @@ void fe_invert(fe r, const fe a) "str %x[r], [x29, #144]\n\t" "str %x[a], [x29, #152]\n\t" "add x0, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x0, x29, #48\n\t" "add x1, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x1, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "ldr x1, [x29, #152]\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #16\n\t" "add x1, x29, #16\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x0, x29, #48\n\t" "add x1, x29, #48\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x20, #4\n\t" "add x1, x29, #0x50\n\t" "\n" "L_fe_invert1_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x20, x20, #1\n\t" "cmp x20, #0\n\t" "bne L_fe_invert1_%=\n\t" "add x0, x29, #48\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x50\n\t" "add x1, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x20, #9\n\t" "add x1, x29, #0x50\n\t" "\n" "L_fe_invert2_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x20, x20, #1\n\t" "cmp x20, #0\n\t" "bne L_fe_invert2_%=\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x70\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x20, #19\n\t" "add x1, x29, #0x70\n\t" "\n" "L_fe_invert3_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x20, x20, #1\n\t" "cmp x20, #0\n\t" "bne L_fe_invert3_%=\n\t" "add x0, x29, #0x50\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x20, #10\n\t" "add x1, x29, #0x50\n\t" "\n" "L_fe_invert4_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x20, x20, #1\n\t" "cmp x20, #0\n\t" "bne L_fe_invert4_%=\n\t" "add x0, x29, #48\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x50\n\t" "add x1, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x20, #49\n\t" "add x1, x29, #0x50\n\t" "\n" "L_fe_invert5_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x20, x20, #1\n\t" "cmp x20, #0\n\t" "bne L_fe_invert5_%=\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x70\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x20, #0x63\n\t" "add x1, x29, #0x70\n\t" "\n" "L_fe_invert6_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x20, x20, #1\n\t" "cmp x20, #0\n\t" "bne L_fe_invert6_%=\n\t" "add x0, x29, #0x50\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x20, #50\n\t" "add x1, x29, #0x50\n\t" "\n" "L_fe_invert7_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x20, x20, #1\n\t" "cmp x20, #0\n\t" "bne L_fe_invert7_%=\n\t" "add x0, x29, #48\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x20, #5\n\t" "add x1, x29, #48\n\t" "\n" "L_fe_invert8_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x20, x20, #1\n\t" "cmp x20, #0\n\t" "bne L_fe_invert8_%=\n\t" "ldr x0, [x29, #144]\n\t" "add x2, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "ldp x29, x30, [sp], #0xa0\n\t" : [r] "+r" (r), [a] "+r" (a) : @@ -2215,123 +2322,235 @@ int curve25519(byte* r, byte* n, byte* a) /* Invert */ "add x0, x29, #48\n\t" "add x1, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x50\n\t" "add x1, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x1, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x1, x29, #16\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #48\n\t" "add x1, x29, #48\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x70\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x50\n\t" "add x1, x29, #0x50\n\t" "add x2, x29, #0x70\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x70\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x24, #4\n\t" "add x1, x29, #0x70\n\t" "\n" "L_curve25519_inv_1_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x24, x24, #1\n\t" "cmp x24, #0\n\t" "bne L_curve25519_inv_1_%=\n\t" "add x0, x29, #0x50\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x70\n\t" "add x1, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x24, #9\n\t" "add x1, x29, #0x70\n\t" "\n" "L_curve25519_inv_2_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x24, x24, #1\n\t" "cmp x24, #0\n\t" "bne L_curve25519_inv_2_%=\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x90\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x24, #19\n\t" "add x1, x29, #0x90\n\t" "\n" "L_curve25519_inv_3_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x24, x24, #1\n\t" "cmp x24, #0\n\t" "bne L_curve25519_inv_3_%=\n\t" "add x0, x29, #0x70\n\t" "add x2, x29, #0x70\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x24, #10\n\t" "add x1, x29, #0x70\n\t" "\n" "L_curve25519_inv_4_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x24, x24, #1\n\t" "cmp x24, #0\n\t" "bne L_curve25519_inv_4_%=\n\t" "add x0, x29, #0x50\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x70\n\t" "add x1, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x24, #49\n\t" "add x1, x29, #0x70\n\t" "\n" "L_curve25519_inv_5_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x24, x24, #1\n\t" "cmp x24, #0\n\t" "bne L_curve25519_inv_5_%=\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x90\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x24, #0x63\n\t" "add x1, x29, #0x90\n\t" "\n" "L_curve25519_inv_6_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x24, x24, #1\n\t" "cmp x24, #0\n\t" "bne L_curve25519_inv_6_%=\n\t" "add x0, x29, #0x70\n\t" "add x2, x29, #0x70\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x24, #50\n\t" "add x1, x29, #0x70\n\t" "\n" "L_curve25519_inv_7_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x24, x24, #1\n\t" "cmp x24, #0\n\t" "bne L_curve25519_inv_7_%=\n\t" "add x0, x29, #0x50\n\t" "add x2, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x24, #5\n\t" "add x1, x29, #0x50\n\t" "\n" "L_curve25519_inv_8_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x24, x24, #1\n\t" "cmp x24, #0\n\t" "bne L_curve25519_inv_8_%=\n\t" "add x0, x29, #16\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "ldr %x[r], [x29, #176]\n\t" /* Multiply */ "ldp x6, x7, [%x[r]]\n\t" @@ -2491,122 +2710,234 @@ void fe_pow22523(fe r, const fe a) "str %x[r], [x29, #112]\n\t" "str %x[a], [x29, #120]\n\t" "add x0, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x0, x29, #48\n\t" "add x1, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x1, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "ldr x1, [x29, #120]\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #16\n\t" "add x1, x29, #16\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "add x1, x29, #48\n\t" "add x2, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #48\n\t" "add x1, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x21, #4\n\t" "add x1, x29, #48\n\t" "\n" "L_fe_pow22523_1_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x21, x21, #1\n\t" "cmp x21, #0\n\t" "bne L_fe_pow22523_1_%=\n\t" "add x0, x29, #16\n\t" "add x2, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #48\n\t" "add x1, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x21, #9\n\t" "add x1, x29, #48\n\t" "\n" "L_fe_pow22523_2_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x21, x21, #1\n\t" "cmp x21, #0\n\t" "bne L_fe_pow22523_2_%=\n\t" "add x2, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x21, #19\n\t" "add x1, x29, #0x50\n\t" "\n" "L_fe_pow22523_3_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x21, x21, #1\n\t" "cmp x21, #0\n\t" "bne L_fe_pow22523_3_%=\n\t" "add x0, x29, #48\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x21, #10\n\t" "add x1, x29, #48\n\t" "\n" "L_fe_pow22523_4_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x21, x21, #1\n\t" "cmp x21, #0\n\t" "bne L_fe_pow22523_4_%=\n\t" "add x0, x29, #16\n\t" "add x2, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #48\n\t" "add x1, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x21, #49\n\t" "add x1, x29, #48\n\t" "\n" "L_fe_pow22523_5_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x21, x21, #1\n\t" "cmp x21, #0\n\t" "bne L_fe_pow22523_5_%=\n\t" "add x2, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "add x0, x29, #0x50\n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "mov x21, #0x63\n\t" "add x1, x29, #0x50\n\t" "\n" "L_fe_pow22523_6_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x21, x21, #1\n\t" "cmp x21, #0\n\t" "bne L_fe_pow22523_6_%=\n\t" "add x0, x29, #48\n\t" "add x2, x29, #48\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x21, #50\n\t" "add x1, x29, #48\n\t" "\n" "L_fe_pow22523_7_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x21, x21, #1\n\t" "cmp x21, #0\n\t" "bne L_fe_pow22523_7_%=\n\t" "add x0, x29, #16\n\t" "add x2, x29, #16\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "mov x21, #2\n\t" "add x1, x29, #16\n\t" "\n" "L_fe_pow22523_8_%=: \n\t" +#ifndef __APPLE__ "bl fe_sq\n\t" +#else + "bl _fe_sq\n\t" +#endif /* __APPLE__ */ "sub x21, x21, #1\n\t" "cmp x21, #0\n\t" "bne L_fe_pow22523_8_%=\n\t" "ldr x0, [x29, #112]\n\t" "ldr x2, [x29, #120]\n\t" +#ifndef __APPLE__ "bl fe_mul\n\t" +#else + "bl _fe_mul\n\t" +#endif /* __APPLE__ */ "ldp x29, x30, [sp], #0x80\n\t" : [r] "+r" (r), [a] "+r" (a) : diff --git a/wolfcrypt/src/port/arm/armv8-poly1305.c b/wolfcrypt/src/port/arm/armv8-poly1305.c index 2f2dd8c83..11f3c7c63 100644 --- a/wolfcrypt/src/port/arm/armv8-poly1305.c +++ b/wolfcrypt/src/port/arm/armv8-poly1305.c @@ -207,11 +207,11 @@ void poly1305_blocks(Poly1305* ctx, const unsigned char *m, "MOV v28.D[0], x9 \n\t" "AND x22, x22, #0x3ffffff \n\t" /* Zero accumulator registers */ - "MOVI v15.2D, #0x0 \n\t" - "MOVI v16.2D, #0x0 \n\t" - "MOVI v17.2D, #0x0 \n\t" - "MOVI v18.2D, #0x0 \n\t" - "MOVI v19.2D, #0x0 \n\t" + "MOVI v15.16B, #0x0 \n\t" + "MOVI v16.16B, #0x0 \n\t" + "MOVI v17.16B, #0x0 \n\t" + "MOVI v18.16B, #0x0 \n\t" + "MOVI v19.16B, #0x0 \n\t" /* Set hibit */ "CMP %[finished], #0 \n\t" "CSET x9, EQ \n\t" diff --git a/wolfcrypt/src/port/arm/armv8-sha512-asm.S b/wolfcrypt/src/port/arm/armv8-sha512-asm.S index 6ae7a30c4..8cff141da 100644 --- a/wolfcrypt/src/port/arm/armv8-sha512-asm.S +++ b/wolfcrypt/src/port/arm/armv8-sha512-asm.S @@ -19,17 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif /* HAVE_CONFIG_H */ +#include + /* Generated using (from wolfssl): * cd ../scripts * ruby ./sha2/sha512.rb arm64 ../wolfssl/wolfcrypt/src/port/arm/armv8-sha512-asm.S */ #ifdef WOLFSSL_ARMASM #ifdef __aarch64__ +#ifndef __APPLE__ .text - .section .rodata .type L_SHA512_transform_neon_len_k, %object + .section .rodata .size L_SHA512_transform_neon_len_k, 640 +#else + .section __DATA,__data +#endif /* __APPLE__ */ +#ifndef __APPLE__ .align 3 +#else + .p2align 3 +#endif /* __APPLE__ */ L_SHA512_transform_neon_len_k: .xword 0x428a2f98d728ae22 .xword 0x7137449123ef65cd @@ -111,18 +124,33 @@ L_SHA512_transform_neon_len_k: .xword 0x597f299cfc657e2a .xword 0x5fcb6fab3ad6faec .xword 0x6c44198c4a475817 +#ifndef __APPLE__ .text - .section .rodata .type L_SHA512_transform_neon_len_ror8, %object + .section .rodata .size L_SHA512_transform_neon_len_ror8, 16 +#else + .section __DATA,__data +#endif /* __APPLE__ */ +#ifndef __APPLE__ .align 4 +#else + .p2align 4 +#endif /* __APPLE__ */ L_SHA512_transform_neon_len_ror8: .xword 0x7060504030201, 0x80f0e0d0c0b0a09 - .text - .align 2 - .globl Transform_Sha512_Len - .type Transform_Sha512_Len, %function +#ifndef __APPLE__ +.text +.globl Transform_Sha512_Len +.type Transform_Sha512_Len,@function +.align 2 Transform_Sha512_Len: +#else +.section __TEXT,__text +.globl _Transform_Sha512_Len +.p2align 2 +_Transform_Sha512_Len: +#endif /* __APPLE__ */ stp x29, x30, [sp, #-128]! add x29, sp, #0 str x17, [x29, #16] @@ -133,8 +161,18 @@ Transform_Sha512_Len: stp x26, x27, [x29, #80] stp d8, d9, [x29, #96] stp d10, d11, [x29, #112] +#ifndef __APPLE__ adr x3, L_SHA512_transform_neon_len_k +#else + adrp x3, L_SHA512_transform_neon_len_k@PAGE + add x3, x3, :lo12:L_SHA512_transform_neon_len_k@PAGEOFF +#endif /* __APPLE__ */ +#ifndef __APPLE__ adr x27, L_SHA512_transform_neon_len_ror8 +#else + adrp x27, L_SHA512_transform_neon_len_ror8@PAGE + add x27, x27, :lo12:L_SHA512_transform_neon_len_ror8@PAGEOFF +#endif /* __APPLE__ */ ld1 {v11.16b}, [x27] # Load digest into working vars ldp x4, x5, [x0] @@ -1026,7 +1064,12 @@ L_sha512_len_neon_start: add x6, x6, x21 add x5, x5, x20 add x4, x4, x19 +#ifndef __APPLE__ adr x3, L_SHA512_transform_neon_len_k +#else + adrp x3, L_SHA512_transform_neon_len_k@PAGE + add x3, x3, :lo12:L_SHA512_transform_neon_len_k@PAGEOFF +#endif /* __APPLE__ */ subs w2, w2, #0x80 bne L_sha512_len_neon_begin stp x4, x5, [x0] @@ -1043,7 +1086,9 @@ L_sha512_len_neon_start: ldp d10, d11, [x29, #112] ldp x29, x30, [sp], #0x80 ret +#ifndef __APPLE__ .size Transform_Sha512_Len,.-Transform_Sha512_Len +#endif /* __APPLE__ */ #endif /* __aarch64__ */ #endif /* WOLFSSL_ARMASM */ diff --git a/wolfcrypt/src/port/arm/armv8-sha512-asm.c b/wolfcrypt/src/port/arm/armv8-sha512-asm.c index 94568dc37..49dffd778 100644 --- a/wolfcrypt/src/port/arm/armv8-sha512-asm.c +++ b/wolfcrypt/src/port/arm/armv8-sha512-asm.c @@ -19,21 +19,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif /* HAVE_CONFIG_H */ +#include + /* Generated using (from wolfssl): * cd ../scripts * ruby ./sha2/sha512.rb arm64 ../wolfssl/wolfcrypt/src/port/arm/armv8-sha512-asm.c */ - -#ifdef HAVE_CONFIG_H - #include -#endif - -#include - #ifdef WOLFSSL_ARMASM #ifdef __aarch64__ - -#include #include static const uint64_t L_SHA512_transform_neon_len_k[] = { @@ -129,8 +125,18 @@ void Transform_Sha512_Len(wc_Sha512* sha512, const byte* data, word32 len) __asm__ __volatile__ ( "stp x29, x30, [sp, #-16]!\n\t" "add x29, sp, #0\n\t" +#ifndef __APPLE__ "adr x3, %[L_SHA512_transform_neon_len_k]\n\t" +#else + "adrp x3, %[L_SHA512_transform_neon_len_k]@PAGE\n\t" + "add x3, x3, %[L_SHA512_transform_neon_len_k]@PAGEOFF\n\t" +#endif /* __APPLE__ */ +#ifndef __APPLE__ "adr x27, %[L_SHA512_transform_neon_len_ror8]\n\t" +#else + "adrp x27, %[L_SHA512_transform_neon_len_ror8]@PAGE\n\t" + "add x27, x27, %[L_SHA512_transform_neon_len_ror8]@PAGEOFF\n\t" +#endif /* __APPLE__ */ "ld1 {v11.16b}, [x27]\n\t" /* Load digest into working vars */ "ldp x4, x5, [%x[sha512]]\n\t" @@ -1024,7 +1030,12 @@ void Transform_Sha512_Len(wc_Sha512* sha512, const byte* data, word32 len) "add x6, x6, x21\n\t" "add x5, x5, x20\n\t" "add x4, x4, x19\n\t" +#ifndef __APPLE__ "adr x3, %[L_SHA512_transform_neon_len_k]\n\t" +#else + "adrp x3, %[L_SHA512_transform_neon_len_k]@PAGE\n\t" + "add x3, x3, %[L_SHA512_transform_neon_len_k]@PAGEOFF\n\t" +#endif /* __APPLE__ */ "subs %w[len], %w[len], #0x80\n\t" "bne L_sha512_len_neon_begin_%=\n\t" "stp x4, x5, [%x[sha512]]\n\t" diff --git a/wolfcrypt/src/sp_arm32.c b/wolfcrypt/src/sp_arm32.c index 2ba17cbd1..085d8c069 100644 --- a/wolfcrypt/src/sp_arm32.c +++ b/wolfcrypt/src/sp_arm32.c @@ -7394,11 +7394,11 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[128], m[64], r[128]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -7734,10 +7734,10 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -7796,16 +7796,16 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[64], tmpb[64]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; @@ -18953,11 +18953,11 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[192], m[96], r[192]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -19373,10 +19373,10 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -19435,16 +19435,16 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[96], tmpb[96]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; @@ -26940,11 +26940,11 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[256], m[128], r[256]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -27440,10 +27440,10 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -27502,16 +27502,16 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[128], tmpb[128]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; diff --git a/wolfcrypt/src/sp_arm64.c b/wolfcrypt/src/sp_arm64.c index 378ffbf65..067b4a126 100644 --- a/wolfcrypt/src/sp_arm64.c +++ b/wolfcrypt/src/sp_arm64.c @@ -4888,11 +4888,11 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[64], m[32], r[64]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -5124,10 +5124,10 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -5186,16 +5186,16 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[32], tmpb[32]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; @@ -12597,11 +12597,11 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[96], m[48], r[96]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -12861,10 +12861,10 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -12923,16 +12923,16 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[48], tmpb[48]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; @@ -17528,11 +17528,11 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[128], m[64], r[128]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -17820,10 +17820,10 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -17882,16 +17882,16 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[64], tmpb[64]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; diff --git a/wolfcrypt/src/sp_armthumb.c b/wolfcrypt/src/sp_armthumb.c index 046360798..91a4bc367 100644 --- a/wolfcrypt/src/sp_armthumb.c +++ b/wolfcrypt/src/sp_armthumb.c @@ -4259,11 +4259,11 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[128], m[64], r[128]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -4432,10 +4432,10 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -4494,16 +4494,16 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[64], tmpb[64]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; @@ -10065,11 +10065,11 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[192], m[96], r[192]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -10238,10 +10238,10 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -10300,16 +10300,16 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[96], tmpb[96]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; @@ -13952,11 +13952,11 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[256], m[128], r[256]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -14126,10 +14126,10 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -14188,16 +14188,16 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[128], tmpb[128]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; diff --git a/wolfcrypt/src/sp_c32.c b/wolfcrypt/src/sp_c32.c index 714729f4f..4dec2d99c 100644 --- a/wolfcrypt/src/sp_c32.c +++ b/wolfcrypt/src/sp_c32.c @@ -2087,7 +2087,7 @@ static int sp_2048_mod_exp_45(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 90) + 90]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -3040,7 +3040,7 @@ static int sp_2048_mod_exp_90(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 180) + 180]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -3192,10 +3192,10 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm, { #ifdef WOLFSSL_SP_SMALL sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; - sp_digit* norm; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; + sp_digit* norm = NULL; sp_digit e[1] = {0}; sp_digit mp; int i; @@ -3289,9 +3289,9 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm, #else sp_digit* d = NULL; #endif - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; sp_digit e[1] = {0}; int err = MP_OKAY; @@ -3430,10 +3430,10 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -3530,15 +3530,15 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, #else #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* dq; - sp_digit* qi; - sp_digit* tmpa; - sp_digit* tmpb; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* dq = NULL; + sp_digit* qi = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)dm; @@ -5928,7 +5928,7 @@ static int sp_3072_mod_exp_67(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 134) + 134]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -6917,7 +6917,7 @@ static int sp_3072_mod_exp_134(sp_digit* r, const sp_digit* a, const sp_digit* e sp_digit td[(32 * 268) + 268]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -7069,10 +7069,10 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm, { #ifdef WOLFSSL_SP_SMALL sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; - sp_digit* norm; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; + sp_digit* norm = NULL; sp_digit e[1] = {0}; sp_digit mp; int i; @@ -7166,9 +7166,9 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm, #else sp_digit* d = NULL; #endif - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; sp_digit e[1] = {0}; int err = MP_OKAY; @@ -7307,10 +7307,10 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -7407,15 +7407,15 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, #else #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* dq; - sp_digit* qi; - sp_digit* tmpa; - sp_digit* tmpb; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* dq = NULL; + sp_digit* qi = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)dm; @@ -9992,7 +9992,7 @@ static int sp_4096_mod_exp_98(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 196) + 196]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -10958,7 +10958,7 @@ static int sp_4096_mod_exp_196(sp_digit* r, const sp_digit* a, const sp_digit* e sp_digit td[(32 * 392) + 392]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -11110,10 +11110,10 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, mp_int* em, mp_int* mm, { #ifdef WOLFSSL_SP_SMALL sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; - sp_digit* norm; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; + sp_digit* norm = NULL; sp_digit e[1] = {0}; sp_digit mp; int i; @@ -11207,9 +11207,9 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, mp_int* em, mp_int* mm, #else sp_digit* d = NULL; #endif - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; sp_digit e[1] = {0}; int err = MP_OKAY; @@ -11348,10 +11348,10 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -11448,15 +11448,15 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, #else #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* dq; - sp_digit* qi; - sp_digit* tmpa; - sp_digit* tmpb; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* dq = NULL; + sp_digit* qi = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)dm; diff --git a/wolfcrypt/src/sp_c64.c b/wolfcrypt/src/sp_c64.c index 4d4d3b645..cec1f2eb2 100644 --- a/wolfcrypt/src/sp_c64.c +++ b/wolfcrypt/src/sp_c64.c @@ -1735,7 +1735,7 @@ static int sp_2048_mod_exp_18(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 36) + 36]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -2680,7 +2680,7 @@ static int sp_2048_mod_exp_36(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 72) + 72]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -2832,10 +2832,10 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm, { #ifdef WOLFSSL_SP_SMALL sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; - sp_digit* norm; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; + sp_digit* norm = NULL; sp_digit e[1] = {0}; sp_digit mp; int i; @@ -2929,9 +2929,9 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm, #else sp_digit* d = NULL; #endif - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; sp_digit e[1] = {0}; int err = MP_OKAY; @@ -3070,10 +3070,10 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -3170,15 +3170,15 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, #else #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* dq; - sp_digit* qi; - sp_digit* tmpa; - sp_digit* tmpb; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* dq = NULL; + sp_digit* qi = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)dm; @@ -5916,7 +5916,7 @@ static int sp_3072_mod_exp_27(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 54) + 54]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -6831,7 +6831,7 @@ static int sp_3072_mod_exp_54(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 108) + 108]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -6983,10 +6983,10 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm, { #ifdef WOLFSSL_SP_SMALL sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; - sp_digit* norm; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; + sp_digit* norm = NULL; sp_digit e[1] = {0}; sp_digit mp; int i; @@ -7080,9 +7080,9 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm, #else sp_digit* d = NULL; #endif - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; sp_digit e[1] = {0}; int err = MP_OKAY; @@ -7221,10 +7221,10 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -7321,15 +7321,15 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, #else #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* dq; - sp_digit* qi; - sp_digit* tmpa; - sp_digit* tmpb; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* dq = NULL; + sp_digit* qi = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)dm; @@ -10213,7 +10213,7 @@ static int sp_4096_mod_exp_39(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 78) + 78]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -11227,7 +11227,7 @@ static int sp_4096_mod_exp_78(sp_digit* r, const sp_digit* a, const sp_digit* e, sp_digit td[(32 * 156) + 156]; #endif sp_digit* t[32]; - sp_digit* rt; + sp_digit* rt = NULL; sp_digit* norm; sp_digit mp = 1; sp_digit n; @@ -11379,10 +11379,10 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, mp_int* em, mp_int* mm, { #ifdef WOLFSSL_SP_SMALL sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; - sp_digit* norm; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; + sp_digit* norm = NULL; sp_digit e[1] = {0}; sp_digit mp; int i; @@ -11476,9 +11476,9 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, mp_int* em, mp_int* mm, #else sp_digit* d = NULL; #endif - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; sp_digit e[1] = {0}; int err = MP_OKAY; @@ -11617,10 +11617,10 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -11717,15 +11717,15 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, #else #if (defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)) && !defined(WOLFSSL_SP_NO_MALLOC) sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* dq; - sp_digit* qi; - sp_digit* tmpa; - sp_digit* tmpb; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* dq = NULL; + sp_digit* qi = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)dm; diff --git a/wolfcrypt/src/sp_cortexm.c b/wolfcrypt/src/sp_cortexm.c index 5f54b56d6..e930b34bb 100644 --- a/wolfcrypt/src/sp_cortexm.c +++ b/wolfcrypt/src/sp_cortexm.c @@ -4013,11 +4013,11 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[128], m[64], r[128]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -4184,10 +4184,10 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -4246,16 +4246,16 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[64], tmpb[64]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; @@ -8668,11 +8668,11 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[192], m[96], r[192]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -8839,10 +8839,10 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -8901,16 +8901,16 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[96], tmpb[96]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY; @@ -11875,11 +11875,11 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, mp_int* em, mp_int* mm, sp_digit a[256], m[128], r[256]; #else sp_digit* d = NULL; - sp_digit* a; - sp_digit* m; - sp_digit* r; + sp_digit* a = NULL; + sp_digit* m = NULL; + sp_digit* r = NULL; #endif - sp_digit *ah; + sp_digit *ah = NULL; sp_digit e[1]; int err = MP_OKAY; @@ -12047,10 +12047,10 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, byte* out, word32* outLen) { #if defined(SP_RSA_PRIVATE_EXP_D) || defined(RSA_LOW_MEM) - sp_digit* a; + sp_digit* a = NULL; sp_digit* d = NULL; - sp_digit* m; - sp_digit* r; + sp_digit* m = NULL; + sp_digit* r = NULL; int err = MP_OKAY; (void)pm; @@ -12109,16 +12109,16 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, mp_int* dm, sp_digit tmpa[128], tmpb[128]; #else sp_digit* t = NULL; - sp_digit* a; - sp_digit* p; - sp_digit* q; - sp_digit* dp; - sp_digit* tmpa; - sp_digit* tmpb; + sp_digit* a = NULL; + sp_digit* p = NULL; + sp_digit* q = NULL; + sp_digit* dp = NULL; + sp_digit* tmpa = NULL; + sp_digit* tmpb = NULL; #endif - sp_digit* r; - sp_digit* qi; - sp_digit* dq; + sp_digit* r = NULL; + sp_digit* qi = NULL; + sp_digit* dq = NULL; sp_digit c; int err = MP_OKAY;