OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

pkcs11 message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [pkcs11] Proposal: All constants should have UL suffix

On Tue, May 28, 2013 at 2:12 AM, Stef Walter <stefw@redhat.com> wrote:
> All numeric constants in the specification section "A. Manifest
> Constants" should have the suffix 'UL' on them. This allows the code
> like this to return the correct result:
>   sizeof(CKO_DATA)
> Among other things, it also allows the constants to be passed correctly
> to C varargs functions.
> Since all document edits for this would be tedious. I'll just give a few
> examples:
> - #define CKU_SO         0
> + #define CKU_SO         0UL
> and
> - #define CKA_CLASS      0x00000000
> + #define CKA_CLASS      0x00000000UL
> Above applies to every constant in the specification section "A.
> Manifest Constants" as well obviously as the reference headers.

Hi Stef,

I think this proposal is a fine idea. To help us review this proposal,
you need to point out that the manifest constants in question are all
intended for types defined as CK_ULONG. For example, CKO_DATA,
CKO_CERTIFICATE, etc. are for the CK_OBJECT_CLASS type, which is
defined as CK_ULONG.

This fact was not evident to me (although I suspected it is true), so
I had to check the type definitions to convince myself.

A near counter example is the manifest constants CK_TRUE and CK_FALSE,
which I believe are intended for the CK_BBOOL type, but CK_BBOOL is
not defined as CK_ULONG. Since CK_TRUE and CK_FALSE are not listed in
the specification section "A. Manifest Constants", your proposal is
still accurate, but if you can provide such additional information,
it'll make the review easier.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]