New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add OCSP_resp_get1_id() accessor #1876
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
#include <stdio.h> | ||
#include <time.h> | ||
#include "internal/cryptlib.h" | ||
#include <openssl/asn1.h> | ||
#include <openssl/objects.h> | ||
#include <openssl/x509.h> | ||
#include <openssl/pem.h> | ||
|
@@ -199,9 +200,9 @@ const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs) | |
int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, | ||
const ASN1_OCTET_STRING **pid, | ||
const X509_NAME **pname) | ||
|
||
{ | ||
const OCSP_RESPID *rid = &bs->tbsResponseData.responderId; | ||
|
||
if (rid->type == V_OCSP_RESPID_NAME) { | ||
*pname = rid->value.byName; | ||
*pid = NULL; | ||
|
@@ -214,6 +215,26 @@ int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, | |
return 1; | ||
} | ||
|
||
int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, | ||
ASN1_OCTET_STRING **pid, | ||
X509_NAME **pname) | ||
{ | ||
const OCSP_RESPID *rid = &bs->tbsResponseData.responderId; | ||
|
||
if (rid->type == V_OCSP_RESPID_NAME) { | ||
*pname = X509_NAME_dup(rid->value.byName); | ||
*pid = NULL; | ||
} else if (rid->type == V_OCSP_RESPID_KEY) { | ||
*pid = ASN1_OCTET_STRING_dup(rid->value.byKey); | ||
*pname = NULL; | ||
} else { | ||
return 0; | ||
} | ||
if (pname == NULL && pid == NULL) | ||
return 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking for NULLness of arguments seems quite late (and pointless) here; it seems that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sigh, we missed this. Wanna open a PR or issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I'll make a PR; just wanted to give the OP first crack if they wanted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return 1; | ||
} | ||
|
||
/* Look single response matching a given certificate ID */ | ||
|
||
int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line after the decl.