Re: [PATCH v2.2 2/7] crypto: GnuPG based MPI lib - header files (part 2)

From: Kasatkin, Dmitry
Date: Thu Mar 22 2012 - 04:21:49 EST


On Wed, Mar 21, 2012 at 10:39 AM, Geert Uytterhoeven
<geert@xxxxxxxxxxxxxx> wrote:
> Ping?
>
> On Sun, Mar 11, 2012 at 10:55, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>> On Wed, 19 Oct 2011, Dmitry Kasatkin wrote:
>>> Adds the multi-precision-integer maths library which was originally taken
>>> from GnuPG and ported to the kernel by (among others) David Howells.
>>> This version is taken from Fedora kernel 2.6.32-71.14.1.el6.
>>> The difference is that checkpatch reported errors and warnings have been fixed.
>>>
>>> This library is used to implemenet RSA digital signature verification
>>> used in IMA/EVM integrity protection subsystem.
>>
>>> --- /dev/null
>>> +++ b/lib/mpi/longlong.h
>>
>>> + Â Â /* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. Â*/
>>> +#if !defined(udiv_qrnnd)
>>> +#define UDIV_NEEDS_NORMALIZATION 1
>>> +#define udiv_qrnnd __udiv_qrnnd_c
>>> +#endif
>>> +
>>> +#undef count_leading_zeros
>>
>> Why is this #undef here? It's not present in mpi/longlong.h from Ubuntu's
>> gnupg-1.4.10, and causing ...
>>
>>> +#if !defined(count_leading_zeros)
>>> + Â Â extern
>>> +#ifdef __STDC__
>>> + Â Â Â Â Â Â Â Â Â Â const
>>> +#endif
>>> + Â Â Â Â Â Â Â Â Â Â unsigned char __clz_tab[];
>>> +#define count_leading_zeros(count, x) \
>>> +do { \
>>> + Â Â UWtype __xr = (x); \
>>> + Â Â UWtype __a; \
>>> + Â Â \
>>> + Â Â if (W_TYPE_SIZE <= 32) { \
>>> + Â Â Â Â Â Â __a = __xr < ((UWtype) 1 << 2*__BITS4) \
>>> + Â Â Â Â Â Â ? (__xr < ((UWtype) 1 << __BITS4) ? 0 : __BITS4) \
>>> + Â Â Â Â Â Â : (__xr < ((UWtype) 1 << 3*__BITS4) ? Â2*__BITS4 : 3*__BITS4); \
>>> + Â Â } \
>>> + Â Â else { \
>>> + Â Â Â Â Â Â for (__a = W_TYPE_SIZE - 8; __a > 0; __a -= 8) \
>>> + Â Â Â Â Â Â Â Â Â Â if (((__xr >> __a) & 0xff) != 0) \
>>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; \
>>> + Â Â } \
>>> + Â Â \
>>> + Â Â (count) = W_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a); \
>>> +} while (0)
>>> + Â Â /* This version gives a well-defined value for zero. */
>>> +#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE
>>
>> lib/mpi/longlong.h:1483:1: warning: "COUNT_LEADING_ZEROS_0" redefined
>> lib/mpi/longlong.h:610:1: warning: this is the location of the previous definition
>>
>> on m68k/allmodconfig.
>>
>> I'm also wondering why this warning is not seen on other arches, e.g. PPC
>> #defines COUNT_LEADING_ZEROS_0 to 32, just like m68k.
>>
>>> +#endif
>>
>> I suppose the plan is to clean up this header file, as lots of its
>> functionality is already present in the kernel sources in some other way
>> (e.g. arch/m68k/lib/muldi3.c)?
>
> Gr{oetje,eeting}s,
>
> Â Â Â Â Â Â Â Â Â Â Â Â Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> Â Â Â Â Â Â Â Â Â Â Â Â Â ÂÂ ÂÂ -- Linus Torvalds
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
> Please read the FAQ at Âhttp://www.tux.org/lkml/

Hello,

There are things to cleanup...
It takes a bit of time.

- Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/