Re: [RFC][PATCH 01/12] crypto: Remove u128 usage

Jason A. Donenfeld
2022-12-19T15:56:51Z

On Mon, Dec 19, 2022 at 04:35:26PM +0100, Peter Zijlstra wrote:
> As seems to be the common (majority) usage in crypto, use __uint128_t
> instead of u128.
>
> This frees up u128 for definition in linux/types.h.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> lib/crypto/curve25519-hacl64.c | 142 ++++++++++++++++++++---------------------
> lib/crypto/poly1305-donna64.c | 22 ++----
> 2 files changed, 80 insertions(+), 84 deletions(-)
>
> --- a/lib/crypto/curve25519-hacl64.c
> +++ b/lib/crypto/curve25519-hacl64.c
> @@ -14,8 +14,6 @@
> #include <crypto/curve25519.h>
> #include <linux/string.h>
>
> -typedef __uint128_t u128;
> -
> static __always_inline u64 u64_eq_mask(u64 a, u64 b)
> {
> u64 x = a ^ b;
> @@ -50,77 +48,77 @@ static __always_inline void modulo_carry
> b[0] = b0_;
> }
>
> -static __always_inline void fproduct_copy_from_wide_(u64 *output, u128 *input)
> +static __always_inline void fproduct_copy_from_wide_(u64 *output, __uint128_t *input)
> {
> {
> - u128 xi = input[0];
> + __uint128_t xi = input[0];

Why not just use `u128` from types.h in this file?

Jason