]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix compiler warnings about unused pk11 constants.
authorAaron Thompson <dev@aaront.org>
Tue, 31 Mar 2020 08:00:30 +0000 (08:00 +0000)
committerOndřej Surý <ondrej@isc.org>
Mon, 20 Apr 2020 09:40:41 +0000 (11:40 +0200)
bin/pkcs11/pkcs11-keygen.c
lib/dns/pkcs11ecdsa_link.c
lib/dns/pkcs11eddsa_link.c
lib/isc/include/pk11/constants.h

index 706ee0862ed30eefdec021763503b3e9a0ee7645..120bc62d4645aedc57d31ea133ad3a9aa57d7120 100644 (file)
@@ -67,6 +67,8 @@
 #include <isc/types.h>
 #include <isc/util.h>
 
+#define WANT_ECC_CURVES
+#define WANT_ECX_CURVES
 #include <pk11/constants.h>
 #include <pk11/pk11.h>
 #include <pk11/result.h>
@@ -351,12 +353,12 @@ main(int argc, char *argv[]) {
                id_offset = ECC_ID;
 
                if (bits == 256) {
-                       public_template[4].pValue = pk11_ecc_ed25519;
+                       public_template[4].pValue = pk11_ecx_ed25519;
                        public_template[4].ulValueLen =
-                               sizeof(pk11_ecc_ed25519);
+                               sizeof(pk11_ecx_ed25519);
                } else {
-                       public_template[4].pValue = pk11_ecc_ed448;
-                       public_template[4].ulValueLen = sizeof(pk11_ecc_ed448);
+                       public_template[4].pValue = pk11_ecx_ed448;
+                       public_template[4].ulValueLen = sizeof(pk11_ecx_ed448);
                }
 
 #endif /* ifndef CKM_EDDSA_KEY_PAIR_GEN */
index d6160aa414284dcc9e0ac531fe0ed124492e3771..ba833e3cfb275163687dc3c4a33cb287cf56cf03 100644 (file)
@@ -20,6 +20,7 @@
 #include <isc/string.h>
 #include <isc/util.h>
 
+#define WANT_ECC_CURVES
 #include <pk11/constants.h>
 #include <pk11/internal.h>
 #include <pk11/pk11.h>
index 39df97ccbfc5a73d5c49ab955e3587342d3af02f..d52c6822b33ec5dbf21d26cbdb5011800b55cf76 100644 (file)
@@ -20,6 +20,7 @@
 #include <isc/string.h>
 #include <isc/util.h>
 
+#define WANT_ECX_CURVES
 #include <pk11/constants.h>
 #include <pk11/internal.h>
 #include <pk11/pk11.h>
@@ -399,16 +400,16 @@ pkcs11eddsa_compare(const dst_key_t *key1, const dst_key_t *key2) {
 #define SETCURVE()                                                             \
        if (key->key_alg == DST_ALG_ED25519) {                                 \
                attr->pValue = isc_mem_get(key->mctx,                          \
-                                          sizeof(pk11_ecc_ed25519));          \
+                                          sizeof(pk11_ecx_ed25519));          \
                                                                                \
-               memmove(attr->pValue, pk11_ecc_ed25519,                        \
-                       sizeof(pk11_ecc_ed25519));                             \
-               attr->ulValueLen = sizeof(pk11_ecc_ed25519);                   \
+               memmove(attr->pValue, pk11_ecx_ed25519,                        \
+                       sizeof(pk11_ecx_ed25519));                             \
+               attr->ulValueLen = sizeof(pk11_ecx_ed25519);                   \
        } else {                                                               \
-               attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecc_ed448)); \
+               attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecx_ed448)); \
                                                                                \
-               memmove(attr->pValue, pk11_ecc_ed448, sizeof(pk11_ecc_ed448)); \
-               attr->ulValueLen = sizeof(pk11_ecc_ed448);                     \
+               memmove(attr->pValue, pk11_ecx_ed448, sizeof(pk11_ecx_ed448)); \
+               attr->ulValueLen = sizeof(pk11_ecx_ed448);                     \
        }
 
 #define FREECURVE()                                                     \
@@ -639,14 +640,14 @@ pkcs11eddsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
        attr = ec->repr;
        attr->type = CKA_EC_PARAMS;
        if (key->key_alg == DST_ALG_ED25519) {
-               attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecc_ed25519));
-               memmove(attr->pValue, pk11_ecc_ed25519,
-                       sizeof(pk11_ecc_ed25519));
-               attr->ulValueLen = sizeof(pk11_ecc_ed25519);
+               attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecx_ed25519));
+               memmove(attr->pValue, pk11_ecx_ed25519,
+                       sizeof(pk11_ecx_ed25519));
+               attr->ulValueLen = sizeof(pk11_ecx_ed25519);
        } else {
-               attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecc_ed448));
-               memmove(attr->pValue, pk11_ecc_ed448, sizeof(pk11_ecc_ed448));
-               attr->ulValueLen = sizeof(pk11_ecc_ed448);
+               attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecx_ed448));
+               memmove(attr->pValue, pk11_ecx_ed448, sizeof(pk11_ecx_ed448));
+               attr->ulValueLen = sizeof(pk11_ecx_ed448);
        }
 
        attr++;
index defc51459869c3c4ede3e51b285e53c2a8e40efe..6102a9d6186864a2ed09820063954eccc5a902a8 100644 (file)
 /*%
  * Static arrays of data used for key template initialization
  */
+#ifdef WANT_ECC_CURVES
 static CK_BYTE pk11_ecc_prime256v1[] = { 0x06, 0x08, 0x2a, 0x86, 0x48,
                                         0xce, 0x3d, 0x03, 0x01, 0x07 };
 static CK_BYTE pk11_ecc_secp384r1[] = {
        0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22
 };
-static CK_BYTE pk11_ecc_ed25519[] = { 0x06, 0x03, 0x2b, 0x65, 0x70 };
-static CK_BYTE pk11_ecc_ed448[] = { 0x06, 0x03, 0x2b, 0x65, 0x71 };
+#endif /* WANT_ECC_CURVES */
+
+#ifdef WANT_ECX_CURVES
+static CK_BYTE pk11_ecx_ed25519[] = { 0x06, 0x03, 0x2b, 0x65, 0x70 };
+static CK_BYTE pk11_ecx_ed448[] = { 0x06, 0x03, 0x2b, 0x65, 0x71 };
+#endif /* WANT_ECX_CURVES */
 
 #endif /* PK11_CONSTANTS_H */