Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/libp11-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,11 @@ extern int pkcs11_rsa_keygen(PKCS11_SLOT_private *tpriv,
unsigned int bits, const char *label, const unsigned char *id,
size_t id_len, const PKCS11_params *params);

#ifndef OPENSSL_NO_EC
extern int pkcs11_ec_keygen(PKCS11_SLOT_private *tpriv,
const char *curve , const char *label, const unsigned char *id,
size_t id_len, const PKCS11_params *params);
#endif /* OPENSSL_NO_EC */

/* Get the RSA key modulus size (in bytes) */
extern int pkcs11_get_key_size(PKCS11_OBJECT_private *);
Expand Down
2 changes: 1 addition & 1 deletion src/p11_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ PKCS11_OBJECT_ops pkcs11_ec_ops = {
* require further changes */
#warning "ECDSA support not built with libp11"

ECDSA_METHOD *PKCS11_get_ecdsa_method(void)
void *PKCS11_get_ecdsa_method(void)
{
return NULL;
}
Expand Down
2 changes: 2 additions & 0 deletions src/p11_front.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,11 @@ int PKCS11_keygen(PKCS11_TOKEN *token, PKCS11_KGEN_ATTRS *kg)
case EVP_PKEY_RSA:
return pkcs11_rsa_keygen(slot, kg->kgen.rsa->bits,
kg->key_label, kg->key_id, kg->id_len, kg->key_params);
#ifndef OPENSSL_NO_EC
case EVP_PKEY_EC:
return pkcs11_ec_keygen(slot, kg->kgen.ec->curve,
kg->key_label, kg->key_id, kg->id_len, kg->key_params);
#endif /* OPENSSL_NO_EC */
default:
return -1;
}
Expand Down
4 changes: 4 additions & 0 deletions src/p11_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ int pkcs11_rsa_keygen(PKCS11_SLOT_private *slot, unsigned int bits,
return 0;
}

#ifndef OPENSSL_NO_EC

/**
* Generate EC key pair directly on token
*/
Expand Down Expand Up @@ -400,6 +402,8 @@ int pkcs11_ec_keygen(PKCS11_SLOT_private *slot, const char *curve,
return 0;
}

#endif /* OPENSSL_NO_EC */

/*
* Store a private key on the token
*/
Expand Down
4 changes: 4 additions & 0 deletions tests/dup-key.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ int main(int argc, char *argv[])
{
ENGINE *engine = NULL;
EVP_PKEY *pkey = NULL;
#ifndef OPENSSL_NO_EC
EC_KEY *ec = NULL, *ec_dup = NULL;
#endif /* OPENSSL_NO_EC */

const char *module, *efile, *privkey;

Expand Down Expand Up @@ -138,6 +140,7 @@ int main(int argc, char *argv[])
case EVP_PKEY_RSA:
/* TODO */
break;
#ifndef OPENSSL_NO_EC
case EVP_PKEY_EC:
ec = EVP_PKEY_get1_EC_KEY(pkey);
if (ec == NULL) {
Expand All @@ -157,6 +160,7 @@ int main(int argc, char *argv[])
EC_KEY_free(ec);
EC_KEY_free(ec_dup);
break;
#endif /* OPENSSL_NO_EC */
}

EVP_PKEY_free(pkey);
Expand Down