On 3/8/24 03:41, Lukas Wunner wrote:
> On Wed, Mar 06, 2024 at 05:22:46PM -0500, Stefan Berger wrote:
>> +static inline void ecc_digits_from_bytes(const u8 *in, unsigned int nbytes,
>> + u64 *out, unsigned int ndigits)
>> +{
>> + unsigned int o = nbytes & 7;
>> + u64 msd = 0;
>
> My sincere apologies, I made a mistake when I proposed this:
> It needs to be __be64 instead of u64...
>
>> +
>> + if (o) {
>> + memcpy((u8 *)&msd + sizeof(msd) - o, in, o);
>> + out[--ndigits] = be64_to_cpu(msd);
>> + in += o;
>> + }
>
> ...otherwise sparse complains:
>
> crypto/ecdsa.c: note: in included file:
> >> include/crypto/internal/ecc.h:74:34: sparse: sparse: cast to restricted __be64
> >> include/crypto/internal/ecc.h:74:34: sparse: sparse: cast to restricted __be64
> [...]
> 66 static inline void ecc_digits_from_bytes(const u8 *in, unsigned int nbytes,
> 67 u64 *out, unsigned int ndigits)
> 68 {
> 69 unsigned int o = nbytes & 7;
> 70 u64 msd = 0;
> 71
> 72 if (o) {
> 73 memcpy((u8 *)&msd + sizeof(msd) - o, in, o);
> > 74 out[--ndigits] = be64_to_cpu(msd);
> 75 in += o;
> 76 }
> 77 ecc_swap_digits(in, out, ndigits);
> 78 }
> 79
>
> 0-day alerted me about this, it's monitoring my GitHub repo and
> I've got your patches on one of my development branches.
Thanks. Fixed.
>
> Thanks,
>
> Lukas
>