From 26312141d83a9954573a162ecd0b579dcde919c9 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Thu, 31 Oct 2024 10:14:00 +1000 Subject: [PATCH] ASM: generated code not using uint*_t types Don't use uint*_t types as they may not be available. --- .../src/port/arm/armv8-32-curve25519_c.c | 8 +- wolfcrypt/src/port/arm/armv8-32-kyber-asm_c.c | 2 +- wolfcrypt/src/port/arm/armv8-curve25519_c.c | 6 +- wolfcrypt/src/port/arm/armv8-kyber-asm_c.c | 36 +-- wolfcrypt/src/port/arm/armv8-sha3-asm_c.c | 4 +- wolfcrypt/src/port/arm/armv8-sha512-asm_c.c | 6 +- wolfcrypt/src/port/arm/thumb2-curve25519_c.c | 8 +- wolfcrypt/src/port/arm/thumb2-kyber-asm_c.c | 2 +- wolfcrypt/src/sp_arm32.c | 300 +++++++++--------- wolfcrypt/src/sp_arm64.c | 130 ++++---- wolfcrypt/src/sp_armthumb.c | 246 +++++++------- wolfcrypt/src/sp_c32.c | 88 ++--- wolfcrypt/src/sp_c64.c | 88 ++--- wolfcrypt/src/sp_cortexm.c | 276 ++++++++-------- wolfcrypt/src/sp_dsp32.c | 10 +- wolfcrypt/src/sp_int.c | 2 +- wolfcrypt/src/sp_x86_64.c | 118 +++---- 17 files changed, 665 insertions(+), 665 deletions(-) diff --git a/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c b/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c index 284b806862..e39eff6410 100644 --- a/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c +++ b/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c @@ -648,7 +648,7 @@ int fe_isnonzero(const fe a_p) : "memory", "cc", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r12" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } int fe_isnegative(const fe a_p) @@ -674,7 +674,7 @@ int fe_isnegative(const fe a_p) : : "memory", "cc", "r1", "r2", "r3", "r4", "r5" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } #if defined(HAVE_ED25519_MAKE_KEY) || defined(HAVE_ED25519_SIGN) @@ -4030,7 +4030,7 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12", "lr" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -4344,7 +4344,7 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12", "lr" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WC_NO_CACHE_RESISTANT */ diff --git a/wolfcrypt/src/port/arm/armv8-32-kyber-asm_c.c b/wolfcrypt/src/port/arm/armv8-32-kyber-asm_c.c index 1866f3c41d..e5ce1a3835 100644 --- a/wolfcrypt/src/port/arm/armv8-32-kyber-asm_c.c +++ b/wolfcrypt/src/port/arm/armv8-32-kyber-asm_c.c @@ -9224,7 +9224,7 @@ unsigned int kyber_arm32_rej_uniform(sword16* p_p, unsigned int len_p, : : "memory", "cc", "r12", "lr", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)p; + return (word32)(size_t)p; } #endif /* WOLFSSL_WC_KYBER */ diff --git a/wolfcrypt/src/port/arm/armv8-curve25519_c.c b/wolfcrypt/src/port/arm/armv8-curve25519_c.c index 6af75a632b..a2dc78e58a 100644 --- a/wolfcrypt/src/port/arm/armv8-curve25519_c.c +++ b/wolfcrypt/src/port/arm/armv8-curve25519_c.c @@ -234,7 +234,7 @@ int fe_isnonzero(const fe a) : : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "cc" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } int fe_isnegative(const fe a) @@ -253,7 +253,7 @@ int fe_isnegative(const fe a) : : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "cc" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } void fe_cmov_table(fe* r, fe* base, signed char b) @@ -3683,7 +3683,7 @@ int curve25519(byte* r, const byte* n, const byte* a) : : "memory", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "cc" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #ifdef HAVE_ED25519 diff --git a/wolfcrypt/src/port/arm/armv8-kyber-asm_c.c b/wolfcrypt/src/port/arm/armv8-kyber-asm_c.c index 09f123b4c7..e82e245e6f 100644 --- a/wolfcrypt/src/port/arm/armv8-kyber-asm_c.c +++ b/wolfcrypt/src/port/arm/armv8-kyber-asm_c.c @@ -32,7 +32,7 @@ #ifdef WOLFSSL_ARMASM #ifdef __aarch64__ #ifdef WOLFSSL_ARMASM_INLINE -static const uint16_t L_kyber_aarch64_q[] = { +static const word16 L_kyber_aarch64_q[] = { 0xd01, 0xd01, 0xd01, @@ -43,7 +43,7 @@ static const uint16_t L_kyber_aarch64_q[] = { 0xd01, }; -static const uint16_t L_kyber_aarch64_consts[] = { +static const word16 L_kyber_aarch64_consts[] = { 0xd01, 0xf301, 0x4ebf, @@ -54,7 +54,7 @@ static const uint16_t L_kyber_aarch64_consts[] = { 0x0, }; -static const uint64_t L_sha3_aarch64_r[] = { +static const word64 L_sha3_aarch64_r[] = { 0x1UL, 0x8082UL, 0x800000000000808aUL, @@ -84,7 +84,7 @@ static const uint64_t L_sha3_aarch64_r[] = { #include #ifdef WOLFSSL_WC_KYBER -static const uint16_t L_kyber_aarch64_zetas[] = { +static const word16 L_kyber_aarch64_zetas[] = { 0x8ed, 0xa0b, 0xb9a, @@ -375,7 +375,7 @@ static const uint16_t L_kyber_aarch64_zetas[] = { 0x65c, }; -static const uint16_t L_kyber_aarch64_zetas_qinv[] = { +static const word16 L_kyber_aarch64_zetas_qinv[] = { 0xffed, 0x7b0b, 0x399a, @@ -2222,7 +2222,7 @@ void kyber_ntt(sword16* r) ); } -static const uint16_t L_kyber_aarch64_zetas_inv[] = { +static const word16 L_kyber_aarch64_zetas_inv[] = { 0x6a5, 0x6a5, 0x70f, @@ -2513,7 +2513,7 @@ static const uint16_t L_kyber_aarch64_zetas_inv[] = { 0x5a1, }; -static const uint16_t L_kyber_aarch64_zetas_inv_qinv[] = { +static const word16 L_kyber_aarch64_zetas_inv_qinv[] = { 0xa5a5, 0xa5a5, 0x440f, @@ -4596,7 +4596,7 @@ void kyber_invntt(sword16* r) ); } -static const uint16_t L_kyber_aarch64_zetas_mul[] = { +static const word16 L_kyber_aarch64_zetas_mul[] = { 0x8b2, 0xf74e, 0x1ae, @@ -7132,7 +7132,7 @@ void kyber_to_mont(sword16* p) ); } -static const uint16_t L_kyber_aarch64_to_msg_neon_low[] = { +static const word16 L_kyber_aarch64_to_msg_neon_low[] = { 0x373, 0x373, 0x373, @@ -7143,7 +7143,7 @@ static const uint16_t L_kyber_aarch64_to_msg_neon_low[] = { 0x373, }; -static const uint16_t L_kyber_aarch64_to_msg_neon_high[] = { +static const word16 L_kyber_aarch64_to_msg_neon_high[] = { 0x9c0, 0x9c0, 0x9c0, @@ -7154,7 +7154,7 @@ static const uint16_t L_kyber_aarch64_to_msg_neon_high[] = { 0x9c0, }; -static const uint16_t L_kyber_aarch64_to_msg_neon_bits[] = { +static const word16 L_kyber_aarch64_to_msg_neon_bits[] = { 0x1, 0x2, 0x4, @@ -7398,7 +7398,7 @@ void kyber_to_msg_neon(byte* msg, sword16* p) ); } -static const uint16_t L_kyber_aarch64_from_msg_neon_q1half[] = { +static const word16 L_kyber_aarch64_from_msg_neon_q1half[] = { 0x681, 0x681, 0x681, @@ -7409,7 +7409,7 @@ static const uint16_t L_kyber_aarch64_from_msg_neon_q1half[] = { 0x681, }; -static const uint8_t L_kyber_aarch64_from_msg_neon_bits[] = { +static const word8 L_kyber_aarch64_from_msg_neon_bits[] = { 0x1, 0x2, 0x4, @@ -7853,10 +7853,10 @@ int kyber_cmp_neon(const byte* a, const byte* b, int sz) : [L_kyber_aarch64_q] "S" (L_kyber_aarch64_q), [L_kyber_aarch64_consts] "S" (L_kyber_aarch64_consts), [L_sha3_aarch64_r] "S" (L_sha3_aarch64_r), [L_kyber_aarch64_zetas] "S" (L_kyber_aarch64_zetas), [L_kyber_aarch64_zetas_qinv] "S" (L_kyber_aarch64_zetas_qinv), [L_kyber_aarch64_zetas_inv] "S" (L_kyber_aarch64_zetas_inv), [L_kyber_aarch64_zetas_inv_qinv] "S" (L_kyber_aarch64_zetas_inv_qinv), [L_kyber_aarch64_zetas_mul] "S" (L_kyber_aarch64_zetas_mul), [L_kyber_aarch64_to_msg_neon_low] "S" (L_kyber_aarch64_to_msg_neon_low), [L_kyber_aarch64_to_msg_neon_high] "S" (L_kyber_aarch64_to_msg_neon_high), [L_kyber_aarch64_to_msg_neon_bits] "S" (L_kyber_aarch64_to_msg_neon_bits), [L_kyber_aarch64_from_msg_neon_q1half] "S" (L_kyber_aarch64_from_msg_neon_q1half), [L_kyber_aarch64_from_msg_neon_bits] "S" (L_kyber_aarch64_from_msg_neon_bits) : "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "cc" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } -static const uint16_t L_kyber_aarch64_rej_uniform_neon_mask[] = { +static const word16 L_kyber_aarch64_rej_uniform_neon_mask[] = { 0xfff, 0xfff, 0xfff, @@ -7867,7 +7867,7 @@ static const uint16_t L_kyber_aarch64_rej_uniform_neon_mask[] = { 0xfff, }; -static const uint16_t L_kyber_aarch64_rej_uniform_neon_bits[] = { +static const word16 L_kyber_aarch64_rej_uniform_neon_bits[] = { 0x1, 0x2, 0x4, @@ -7878,7 +7878,7 @@ static const uint16_t L_kyber_aarch64_rej_uniform_neon_bits[] = { 0x80, }; -static const uint8_t L_kyber_aarch64_rej_uniform_neon_indeces[] = { +static const word8 L_kyber_aarch64_rej_uniform_neon_indeces[] = { 0xff, 0xff, 0xff, @@ -12154,7 +12154,7 @@ unsigned int kyber_rej_uniform_neon(sword16* p, unsigned int len, const byte* r, : [L_kyber_aarch64_q] "S" (L_kyber_aarch64_q), [L_kyber_aarch64_consts] "S" (L_kyber_aarch64_consts), [L_sha3_aarch64_r] "S" (L_sha3_aarch64_r), [L_kyber_aarch64_zetas] "S" (L_kyber_aarch64_zetas), [L_kyber_aarch64_zetas_qinv] "S" (L_kyber_aarch64_zetas_qinv), [L_kyber_aarch64_zetas_inv] "S" (L_kyber_aarch64_zetas_inv), [L_kyber_aarch64_zetas_inv_qinv] "S" (L_kyber_aarch64_zetas_inv_qinv), [L_kyber_aarch64_zetas_mul] "S" (L_kyber_aarch64_zetas_mul), [L_kyber_aarch64_to_msg_neon_low] "S" (L_kyber_aarch64_to_msg_neon_low), [L_kyber_aarch64_to_msg_neon_high] "S" (L_kyber_aarch64_to_msg_neon_high), [L_kyber_aarch64_to_msg_neon_bits] "S" (L_kyber_aarch64_to_msg_neon_bits), [L_kyber_aarch64_from_msg_neon_q1half] "S" (L_kyber_aarch64_from_msg_neon_q1half), [L_kyber_aarch64_from_msg_neon_bits] "S" (L_kyber_aarch64_from_msg_neon_bits), [L_kyber_aarch64_rej_uniform_neon_mask] "S" (L_kyber_aarch64_rej_uniform_neon_mask), [L_kyber_aarch64_rej_uniform_neon_bits] "S" (L_kyber_aarch64_rej_uniform_neon_bits), [L_kyber_aarch64_rej_uniform_neon_indeces] "S" (L_kyber_aarch64_rej_uniform_neon_indeces) : "memory", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "cc" ); - return (uint32_t)(size_t)p; + return (word32)(size_t)p; } #ifdef WOLFSSL_ARMASM_CRYPTO_SHA3 diff --git a/wolfcrypt/src/port/arm/armv8-sha3-asm_c.c b/wolfcrypt/src/port/arm/armv8-sha3-asm_c.c index 71ac40a22d..00a7ecb376 100644 --- a/wolfcrypt/src/port/arm/armv8-sha3-asm_c.c +++ b/wolfcrypt/src/port/arm/armv8-sha3-asm_c.c @@ -36,7 +36,7 @@ #ifdef WOLFSSL_SHA3 #ifdef WOLFSSL_ARMASM_CRYPTO_SHA3 -static const uint64_t L_SHA3_transform_crypto_r[] = { +static const word64 L_SHA3_transform_crypto_r[] = { 0x1UL, 0x8082UL, 0x800000000000808aUL, @@ -182,7 +182,7 @@ void BlockSha3(word64* state) } #else -static const uint64_t L_SHA3_transform_base_r[] = { +static const word64 L_SHA3_transform_base_r[] = { 0x1UL, 0x8082UL, 0x800000000000808aUL, diff --git a/wolfcrypt/src/port/arm/armv8-sha512-asm_c.c b/wolfcrypt/src/port/arm/armv8-sha512-asm_c.c index ba7dc82e06..7da3bd2b98 100644 --- a/wolfcrypt/src/port/arm/armv8-sha512-asm_c.c +++ b/wolfcrypt/src/port/arm/armv8-sha512-asm_c.c @@ -36,7 +36,7 @@ #ifdef WOLFSSL_SHA512 #ifndef WOLFSSL_ARMASM_CRYPTO_SHA512 -static const uint64_t L_SHA512_transform_neon_len_k[] = { +static const word64 L_SHA512_transform_neon_len_k[] = { 0x428a2f98d728ae22UL, 0x7137449123ef65cdUL, 0xb5c0fbcfec4d3b2fUL, @@ -119,7 +119,7 @@ static const uint64_t L_SHA512_transform_neon_len_k[] = { 0x6c44198c4a475817UL, }; -static const uint64_t L_SHA512_transform_neon_len_ror8[] = { +static const word64 L_SHA512_transform_neon_len_ror8[] = { 0x7060504030201UL, 0x80f0e0d0c0b0a09UL, }; @@ -1054,7 +1054,7 @@ void Transform_Sha512_Len_neon(wc_Sha512* sha512, const byte* data, word32 len) } #else -static const uint64_t L_SHA512_transform_crypto_len_k[] = { +static const word64 L_SHA512_transform_crypto_len_k[] = { 0x428a2f98d728ae22UL, 0x7137449123ef65cdUL, 0xb5c0fbcfec4d3b2fUL, diff --git a/wolfcrypt/src/port/arm/thumb2-curve25519_c.c b/wolfcrypt/src/port/arm/thumb2-curve25519_c.c index df8273840b..a5b4079513 100644 --- a/wolfcrypt/src/port/arm/thumb2-curve25519_c.c +++ b/wolfcrypt/src/port/arm/thumb2-curve25519_c.c @@ -533,7 +533,7 @@ int fe_isnonzero(const fe a) : : "memory", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "cc" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } #ifndef WOLFSSL_NO_VAR_ASSIGN_REG @@ -565,7 +565,7 @@ int fe_isnegative(const fe a) : : "memory", "r1", "r2", "r3", "r4", "r5", "cc" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } #if defined(HAVE_ED25519_MAKE_KEY) || defined(HAVE_ED25519_SIGN) @@ -3239,7 +3239,7 @@ int curve25519(byte* r, const byte* n, const byte* a) : : "memory", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12", "lr", "cc" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -3645,7 +3645,7 @@ int curve25519(byte* r, const byte* n, const byte* a) : : "memory", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12", "lr", "cc" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WC_NO_CACHE_RESISTANT */ diff --git a/wolfcrypt/src/port/arm/thumb2-kyber-asm_c.c b/wolfcrypt/src/port/arm/thumb2-kyber-asm_c.c index e42741d625..57d7c1a589 100644 --- a/wolfcrypt/src/port/arm/thumb2-kyber-asm_c.c +++ b/wolfcrypt/src/port/arm/thumb2-kyber-asm_c.c @@ -3842,7 +3842,7 @@ unsigned int kyber_thumb2_rej_uniform(sword16* p, unsigned int len, const byte* : "memory", "r5", "r6", "r7", "r8", "r9", "r10", "cc" #endif /* WOLFSSL_NO_VAR_ASSIGN_REG */ ); - return (uint32_t)(size_t)p; + return (word32)(size_t)p; } #endif /* WOLFSSL_WC_KYBER */ diff --git a/wolfcrypt/src/sp_arm32.c b/wolfcrypt/src/sp_arm32.c index 87e9c426a3..3102c2cc12 100644 --- a/wolfcrypt/src/sp_arm32.c +++ b/wolfcrypt/src/sp_arm32.c @@ -2756,7 +2756,7 @@ static sp_digit sp_2048_add_8(sp_digit* r_p, const sp_digit* a_p, const sp_digit : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Sub b from a into a. (a -= b) @@ -2803,7 +2803,7 @@ static sp_digit sp_2048_sub_in_place_16(sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Add b to a into r. (r = a + b) @@ -2853,7 +2853,7 @@ static sp_digit sp_2048_add_16(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* AND m into each word of a and store in r. @@ -2993,7 +2993,7 @@ static sp_digit sp_2048_sub_in_place_32(sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Add b to a into r. (r = a + b) @@ -3071,7 +3071,7 @@ static sp_digit sp_2048_add_32(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* AND m into each word of a and store in r. @@ -3271,7 +3271,7 @@ static sp_digit sp_2048_sub_in_place_64(sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Add b to a into r. (r = a + b) @@ -3405,7 +3405,7 @@ static sp_digit sp_2048_add_64(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* AND m into each word of a and store in r. @@ -5082,7 +5082,7 @@ static sp_digit sp_2048_sub_8(sp_digit* r_p, const sp_digit* a_p, const sp_digit : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Square a and put result in r. (r = a * a) @@ -5167,7 +5167,7 @@ static sp_digit sp_2048_sub_16(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Square a and put result in r. (r = a * a) @@ -5280,7 +5280,7 @@ static sp_digit sp_2048_sub_32(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Square a and put result in r. (r = a * a) @@ -5356,7 +5356,7 @@ static sp_digit sp_2048_add_64(sp_digit* r_p, const sp_digit* a_p, const sp_digi : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -5393,7 +5393,7 @@ static sp_digit sp_2048_sub_in_place_64(sp_digit* a_p, const sp_digit* b_p) : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r12", "lr" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } #endif /* WOLFSSL_SP_SMALL */ @@ -5811,7 +5811,7 @@ static sp_digit sp_2048_add_32(sp_digit* r_p, const sp_digit* a_p, const sp_digi : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -5848,7 +5848,7 @@ static sp_digit sp_2048_sub_in_place_32(sp_digit* a_p, const sp_digit* b_p) : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r12", "lr" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } #endif /* WOLFSSL_SP_SMALL */ @@ -8451,7 +8451,7 @@ static sp_digit sp_2048_cond_sub_32(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -8590,7 +8590,7 @@ static sp_digit sp_2048_cond_sub_32(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -11304,7 +11304,7 @@ static sp_digit div_2048_word_32(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #else @@ -11442,7 +11442,7 @@ static sp_digit div_2048_word_32(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #endif @@ -11841,7 +11841,7 @@ static sp_int32 sp_2048_cmp_32(const sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Divide d in a and put remainder into r (m*d + r = a) @@ -12277,7 +12277,7 @@ static sp_digit sp_2048_cond_sub_64(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -12528,7 +12528,7 @@ static sp_digit sp_2048_cond_sub_64(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -15425,7 +15425,7 @@ static sp_digit sp_2048_sub_64(sp_digit* r_p, const sp_digit* a_p, const sp_digi : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r12", "lr" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -15559,7 +15559,7 @@ static sp_digit sp_2048_sub_64(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -15619,7 +15619,7 @@ static sp_digit div_2048_word_64(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #else @@ -15757,7 +15757,7 @@ static sp_digit div_2048_word_64(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #endif @@ -16612,7 +16612,7 @@ static sp_int32 sp_2048_cmp_64(const sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Divide d in a and put remainder into r (m*d + r = a) @@ -17170,7 +17170,7 @@ static sp_digit sp_2048_cond_add_32(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -17309,7 +17309,7 @@ static sp_digit sp_2048_cond_add_32(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -23971,7 +23971,7 @@ static sp_digit sp_3072_add_12(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Sub b from a into a. (a -= b) @@ -24032,7 +24032,7 @@ static sp_digit sp_3072_sub_in_place_24(sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Add b to a into r. (r = a + b) @@ -24096,7 +24096,7 @@ static sp_digit sp_3072_add_24(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* AND m into each word of a and store in r. @@ -24268,7 +24268,7 @@ static sp_digit sp_3072_sub_in_place_48(sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Add b to a into r. (r = a + b) @@ -24374,7 +24374,7 @@ static sp_digit sp_3072_add_48(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* AND m into each word of a and store in r. @@ -24630,7 +24630,7 @@ static sp_digit sp_3072_sub_in_place_96(sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Add b to a into r. (r = a + b) @@ -24820,7 +24820,7 @@ static sp_digit sp_3072_add_96(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* AND m into each word of a and store in r. @@ -27994,7 +27994,7 @@ static sp_digit sp_3072_sub_12(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Square a and put result in r. (r = a * a) @@ -28093,7 +28093,7 @@ static sp_digit sp_3072_sub_24(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Square a and put result in r. (r = a * a) @@ -28234,7 +28234,7 @@ static sp_digit sp_3072_sub_48(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Square a and put result in r. (r = a * a) @@ -28310,7 +28310,7 @@ static sp_digit sp_3072_add_96(sp_digit* r_p, const sp_digit* a_p, const sp_digi : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -28347,7 +28347,7 @@ static sp_digit sp_3072_sub_in_place_96(sp_digit* a_p, const sp_digit* b_p) : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r12", "lr" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } #endif /* WOLFSSL_SP_SMALL */ @@ -28765,7 +28765,7 @@ static sp_digit sp_3072_add_48(sp_digit* r_p, const sp_digit* a_p, const sp_digi : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -28802,7 +28802,7 @@ static sp_digit sp_3072_sub_in_place_48(sp_digit* a_p, const sp_digit* b_p) : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r12", "lr" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } #endif /* WOLFSSL_SP_SMALL */ @@ -32429,7 +32429,7 @@ static sp_digit sp_3072_cond_sub_48(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -32624,7 +32624,7 @@ static sp_digit sp_3072_cond_sub_48(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -36522,7 +36522,7 @@ static sp_digit div_3072_word_48(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #else @@ -36660,7 +36660,7 @@ static sp_digit div_3072_word_48(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #endif @@ -37235,7 +37235,7 @@ static sp_int32 sp_3072_cmp_48(const sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Divide d in a and put remainder into r (m*d + r = a) @@ -37671,7 +37671,7 @@ static sp_digit sp_3072_cond_sub_96(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -38034,7 +38034,7 @@ static sp_digit sp_3072_cond_sub_96(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -42275,7 +42275,7 @@ static sp_digit sp_3072_sub_96(sp_digit* r_p, const sp_digit* a_p, const sp_digi : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r12", "lr" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -42465,7 +42465,7 @@ static sp_digit sp_3072_sub_96(sp_digit* r_p, const sp_digit* a_p, const sp_digi : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -42525,7 +42525,7 @@ static sp_digit div_3072_word_96(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #else @@ -42663,7 +42663,7 @@ static sp_digit div_3072_word_96(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #endif @@ -43876,7 +43876,7 @@ static sp_int32 sp_3072_cmp_96(const sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Divide d in a and put remainder into r (m*d + r = a) @@ -44434,7 +44434,7 @@ static sp_digit sp_3072_cond_add_48(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -44629,7 +44629,7 @@ static sp_digit sp_3072_cond_add_48(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -46186,7 +46186,7 @@ static sp_digit sp_4096_sub_in_place_128(sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Add b to a into r. (r = a + b) @@ -46433,7 +46433,7 @@ static sp_digit sp_4096_add_128(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Multiply a and b into r. (r = a * b) @@ -46549,7 +46549,7 @@ static sp_digit sp_4096_add_128(sp_digit* r_p, const sp_digit* a_p, : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -46586,7 +46586,7 @@ static sp_digit sp_4096_sub_in_place_128(sp_digit* a_p, const sp_digit* b_p) : "memory", "cc", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r12", "lr" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } #endif /* WOLFSSL_SP_SMALL */ @@ -51236,7 +51236,7 @@ static sp_digit sp_4096_cond_sub_128(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -51711,7 +51711,7 @@ static sp_digit sp_4096_cond_sub_128(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -57297,7 +57297,7 @@ static sp_digit sp_4096_sub_128(sp_digit* r_p, const sp_digit* a_p, : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r12", "lr" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -57544,7 +57544,7 @@ static sp_digit sp_4096_sub_128(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -57604,7 +57604,7 @@ static sp_digit div_4096_word_128(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #else @@ -57742,7 +57742,7 @@ static sp_digit div_4096_word_128(sp_digit d1_p, sp_digit d0_p, sp_digit div_p) : : "memory", "cc", "r3", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)d1; + return (word32)(size_t)d1; } #endif @@ -59307,7 +59307,7 @@ static sp_int32 sp_4096_cmp_128(const sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Divide d in a and put remainder into r (m*d + r = a) @@ -59865,7 +59865,7 @@ static sp_digit sp_4096_cond_add_64(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -60116,7 +60116,7 @@ static sp_digit sp_4096_cond_add_64(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7", "r8" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -65953,7 +65953,7 @@ static sp_digit sp_256_add_8(sp_digit* r_p, const sp_digit* a_p, const sp_digit* : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r3", "r12" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -65990,7 +65990,7 @@ static sp_digit sp_256_add_8(sp_digit* r_p, const sp_digit* a_p, const sp_digit* : : "memory", "cc", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -66229,7 +66229,7 @@ static int sp_256_mod_mul_norm_8(sp_digit* r_p, const sp_digit* a_p, "lr", "r10" ); (void)m_p; - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } /* Convert an mp_int to an array of sp_digit. @@ -71323,7 +71323,7 @@ static sp_int32 sp_256_cmp_8(const sp_digit* a_p, const sp_digit* b_p) : : "memory", "cc", "r2", "r3", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)a; + return (word32)(size_t)a; } /* Normalize the values in each word to 32. @@ -71370,7 +71370,7 @@ static sp_digit sp_256_cond_sub_8(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #else @@ -71425,7 +71425,7 @@ static sp_digit sp_256_cond_sub_8(sp_digit* r_p, const sp_digit* a_p, : : "memory", "cc", "r12", "lr", "r4", "r5", "r6", "r7" ); - return (uint32_t)(size_t)r; + return (word32)(size_t)r; } #endif /* WOLFSSL_SP_SMALL */ @@ -74152,7 +74152,7 @@ typedef struct sp_cache_256_t { /* Precomputation table for point. */ sp_table_entry_256 table[16]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_256_t; @@ -74180,7 +74180,7 @@ static void sp_ecc_get_cache_256(const sp_point_256* g, sp_cache_256_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_256_inited == 0) { for (i=0; i>= 6; @@ -24253,12 +24253,12 @@ static void sp_256_ecc_recode_6_4(const sp_digit* k, ecc_recode_256* v) } else if (++j < 4) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x3f); + y |= (word8)((n << (64 - o)) & 0x3f); o -= 58; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_4_6[y]; v[i].neg = recode_neg_4_6[y]; carry = (y >> 6) + v[i].neg; @@ -24905,7 +24905,7 @@ typedef struct sp_cache_256_t { /* Precomputation table for point. */ sp_table_entry_256 table[64]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_256_t; @@ -24933,7 +24933,7 @@ static void sp_ecc_get_cache_256(const sp_point_256* g, sp_cache_256_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_256_inited == 0) { for (i=0; i>= 7; @@ -27336,12 +27336,12 @@ static void sp_256_ecc_recode_7_4(const sp_digit* k, ecc_recode_256* v) } else if (++j < 4) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x7f); + y |= (word8)((n << (64 - o)) & 0x7f); o -= 57; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_4_7[y]; v[i].neg = recode_neg_4_7[y]; carry = (y >> 7) + v[i].neg; @@ -45159,13 +45159,13 @@ static void sp_384_proj_point_add_sub_6(sp_point_384* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_384 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_384; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_6_6[66] = { +static const word8 recode_index_6_6[66] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, @@ -45174,7 +45174,7 @@ static const uint8_t recode_index_6_6[66] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_6_6[66] = { +static const word8 recode_neg_6_6[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -45192,7 +45192,7 @@ static void sp_384_ecc_recode_6_6(const sp_digit* k, ecc_recode_384* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -45201,7 +45201,7 @@ static void sp_384_ecc_recode_6_6(const sp_digit* k, ecc_recode_384* v) n = k[j]; o = 0; for (i=0; i<65; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 6 < 64) { y &= 0x3f; n >>= 6; @@ -45215,12 +45215,12 @@ static void sp_384_ecc_recode_6_6(const sp_digit* k, ecc_recode_384* v) } else if (++j < 6) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x3f); + y |= (word8)((n << (64 - o)) & 0x3f); o -= 58; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_6_6[y]; v[i].neg = recode_neg_6_6[y]; carry = (y >> 6) + v[i].neg; @@ -45831,7 +45831,7 @@ typedef struct sp_cache_384_t { /* Precomputation table for point. */ sp_table_entry_384 table[64]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_384_t; @@ -45859,7 +45859,7 @@ static void sp_ecc_get_cache_384(const sp_point_384* g, sp_cache_384_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_384_inited == 0) { for (i=0; i>= 7; @@ -48262,12 +48262,12 @@ static void sp_384_ecc_recode_7_6(const sp_digit* k, ecc_recode_384* v) } else if (++j < 6) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x7f); + y |= (word8)((n << (64 - o)) & 0x7f); o -= 57; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_6_7[y]; v[i].neg = recode_neg_6_7[y]; carry = (y >> 7) + v[i].neg; @@ -73516,13 +73516,13 @@ static void sp_521_proj_point_add_sub_9(sp_point_521* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_521 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_521; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_9_6[66] = { +static const word8 recode_index_9_6[66] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, @@ -73531,7 +73531,7 @@ static const uint8_t recode_index_9_6[66] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_9_6[66] = { +static const word8 recode_neg_9_6[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -73549,7 +73549,7 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -73558,7 +73558,7 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) n = k[j]; o = 0; for (i=0; i<87; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 6 < 64) { y &= 0x3f; n >>= 6; @@ -73572,12 +73572,12 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) } else if (++j < 9) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x3f); + y |= (word8)((n << (64 - o)) & 0x3f); o -= 58; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_9_6[y]; v[i].neg = recode_neg_9_6[y]; carry = (y >> 6) + v[i].neg; @@ -74233,7 +74233,7 @@ typedef struct sp_cache_521_t { /* Precomputation table for point. */ sp_table_entry_521 table[64]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_521_t; @@ -74261,7 +74261,7 @@ static void sp_ecc_get_cache_521(const sp_point_521* g, sp_cache_521_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_521_inited == 0) { for (i=0; i>= 7; @@ -77318,12 +77318,12 @@ static void sp_521_ecc_recode_7_9(const sp_digit* k, ecc_recode_521* v) } else if (++j < 9) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x7f); + y |= (word8)((n << (64 - o)) & 0x7f); o -= 57; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_9_7[y]; v[i].neg = recode_neg_9_7[y]; carry = (y >> 7) + v[i].neg; @@ -116078,7 +116078,7 @@ SP_NOINLINE static void sp_1024_mont_sqr_16(sp_digit* r, const sp_digit* a, } /* Mod-2 for the P1024 curve. */ -static const uint8_t p1024_mod_minus_2[] = { +static const word8 p1024_mod_minus_2[] = { 6,0x06, 7,0x0f, 7,0x0b, 6,0x0c, 7,0x1e, 9,0x09, 7,0x0c, 7,0x1f, 6,0x16, 6,0x06, 7,0x0e, 8,0x10, 6,0x03, 8,0x11, 6,0x0d, 7,0x14, 9,0x12, 6,0x0f, 7,0x04, 9,0x0d, 6,0x00, 7,0x13, 6,0x01, 6,0x07, @@ -117595,13 +117595,13 @@ static void sp_1024_proj_point_add_sub_16(sp_point_1024* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_1024 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_1024; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_16_7[130] = { +static const word8 recode_index_16_7[130] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -117614,7 +117614,7 @@ static const uint8_t recode_index_16_7[130] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_16_7[130] = { +static const word8 recode_neg_16_7[130] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -117636,7 +117636,7 @@ static void sp_1024_ecc_recode_7_16(const sp_digit* k, ecc_recode_1024* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -117645,7 +117645,7 @@ static void sp_1024_ecc_recode_7_16(const sp_digit* k, ecc_recode_1024* v) n = k[j]; o = 0; for (i=0; i<147; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 7 < 64) { y &= 0x7f; n >>= 7; @@ -117659,12 +117659,12 @@ static void sp_1024_ecc_recode_7_16(const sp_digit* k, ecc_recode_1024* v) } else if (++j < 16) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x7f); + y |= (word8)((n << (64 - o)) & 0x7f); o -= 57; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_16_7[y]; v[i].neg = recode_neg_16_7[y]; carry = (y >> 7) + v[i].neg; @@ -118133,7 +118133,7 @@ typedef struct sp_cache_1024_t { /* Precomputation table for point. */ sp_table_entry_1024 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_1024_t; @@ -118161,7 +118161,7 @@ static void sp_ecc_get_cache_1024(const sp_point_1024* g, sp_cache_1024_t** cach { int i; int j; - uint32_t least; + word32 least; if (sp_cache_1024_inited == 0) { for (i=0; i> 1) @@ -126018,7 +126018,7 @@ typedef struct sp_cache_521_t { /* Precomputation table for point. */ sp_table_entry_521 table[16]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_521_t; @@ -126046,7 +126046,7 @@ static void sp_ecc_get_cache_521(const sp_point_521* g, sp_cache_521_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_521_inited == 0) { for (i=0; i> 1) @@ -210617,7 +210617,7 @@ typedef struct sp_cache_1024_t { /* Precomputation table for point. */ sp_table_entry_1024 table[16]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_1024_t; @@ -210645,7 +210645,7 @@ static void sp_ecc_get_cache_1024(const sp_point_1024* g, sp_cache_1024_t** cach { int i; int j; - uint32_t least; + word32 least; if (sp_cache_1024_inited == 0) { for (i=0; i>= 6; @@ -22441,12 +22441,12 @@ static void sp_256_ecc_recode_6_9(const sp_digit* k, ecc_recode_256* v) } else if (++j < 9) { n = k[j]; - y |= (uint8_t)((n << (29 - o)) & 0x3f); + y |= (word8)((n << (29 - o)) & 0x3f); o -= 23; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_9_6[y]; v[i].neg = recode_neg_9_6[y]; carry = (y >> 6) + v[i].neg; @@ -23046,7 +23046,7 @@ typedef struct sp_cache_256_t { /* Precomputation table for point. */ sp_table_entry_256 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_256_t; @@ -23074,7 +23074,7 @@ static void sp_ecc_get_cache_256(const sp_point_256* g, sp_cache_256_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_256_inited == 0) { for (i=0; i> 4; v |= v >> 8; v |= v >> 16; - return sp_256_tab32_9[(uint32_t)(v*0x07C4ACDD) >> 27]; + return sp_256_tab32_9[(word32)(v*0x07C4ACDD) >> 27]; } static int sp_256_num_bits_9(const sp_digit* a) @@ -29854,13 +29854,13 @@ static void sp_384_proj_point_add_sub_15(sp_point_384* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_384 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_384; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_15_6[66] = { +static const word8 recode_index_15_6[66] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, @@ -29869,7 +29869,7 @@ static const uint8_t recode_index_15_6[66] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_15_6[66] = { +static const word8 recode_neg_15_6[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -29887,7 +29887,7 @@ static void sp_384_ecc_recode_6_15(const sp_digit* k, ecc_recode_384* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -29896,7 +29896,7 @@ static void sp_384_ecc_recode_6_15(const sp_digit* k, ecc_recode_384* v) n = k[j]; o = 0; for (i=0; i<65; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 6 < 26) { y &= 0x3f; n >>= 6; @@ -29910,12 +29910,12 @@ static void sp_384_ecc_recode_6_15(const sp_digit* k, ecc_recode_384* v) } else if (++j < 15) { n = k[j]; - y |= (uint8_t)((n << (26 - o)) & 0x3f); + y |= (word8)((n << (26 - o)) & 0x3f); o -= 20; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_15_6[y]; v[i].neg = recode_neg_15_6[y]; carry = (y >> 6) + v[i].neg; @@ -30575,7 +30575,7 @@ typedef struct sp_cache_384_t { /* Precomputation table for point. */ sp_table_entry_384 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_384_t; @@ -30603,7 +30603,7 @@ static void sp_ecc_get_cache_384(const sp_point_384* g, sp_cache_384_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_384_inited == 0) { for (i=0; i> 4; v |= v >> 8; v |= v >> 16; - return sp_384_tab32_15[(uint32_t)(v*0x07C4ACDD) >> 27]; + return sp_384_tab32_15[(word32)(v*0x07C4ACDD) >> 27]; } static int sp_384_num_bits_15(const sp_digit* a) @@ -37373,13 +37373,13 @@ static void sp_521_proj_point_add_sub_21(sp_point_521* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_521 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_521; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_21_6[66] = { +static const word8 recode_index_21_6[66] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, @@ -37388,7 +37388,7 @@ static const uint8_t recode_index_21_6[66] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_21_6[66] = { +static const word8 recode_neg_21_6[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -37406,7 +37406,7 @@ static void sp_521_ecc_recode_6_21(const sp_digit* k, ecc_recode_521* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -37415,7 +37415,7 @@ static void sp_521_ecc_recode_6_21(const sp_digit* k, ecc_recode_521* v) n = k[j]; o = 0; for (i=0; i<87; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 6 < 25) { y &= 0x3f; n >>= 6; @@ -37429,12 +37429,12 @@ static void sp_521_ecc_recode_6_21(const sp_digit* k, ecc_recode_521* v) } else if (++j < 21) { n = k[j]; - y |= (uint8_t)((n << (25 - o)) & 0x3f); + y |= (word8)((n << (25 - o)) & 0x3f); o -= 19; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_21_6[y]; v[i].neg = recode_neg_21_6[y]; carry = (y >> 6) + v[i].neg; @@ -38154,7 +38154,7 @@ typedef struct sp_cache_521_t { /* Precomputation table for point. */ sp_table_entry_521 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_521_t; @@ -38182,7 +38182,7 @@ static void sp_ecc_get_cache_521(const sp_point_521* g, sp_cache_521_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_521_inited == 0) { for (i=0; i> 4; v |= v >> 8; v |= v >> 16; - return sp_521_tab32_21[(uint32_t)(v*0x07C4ACDD) >> 27]; + return sp_521_tab32_21[(word32)(v*0x07C4ACDD) >> 27]; } static int sp_521_num_bits_21(const sp_digit* a) @@ -44810,7 +44810,7 @@ SP_NOINLINE static void sp_1024_mont_sqr_42(sp_digit* r, const sp_digit* a, } /* Mod-2 for the P1024 curve. */ -static const uint8_t p1024_mod_minus_2[] = { +static const word8 p1024_mod_minus_2[] = { 6,0x06, 7,0x0f, 7,0x0b, 6,0x0c, 7,0x1e, 9,0x09, 7,0x0c, 7,0x1f, 6,0x16, 6,0x06, 7,0x0e, 8,0x10, 6,0x03, 8,0x11, 6,0x0d, 7,0x14, 9,0x12, 6,0x0f, 7,0x04, 9,0x0d, 6,0x00, 7,0x13, 6,0x01, 6,0x07, @@ -46182,13 +46182,13 @@ static void sp_1024_proj_point_add_sub_42(sp_point_1024* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_1024 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_1024; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_42_7[130] = { +static const word8 recode_index_42_7[130] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -46201,7 +46201,7 @@ static const uint8_t recode_index_42_7[130] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_42_7[130] = { +static const word8 recode_neg_42_7[130] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -46223,7 +46223,7 @@ static void sp_1024_ecc_recode_7_42(const sp_digit* k, ecc_recode_1024* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -46232,7 +46232,7 @@ static void sp_1024_ecc_recode_7_42(const sp_digit* k, ecc_recode_1024* v) n = k[j]; o = 0; for (i=0; i<147; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 7 < 25) { y &= 0x7f; n >>= 7; @@ -46246,12 +46246,12 @@ static void sp_1024_ecc_recode_7_42(const sp_digit* k, ecc_recode_1024* v) } else if (++j < 42) { n = k[j]; - y |= (uint8_t)((n << (25 - o)) & 0x7f); + y |= (word8)((n << (25 - o)) & 0x7f); o -= 18; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_42_7[y]; v[i].neg = recode_neg_42_7[y]; carry = (y >> 7) + v[i].neg; @@ -46714,7 +46714,7 @@ typedef struct sp_cache_1024_t { /* Precomputation table for point. */ sp_table_entry_1024 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_1024_t; @@ -46742,7 +46742,7 @@ static void sp_ecc_get_cache_1024(const sp_point_1024* g, sp_cache_1024_t** cach { int i; int j; - uint32_t least; + word32 least; if (sp_cache_1024_inited == 0) { for (i=0; i>= 6; @@ -23377,12 +23377,12 @@ static void sp_256_ecc_recode_6_5(const sp_digit* k, ecc_recode_256* v) } else if (++j < 5) { n = k[j]; - y |= (uint8_t)((n << (52 - o)) & 0x3f); + y |= (word8)((n << (52 - o)) & 0x3f); o -= 46; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_5_6[y]; v[i].neg = recode_neg_5_6[y]; carry = (y >> 6) + v[i].neg; @@ -23942,7 +23942,7 @@ typedef struct sp_cache_256_t { /* Precomputation table for point. */ sp_table_entry_256 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_256_t; @@ -23970,7 +23970,7 @@ static void sp_ecc_get_cache_256(const sp_point_256* g, sp_cache_256_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_256_inited == 0) { for (i=0; i> 8; v |= v >> 16; v |= v >> 32; - return sp_256_tab64_5[((uint64_t)((v - (v >> 1))*0x07EDD5E59A4E28C2)) >> 58]; + return sp_256_tab64_5[((word64)((v - (v >> 1))*0x07EDD5E59A4E28C2)) >> 58]; } static int sp_256_num_bits_5(const sp_digit* a) @@ -30257,13 +30257,13 @@ static void sp_384_proj_point_add_sub_7(sp_point_384* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_384 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_384; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_7_6[66] = { +static const word8 recode_index_7_6[66] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, @@ -30272,7 +30272,7 @@ static const uint8_t recode_index_7_6[66] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_7_6[66] = { +static const word8 recode_neg_7_6[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -30290,7 +30290,7 @@ static void sp_384_ecc_recode_6_7(const sp_digit* k, ecc_recode_384* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -30299,7 +30299,7 @@ static void sp_384_ecc_recode_6_7(const sp_digit* k, ecc_recode_384* v) n = k[j]; o = 0; for (i=0; i<65; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 6 < 55) { y &= 0x3f; n >>= 6; @@ -30313,12 +30313,12 @@ static void sp_384_ecc_recode_6_7(const sp_digit* k, ecc_recode_384* v) } else if (++j < 7) { n = k[j]; - y |= (uint8_t)((n << (55 - o)) & 0x3f); + y |= (word8)((n << (55 - o)) & 0x3f); o -= 49; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_7_6[y]; v[i].neg = recode_neg_7_6[y]; carry = (y >> 6) + v[i].neg; @@ -30898,7 +30898,7 @@ typedef struct sp_cache_384_t { /* Precomputation table for point. */ sp_table_entry_384 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_384_t; @@ -30926,7 +30926,7 @@ static void sp_ecc_get_cache_384(const sp_point_384* g, sp_cache_384_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_384_inited == 0) { for (i=0; i> 8; v |= v >> 16; v |= v >> 32; - return sp_384_tab64_7[((uint64_t)((v - (v >> 1))*0x07EDD5E59A4E28C2)) >> 58]; + return sp_384_tab64_7[((word64)((v - (v >> 1))*0x07EDD5E59A4E28C2)) >> 58]; } static int sp_384_num_bits_7(const sp_digit* a) @@ -37654,13 +37654,13 @@ static void sp_521_proj_point_add_sub_9(sp_point_521* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_521 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_521; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_9_6[66] = { +static const word8 recode_index_9_6[66] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, @@ -37669,7 +37669,7 @@ static const uint8_t recode_index_9_6[66] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_9_6[66] = { +static const word8 recode_neg_9_6[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -37687,7 +37687,7 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -37696,7 +37696,7 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) n = k[j]; o = 0; for (i=0; i<87; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 6 < 58) { y &= 0x3f; n >>= 6; @@ -37710,12 +37710,12 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) } else if (++j < 9) { n = k[j]; - y |= (uint8_t)((n << (58 - o)) & 0x3f); + y |= (word8)((n << (58 - o)) & 0x3f); o -= 52; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_9_6[y]; v[i].neg = recode_neg_9_6[y]; carry = (y >> 6) + v[i].neg; @@ -38315,7 +38315,7 @@ typedef struct sp_cache_521_t { /* Precomputation table for point. */ sp_table_entry_521 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_521_t; @@ -38343,7 +38343,7 @@ static void sp_ecc_get_cache_521(const sp_point_521* g, sp_cache_521_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_521_inited == 0) { for (i=0; i> 8; v |= v >> 16; v |= v >> 32; - return sp_521_tab64_9[((uint64_t)((v - (v >> 1))*0x07EDD5E59A4E28C2)) >> 58]; + return sp_521_tab64_9[((word64)((v - (v >> 1))*0x07EDD5E59A4E28C2)) >> 58]; } static int sp_521_num_bits_9(const sp_digit* a) @@ -44236,7 +44236,7 @@ SP_NOINLINE static void sp_1024_mont_sqr_18(sp_digit* r, const sp_digit* a, } /* Mod-2 for the P1024 curve. */ -static const uint8_t p1024_mod_minus_2[] = { +static const word8 p1024_mod_minus_2[] = { 6,0x06, 7,0x0f, 7,0x0b, 6,0x0c, 7,0x1e, 9,0x09, 7,0x0c, 7,0x1f, 6,0x16, 6,0x06, 7,0x0e, 8,0x10, 6,0x03, 8,0x11, 6,0x0d, 7,0x14, 9,0x12, 6,0x0f, 7,0x04, 9,0x0d, 6,0x00, 7,0x13, 6,0x01, 6,0x07, @@ -45525,13 +45525,13 @@ static void sp_1024_proj_point_add_sub_18(sp_point_1024* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_1024 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_1024; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_18_7[130] = { +static const word8 recode_index_18_7[130] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -45544,7 +45544,7 @@ static const uint8_t recode_index_18_7[130] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_18_7[130] = { +static const word8 recode_neg_18_7[130] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -45566,7 +45566,7 @@ static void sp_1024_ecc_recode_7_18(const sp_digit* k, ecc_recode_1024* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -45575,7 +45575,7 @@ static void sp_1024_ecc_recode_7_18(const sp_digit* k, ecc_recode_1024* v) n = k[j]; o = 0; for (i=0; i<147; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 7 < 57) { y &= 0x7f; n >>= 7; @@ -45589,12 +45589,12 @@ static void sp_1024_ecc_recode_7_18(const sp_digit* k, ecc_recode_1024* v) } else if (++j < 18) { n = k[j]; - y |= (uint8_t)((n << (57 - o)) & 0x7f); + y |= (word8)((n << (57 - o)) & 0x7f); o -= 50; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_18_7[y]; v[i].neg = recode_neg_18_7[y]; carry = (y >> 7) + v[i].neg; @@ -46057,7 +46057,7 @@ typedef struct sp_cache_1024_t { /* Precomputation table for point. */ sp_table_entry_1024 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_1024_t; @@ -46085,7 +46085,7 @@ static void sp_ecc_get_cache_1024(const sp_point_1024* g, sp_cache_1024_t** cach { int i; int j; - uint32_t least; + word32 least; if (sp_cache_1024_inited == 0) { for (i=0; i>= 6; @@ -9430,12 +9430,12 @@ static void sp_256_ecc_recode_6_4(const sp_digit* k, ecc_recode_256* v) } else if (++j < 4) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x3f); + y |= (word8)((n << (64 - o)) & 0x3f); o -= 58; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_4_6[y]; v[i].neg = recode_neg_4_6[y]; carry = (y >> 6) + v[i].neg; @@ -10976,7 +10976,7 @@ typedef struct sp_cache_256_t { /* Precomputation table for point. */ sp_table_entry_256 table[64]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_256_t; @@ -11004,7 +11004,7 @@ static void sp_ecc_get_cache_256(const sp_point_256* g, sp_cache_256_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_256_inited == 0) { for (i=0; i>= 7; @@ -12105,12 +12105,12 @@ static void sp_256_ecc_recode_7_4(const sp_digit* k, ecc_recode_256* v) } else if (++j < 4) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x7f); + y |= (word8)((n << (64 - o)) & 0x7f); o -= 57; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_4_7[y]; v[i].neg = recode_neg_4_7[y]; carry = (y >> 7) + v[i].neg; @@ -28535,13 +28535,13 @@ static void sp_384_proj_point_add_sub_6(sp_point_384* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_384 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_384; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_6_6[66] = { +static const word8 recode_index_6_6[66] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, @@ -28550,7 +28550,7 @@ static const uint8_t recode_index_6_6[66] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_6_6[66] = { +static const word8 recode_neg_6_6[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -28568,7 +28568,7 @@ static void sp_384_ecc_recode_6_6(const sp_digit* k, ecc_recode_384* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -28577,7 +28577,7 @@ static void sp_384_ecc_recode_6_6(const sp_digit* k, ecc_recode_384* v) n = k[j]; o = 0; for (i=0; i<65; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 6 < 64) { y &= 0x3f; n >>= 6; @@ -28591,12 +28591,12 @@ static void sp_384_ecc_recode_6_6(const sp_digit* k, ecc_recode_384* v) } else if (++j < 6) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x3f); + y |= (word8)((n << (64 - o)) & 0x3f); o -= 58; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_6_6[y]; v[i].neg = recode_neg_6_6[y]; carry = (y >> 6) + v[i].neg; @@ -30193,7 +30193,7 @@ typedef struct sp_cache_384_t { /* Precomputation table for point. */ sp_table_entry_384 table[64]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_384_t; @@ -30221,7 +30221,7 @@ static void sp_ecc_get_cache_384(const sp_point_384* g, sp_cache_384_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_384_inited == 0) { for (i=0; i>= 7; @@ -31325,12 +31325,12 @@ static void sp_384_ecc_recode_7_6(const sp_digit* k, ecc_recode_384* v) } else if (++j < 6) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x7f); + y |= (word8)((n << (64 - o)) & 0x7f); o -= 57; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_6_7[y]; v[i].neg = recode_neg_6_7[y]; carry = (y >> 7) + v[i].neg; @@ -53465,13 +53465,13 @@ static void sp_521_proj_point_add_sub_9(sp_point_521* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_521 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_521; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_9_6[66] = { +static const word8 recode_index_9_6[66] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, @@ -53480,7 +53480,7 @@ static const uint8_t recode_index_9_6[66] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_9_6[66] = { +static const word8 recode_neg_9_6[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -53498,7 +53498,7 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -53507,7 +53507,7 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) n = k[j]; o = 0; for (i=0; i<87; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 6 < 64) { y &= 0x3f; n >>= 6; @@ -53521,12 +53521,12 @@ static void sp_521_ecc_recode_6_9(const sp_digit* k, ecc_recode_521* v) } else if (++j < 9) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x3f); + y |= (word8)((n << (64 - o)) & 0x3f); o -= 58; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_9_6[y]; v[i].neg = recode_neg_9_6[y]; carry = (y >> 6) + v[i].neg; @@ -55100,7 +55100,7 @@ typedef struct sp_cache_521_t { /* Precomputation table for point. */ sp_table_entry_521 table[64]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_521_t; @@ -55128,7 +55128,7 @@ static void sp_ecc_get_cache_521(const sp_point_521* g, sp_cache_521_t** cache) { int i; int j; - uint32_t least; + word32 least; if (sp_cache_521_inited == 0) { for (i=0; i>= 7; @@ -56358,12 +56358,12 @@ static void sp_521_ecc_recode_7_9(const sp_digit* k, ecc_recode_521* v) } else if (++j < 9) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x7f); + y |= (word8)((n << (64 - o)) & 0x7f); o -= 57; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_9_7[y]; v[i].neg = recode_neg_9_7[y]; carry = (y >> 7) + v[i].neg; @@ -93842,7 +93842,7 @@ SP_NOINLINE static void sp_1024_mont_sqr_16(sp_digit* r, const sp_digit* a, } /* Mod-2 for the P1024 curve. */ -static const uint8_t p1024_mod_minus_2[] = { +static const word8 p1024_mod_minus_2[] = { 6,0x06, 7,0x0f, 7,0x0b, 6,0x0c, 7,0x1e, 9,0x09, 7,0x0c, 7,0x1f, 6,0x16, 6,0x06, 7,0x0e, 8,0x10, 6,0x03, 8,0x11, 6,0x0d, 7,0x14, 9,0x12, 6,0x0f, 7,0x04, 9,0x0d, 6,0x00, 7,0x13, 6,0x01, 6,0x07, @@ -94751,13 +94751,13 @@ static void sp_1024_proj_point_add_sub_16(sp_point_1024* ra, /* Structure used to describe recoding of scalar multiplication. */ typedef struct ecc_recode_1024 { /* Index into pre-computation table. */ - uint8_t i; + word8 i; /* Use the negative of the point. */ - uint8_t neg; + word8 neg; } ecc_recode_1024; /* The index into pre-computation table to use. */ -static const uint8_t recode_index_16_7[130] = { +static const word8 recode_index_16_7[130] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -94770,7 +94770,7 @@ static const uint8_t recode_index_16_7[130] = { }; /* Whether to negate y-ordinate. */ -static const uint8_t recode_neg_16_7[130] = { +static const word8 recode_neg_16_7[130] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -94792,7 +94792,7 @@ static void sp_1024_ecc_recode_7_16(const sp_digit* k, ecc_recode_1024* v) { int i; int j; - uint8_t y; + word8 y; int carry = 0; int o; sp_digit n; @@ -94801,7 +94801,7 @@ static void sp_1024_ecc_recode_7_16(const sp_digit* k, ecc_recode_1024* v) n = k[j]; o = 0; for (i=0; i<147; i++) { - y = (uint8_t)(int8_t)n; + y = (word8)(int8_t)n; if (o + 7 < 64) { y &= 0x7f; n >>= 7; @@ -94815,12 +94815,12 @@ static void sp_1024_ecc_recode_7_16(const sp_digit* k, ecc_recode_1024* v) } else if (++j < 16) { n = k[j]; - y |= (uint8_t)((n << (64 - o)) & 0x7f); + y |= (word8)((n << (64 - o)) & 0x7f); o -= 57; n >>= o; } - y += (uint8_t)carry; + y += (word8)carry; v[i].i = recode_index_16_7[y]; v[i].neg = recode_neg_16_7[y]; carry = (y >> 7) + v[i].neg; @@ -96329,7 +96329,7 @@ typedef struct sp_cache_1024_t { /* Precomputation table for point. */ sp_table_entry_1024 table[256]; /* Count of entries in table. */ - uint32_t cnt; + word32 cnt; /* Point and table set in entry. */ int set; } sp_cache_1024_t; @@ -96357,7 +96357,7 @@ static void sp_ecc_get_cache_1024(const sp_point_1024* g, sp_cache_1024_t** cach { int i; int j; - uint32_t least; + word32 least; if (sp_cache_1024_inited == 0) { for (i=0; i