Changes to PKCS#11 definitions

Marcus Brinkmann mb at
Tue Oct 18 14:07:14 CEST 2011

On 10/17/2011 09:01 AM, Stef Walter wrote:
> Hey Marcus,
> I've made some minor fixes to the pkcs11.h header that comes from the Scute
> project, and wanted to contribute them back as requested.
> The patch makes all the relevant constants in pkcs11.h unsigned longs rather
> than integers. This allows use of the constants in places where need the size
> to be correct (such as varargs).
> The patch is rather large, bit it just makes that one change. Let me know if I
> should prepare it differently.

I am unsure.  On the one hand, all these constants are supposed to be used for
ULONG datatypes, and thus it could be argued they should be UL.

On the other hand, the official pkcs11.h header file doesn't do that.  So, in
order to be compatible, you can not rely on it, and have to cast anyway.

The pkcs11.h file is supposed to be a drop in replacement for the official
header file (at least in CRYPTOKI_COMPAT mode).  It is true that adding the UL
would be backwards compatible, but you will then write code that can not be
backported to the official pkcs11.h without a visible indicator or compiler
warning of that.

Do we really want that?

Do you use the CRYPTOKI_COMPAT mode?


More information about the Gnupg-devel mailing list