View | Details | Raw Unified | Return to bug 2474 | Differences between
and this patch

Collapse All | Expand All

(-)openssh-7.6p1/ssh-pkcs11.c.old (-7 / +22 lines)
Lines 917-929 pkcs11_fetch_keys_filter(struct pkcs11_p Link Here
917
			} else if (d2i_X509(&x509, &cp, attribs[3].ulValueLen)
917
			} else if (d2i_X509(&x509, &cp, attribs[3].ulValueLen)
918
			    == NULL) {
918
			    == NULL) {
919
				error("d2i_X509 failed");
919
				error("d2i_X509 failed");
920
			} else if ((evp = X509_get_pubkey(x509)) == NULL ||
920
			} else if ((evp = X509_get_pubkey(x509)) == NULL) {
921
			    evp->type != EVP_PKEY_RSA ||
921
				debug("X509_get_pubkey failed");
922
			    evp->pkey.rsa == NULL) {
922
			} else {
923
				debug("X509_get_pubkey failed or no rsa");
923
				switch (evp->type) {
924
			} else if ((rsa = RSAPublicKey_dup(evp->pkey.rsa))
924
				case EVP_PKEY_RSA:
925
			    == NULL) {
925
					if (evp->pkey.rsa == NULL)
926
				error("RSAPublicKey_dup");
926
						debug("Missing RSA key");
927
					else if ((rsa = RSAPublicKey_dup(
928
					    evp->pkey.rsa)) == NULL)
929
						error("RSAPublicKey_dup failed");
930
					break;
931
				case EVP_PKEY_EC:
932
					if (evp->pkey.ecdsa == NULL)
933
						debug("Missing ECDSA key");
934
					else if ((ecdsa = EC_KEY_dup(
935
					    evp->pkey.ecdsa)) == NULL)
936
						error("EC_KEY_dup failed");
937
					break;
938
				default:
939
					debug("not a RSA or ECDSA key");
940
					break;
941
				}
927
			}
942
			}
928
			if (x509)
943
			if (x509)
929
				X509_free(x509);
944
				X509_free(x509);

Return to bug 2474