X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fx509%2Fx509_req.c;h=c67f609f07ecabbfb41dd076d5a6ce3cfd94a601;hb=99119000add47e4d1d9241f4e76f57d98439a766;hp=a2d70c013c2eb67a9269c7084b05d0c0d0d2b1d8;hpb=a9732d04fa4ace9b4d86218e0818c47c68c08d4d;p=oweals%2Fopenssl.git diff --git a/crypto/x509/x509_req.c b/crypto/x509/x509_req.c index a2d70c013c..c67f609f07 100644 --- a/crypto/x509/x509_req.c +++ b/crypto/x509/x509_req.c @@ -1,4 +1,3 @@ -/* crypto/x509/x509_req.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -92,11 +91,10 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) if (!X509_REQ_set_subject_name(ret, X509_get_subject_name(x))) goto err; - pktmp = X509_get_pubkey(x); + pktmp = X509_get0_pubkey(x); if (pktmp == NULL) goto err; i = X509_REQ_set_pubkey(ret, pktmp); - EVP_PKEY_free(pktmp); if (!i) goto err; @@ -117,6 +115,11 @@ EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req) return (X509_PUBKEY_get(req->req_info.pubkey)); } +X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req) +{ + return req->req_info.pubkey; +} + int X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k) { EVP_PKEY *xk = NULL; @@ -136,13 +139,13 @@ int X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k) break; case -2: #ifndef OPENSSL_NO_EC - if (k->type == EVP_PKEY_EC) { + if (EVP_PKEY_id(k) == EVP_PKEY_EC) { X509err(X509_F_X509_REQ_CHECK_PRIVATE_KEY, ERR_R_EC_LIB); break; } #endif #ifndef OPENSSL_NO_DH - if (k->type == EVP_PKEY_DH) { + if (EVP_PKEY_id(k) == EVP_PKEY_DH) { /* No idea */ X509err(X509_F_X509_REQ_CHECK_PRIVATE_KEY, X509_R_CANT_CHECK_DH_KEY); @@ -318,9 +321,9 @@ X509_NAME *X509_REQ_get_subject_name(X509_REQ *req) void X509_REQ_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg, X509_REQ *req) { - if (psig == NULL) + if (psig != NULL) *psig = req->signature; - if (palg == NULL) + if (palg != NULL) *palg = &req->sig_alg; }