BIND 9.11.22 - 9.11.25 fails to build for AEP HSM native pkcs11
./configure --enable-threads --enable-native-pkcs11 --with-ecdsa -with-pkcs11=/opt/Keyper/PKCS11Provider/pkcs11.so
I think it's the --enable-native-pkcs11 AND using the AEP Keyper flavour of native pkcs11 that is setting the switch so that we fail the build
The build fail is this:
pkcs11rsa_link.c: In function 'pkcs11rsa_verify': pkcs11rsa_link.c:1081:4: error: a label can only be part of a statement and a declaration is not a statement
This is in the flavour of pkcs11rsa_verify() that is inside the else section of #ifndef PK11_RSA_PKCS_REPLACE
By my reading of /lib/isc/include/pk11/site.h, we're defining PK11_RSA_PKCS_REPLACE if we're working with an AEP pkcs11 set of libs (but not apparently for anything else).
Here's the offending bit of code in
/lib/dns/pkcs11rsa_link.c (the define for 'bits' was added by issue #2037 (closed) )
case CKA_PUBLIC_EXPONENT: unsigned int bits; INSIST(keyTemplate.type == attr->type);
From what I'm reading about this compiler error, the problem is that the C language standard says that labels can only be followed by statements. What we've got here is a declarations - and that's not perceived as a statement in C.
Apparently, the workaround is to add an empty statement - it's been suggested that comment after the label will do the trick (though I am not in a position to verify that) - but if yes, then this should work:
case CKA_PUBLIC_EXPONENT: /* Empty statement to make compiler happy */ unsigned int bits; INSIST(keyTemplate.type == attr->type);
Please can someone look at this soonest!