Fix ECC algorithms unused constants in PKCS#11 build
This commit is contained in:
@@ -432,10 +432,10 @@ main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case key_ecx:
|
case key_ecx:
|
||||||
#ifndef CKM_EDDSA_KEY_PAIR_GEN
|
#if !defined(CKM_EDDSA_KEY_PAIR_GEN)
|
||||||
fprintf(stderr, "CKM_EDDSA_KEY_PAIR_GEN is not defined\n");
|
fprintf(stderr, "CKM_EDDSA_KEY_PAIR_GEN is not defined\n");
|
||||||
usage();
|
usage();
|
||||||
#endif
|
#else
|
||||||
op_type = OP_EC;
|
op_type = OP_EC;
|
||||||
if (bits == 0)
|
if (bits == 0)
|
||||||
bits = 256;
|
bits = 256;
|
||||||
@@ -454,16 +454,27 @@ main(int argc, char *argv[]) {
|
|||||||
id_offset = ECC_ID;
|
id_offset = ECC_ID;
|
||||||
|
|
||||||
if (bits == 256) {
|
if (bits == 256) {
|
||||||
|
#if HAVE_PKCS11_ED25519
|
||||||
public_template[4].pValue = pk11_ecc_ed25519;
|
public_template[4].pValue = pk11_ecc_ed25519;
|
||||||
public_template[4].ulValueLen =
|
public_template[4].ulValueLen =
|
||||||
sizeof(pk11_ecc_ed25519);
|
sizeof(pk11_ecc_ed25519);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "Ed25519 is not supported\n");
|
||||||
|
usage();
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#if HAVE_PKCS11_ED448
|
||||||
public_template[4].pValue = pk11_ecc_ed448;
|
public_template[4].pValue = pk11_ecc_ed448;
|
||||||
public_template[4].ulValueLen =
|
public_template[4].ulValueLen =
|
||||||
sizeof(pk11_ecc_ed448);
|
sizeof(pk11_ecc_ed448);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "Ed449 is not supported\n");
|
||||||
|
usage();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
#endif /* !defined(CKM_EDDSA_KEY_PAIR_GEN) */
|
||||||
case key_dsa:
|
case key_dsa:
|
||||||
op_type = OP_DSA;
|
op_type = OP_DSA;
|
||||||
if (bits == 0)
|
if (bits == 0)
|
||||||
|
|||||||
@@ -19,19 +19,25 @@
|
|||||||
* Static arrays of data used for key template initalization
|
* Static arrays of data used for key template initalization
|
||||||
*/
|
*/
|
||||||
#ifdef WANT_ECC_CURVES
|
#ifdef WANT_ECC_CURVES
|
||||||
|
#if HAVE_PKCS11_ECDSA
|
||||||
static CK_BYTE pk11_ecc_prime256v1[] = {
|
static CK_BYTE pk11_ecc_prime256v1[] = {
|
||||||
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07
|
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07
|
||||||
};
|
};
|
||||||
static CK_BYTE pk11_ecc_secp384r1[] = {
|
static CK_BYTE pk11_ecc_secp384r1[] = {
|
||||||
0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22
|
0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22
|
||||||
};
|
};
|
||||||
|
#endif /* HAVE_PKCS11_ECDSA */
|
||||||
|
#if HAVE_PKCS11_ED25519
|
||||||
static CK_BYTE pk11_ecc_ed25519[] = {
|
static CK_BYTE pk11_ecc_ed25519[] = {
|
||||||
0x06, 0x03, 0x2b, 0x65, 0x70
|
0x06, 0x03, 0x2b, 0x65, 0x70
|
||||||
};
|
};
|
||||||
|
#endif /* HAVE_PKCS11_ED25519 */
|
||||||
|
#if HAVE_PKCS11_ED448
|
||||||
static CK_BYTE pk11_ecc_ed448[] = {
|
static CK_BYTE pk11_ecc_ed448[] = {
|
||||||
0x06, 0x03, 0x2b, 0x65, 0x71
|
0x06, 0x03, 0x2b, 0x65, 0x71
|
||||||
};
|
};
|
||||||
#endif
|
#endif /* HAVE_PKCS11_ED448 */
|
||||||
|
#endif /* WANT_ECC_CURVES */
|
||||||
|
|
||||||
#ifdef WANT_DH_PRIMES
|
#ifdef WANT_DH_PRIMES
|
||||||
static CK_BYTE pk11_dh_bn2[] = { 2 };
|
static CK_BYTE pk11_dh_bn2[] = { 2 };
|
||||||
|
|||||||
Reference in New Issue
Block a user