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] Ones Complement versus Twos Complement - RE: Use CK_UNAVAILABLE_INFORMATION


Here is a proposal for consideration:

For PKCS11 v2.40 change the current definition of:
    #define CK_UNAVAILABLE_INFORMATION (~0UL)
To the following:
    #define CK_UNAVAILABLE_INFORMATION ((CK_ULONG)-1) 

I believe this actually matches the original intent of the define - and
that allowance for a ones-complement representation of negative numbers
was simply overlooked.

If anyone is concerned that for an existing supported platform that this
will break things then run the following code through your compiler.

#include <stdio.h>

typedef unsigned long CK_ULONG;

#define oldCK_UNAVAILABLE_INFORMATION (~0UL)
#define newCK_UNAVAILABLE_INFORMATION ((CK_ULONG)-1) 

int main(int argc,char *argv[])
{
  CK_ULONG oldval=oldCK_UNAVAILABLE_INFORMATION;
  CK_ULONG newval=newCK_UNAVAILABLE_INFORMATION;

  if (oldval!=newval)
    printf("there be dragons!\n");
#if oldCK_UNAVAILABLE_INFORMATION != newCK_UNAVAILABLE_INFORMATION
  printf("there be CPP dragons!\n");
#endif

  return 0;
}





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