From d8b3f393308b39e8a5b7e1587377aff9435ff754 Mon Sep 17 00:00:00 2001 From: jsing Date: Thu, 22 Feb 2018 16:50:30 +0000 Subject: [PATCH] Provide X509_REQ_get_signature_nid(). --- lib/libcrypto/Symbols.list | 1 + lib/libcrypto/asn1/x_req.c | 8 +++++++- lib/libcrypto/x509/x509.h | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 511c44cd866..fb10bdedd65 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -2791,6 +2791,7 @@ X509_REQ_get_attr_count X509_REQ_get_extension_nids X509_REQ_get_extensions X509_REQ_get_pubkey +X509_REQ_get_signature_nid X509_REQ_it X509_REQ_new X509_REQ_print diff --git a/lib/libcrypto/asn1/x_req.c b/lib/libcrypto/asn1/x_req.c index 38a6ec885cf..eb5210aef6c 100644 --- a/lib/libcrypto/asn1/x_req.c +++ b/lib/libcrypto/asn1/x_req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_req.c,v 1.16 2018/02/20 17:06:19 jsing Exp $ */ +/* $OpenBSD: x_req.c,v 1.17 2018/02/22 16:50:30 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -226,6 +226,12 @@ X509_REQ_dup(X509_REQ *x) return ASN1_item_dup(&X509_REQ_it, x); } +int +X509_REQ_get_signature_nid(const X509_REQ *req) +{ + return OBJ_obj2nid(req->sig_alg->algorithm); +} + void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, const X509_ALGOR **palg) diff --git a/lib/libcrypto/x509/x509.h b/lib/libcrypto/x509/x509.h index c7695b4663d..9033b1d4d9a 100644 --- a/lib/libcrypto/x509/x509.h +++ b/lib/libcrypto/x509/x509.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.h,v 1.33 2018/02/22 16:47:50 jsing Exp $ */ +/* $OpenBSD: x509.h,v 1.34 2018/02/22 16:50:30 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -611,6 +611,8 @@ const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, const X509_ALGOR **palg); +int X509_REQ_get_signature_nid(const X509_REQ *req); + void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, const X509_ALGOR **palg); -- 2.20.1