Do not segfault for ECC keys in PKCS#11
This commit is contained in:
parent
a464c88ee6
commit
2087929a90
@ -2594,7 +2594,7 @@ diff -up openssh/ssh-pkcs11.c.openssl openssh/ssh-pkcs11.c
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cp = attribs[2].pValue;
|
cp = attribs[2].pValue;
|
||||||
@@ -525,17 +538,18 @@ pkcs11_fetch_keys_filter(struct pkcs11_p
|
@@ -525,17 +538,19 @@ pkcs11_fetch_keys_filter(struct pkcs11_p
|
||||||
== NULL) {
|
== NULL) {
|
||||||
error("d2i_X509 failed");
|
error("d2i_X509 failed");
|
||||||
} else if ((evp = X509_get_pubkey(x509)) == NULL ||
|
} else if ((evp = X509_get_pubkey(x509)) == NULL ||
|
||||||
@ -2612,7 +2612,8 @@ diff -up openssh/ssh-pkcs11.c.openssl openssh/ssh-pkcs11.c
|
|||||||
X509_free(x509);
|
X509_free(x509);
|
||||||
}
|
}
|
||||||
- if (rsa && rsa->n && rsa->e &&
|
- if (rsa && rsa->n && rsa->e &&
|
||||||
+ RSA_get0_key(rsa, &n, &e, NULL);
|
+ if (rsa)
|
||||||
|
+ RSA_get0_key(rsa, &n, &e, NULL);
|
||||||
+ if (rsa && n && e &&
|
+ if (rsa && n && e &&
|
||||||
pkcs11_rsa_wrap(p, slotidx, &attribs[0], rsa) == 0) {
|
pkcs11_rsa_wrap(p, slotidx, &attribs[0], rsa) == 0) {
|
||||||
if ((key = sshkey_new(KEY_UNSPEC)) == NULL)
|
if ((key = sshkey_new(KEY_UNSPEC)) == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user