Skip to content

Commit cd93731

Browse files
committed
Add OPENSSL_NO_EC guards and adjust ECDSA stub signature
1 parent 545a323 commit cd93731

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

src/libp11-int.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,11 @@ extern int pkcs11_rsa_keygen(PKCS11_SLOT_private *tpriv,
338338
unsigned int bits, const char *label, const unsigned char *id,
339339
size_t id_len, const PKCS11_params *params);
340340

341+
#ifndef OPENSSL_NO_EC
341342
extern int pkcs11_ec_keygen(PKCS11_SLOT_private *tpriv,
342343
const char *curve , const char *label, const unsigned char *id,
343344
size_t id_len, const PKCS11_params *params);
345+
#endif /* OPENSSL_NO_EC */
344346

345347
/* Get the RSA key modulus size (in bytes) */
346348
extern int pkcs11_get_key_size(PKCS11_OBJECT_private *);

src/p11_ec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ PKCS11_OBJECT_ops pkcs11_ec_ops = {
907907
* require further changes */
908908
#warning "ECDSA support not built with libp11"
909909

910-
ECDSA_METHOD *PKCS11_get_ecdsa_method(void)
910+
void *PKCS11_get_ecdsa_method(void)
911911
{
912912
return NULL;
913913
}

src/p11_front.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,11 @@ int PKCS11_keygen(PKCS11_TOKEN *token, PKCS11_KGEN_ATTRS *kg)
420420
case EVP_PKEY_RSA:
421421
return pkcs11_rsa_keygen(slot, kg->kgen.rsa->bits,
422422
kg->key_label, kg->key_id, kg->id_len, kg->key_params);
423+
#ifndef OPENSSL_NO_EC
423424
case EVP_PKEY_EC:
424425
return pkcs11_ec_keygen(slot, kg->kgen.ec->curve,
425426
kg->key_label, kg->key_id, kg->id_len, kg->key_params);
427+
#endif /* OPENSSL_NO_EC */
426428
default:
427429
return -1;
428430
}

src/p11_key.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ int pkcs11_rsa_keygen(PKCS11_SLOT_private *slot, unsigned int bits,
322322
return 0;
323323
}
324324

325+
#ifndef OPENSSL_NO_EC
326+
325327
/**
326328
* Generate EC key pair directly on token
327329
*/
@@ -400,6 +402,8 @@ int pkcs11_ec_keygen(PKCS11_SLOT_private *slot, const char *curve,
400402
return 0;
401403
}
402404

405+
#endif /* OPENSSL_NO_EC */
406+
403407
/*
404408
* Store a private key on the token
405409
*/

tests/dup-key.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ int main(int argc, char *argv[])
5858
{
5959
ENGINE *engine = NULL;
6060
EVP_PKEY *pkey = NULL;
61+
#ifndef OPENSSL_NO_EC
6162
EC_KEY *ec = NULL, *ec_dup = NULL;
63+
#endif /* OPENSSL_NO_EC */
6264

6365
const char *module, *efile, *privkey;
6466

@@ -138,6 +140,7 @@ int main(int argc, char *argv[])
138140
case EVP_PKEY_RSA:
139141
/* TODO */
140142
break;
143+
#ifndef OPENSSL_NO_EC
141144
case EVP_PKEY_EC:
142145
ec = EVP_PKEY_get1_EC_KEY(pkey);
143146
if (ec == NULL) {
@@ -157,6 +160,7 @@ int main(int argc, char *argv[])
157160
EC_KEY_free(ec);
158161
EC_KEY_free(ec_dup);
159162
break;
163+
#endif /* OPENSSL_NO_EC */
160164
}
161165

162166
EVP_PKEY_free(pkey);

0 commit comments

Comments
 (0)