Skip to content

Commit

Permalink
Merge pull request #8133 from SparkiDev/asm_no_uint_t
Browse files Browse the repository at this point in the history
ASM: generated code not using uint*_t types
  • Loading branch information
dgarske authored Oct 31, 2024
2 parents 89d2964 + 2631214 commit 429e7c7
Show file tree
Hide file tree
Showing 17 changed files with 665 additions and 665 deletions.
8 changes: 4 additions & 4 deletions wolfcrypt/src/port/arm/armv8-32-curve25519_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion wolfcrypt/src/port/arm/armv8-32-kyber-asm_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions wolfcrypt/src/port/arm/armv8-curve25519_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
36 changes: 18 additions & 18 deletions wolfcrypt/src/port/arm/armv8-kyber-asm_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -84,7 +84,7 @@ static const uint64_t L_sha3_aarch64_r[] = {
#include <wolfssl/wolfcrypt/wc_kyber.h>

#ifdef WOLFSSL_WC_KYBER
static const uint16_t L_kyber_aarch64_zetas[] = {
static const word16 L_kyber_aarch64_zetas[] = {
0x8ed,
0xa0b,
0xb9a,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions wolfcrypt/src/port/arm/armv8-sha3-asm_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions wolfcrypt/src/port/arm/armv8-sha512-asm_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions wolfcrypt/src/port/arm/thumb2-curve25519_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion wolfcrypt/src/port/arm/thumb2-kyber-asm_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Loading

0 comments on commit 429e7c7

Please sign in to comment.