diff options
Diffstat (limited to 'src/lib/libcrypto/ocsp/ocsp_cl.c')
| -rw-r--r-- | src/lib/libcrypto/ocsp/ocsp_cl.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/libcrypto/ocsp/ocsp_cl.c b/src/lib/libcrypto/ocsp/ocsp_cl.c index 716513d2f9..aabd497dde 100644 --- a/src/lib/libcrypto/ocsp/ocsp_cl.c +++ b/src/lib/libcrypto/ocsp/ocsp_cl.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | * are met: | 15 | * are met: |
| 16 | * | 16 | * |
| 17 | * 1. Redistributions of source code must retain the above copyright | 17 | * 1. Redistributions of source code must retain the above copyright |
| 18 | * notice, this list of conditions and the following disclaimer. | 18 | * notice, this list of conditions and the following disclaimer. |
| 19 | * | 19 | * |
| 20 | * 2. Redistributions in binary form must reproduce the above copyright | 20 | * 2. Redistributions in binary form must reproduce the above copyright |
| 21 | * notice, this list of conditions and the following disclaimer in | 21 | * notice, this list of conditions and the following disclaimer in |
| @@ -75,7 +75,7 @@ | |||
| 75 | * relevant information from the response. | 75 | * relevant information from the response. |
| 76 | */ | 76 | */ |
| 77 | 77 | ||
| 78 | /* Add an OCSP_CERTID to an OCSP request. Return new OCSP_ONEREQ | 78 | /* Add an OCSP_CERTID to an OCSP request. Return new OCSP_ONEREQ |
| 79 | * pointer: useful if we want to add extensions. | 79 | * pointer: useful if we want to add extensions. |
| 80 | */ | 80 | */ |
| 81 | OCSP_ONEREQ * | 81 | OCSP_ONEREQ * |
| @@ -91,6 +91,7 @@ OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid) | |||
| 91 | if (req && !sk_OCSP_ONEREQ_push(req->tbsRequest->requestList, one)) | 91 | if (req && !sk_OCSP_ONEREQ_push(req->tbsRequest->requestList, one)) |
| 92 | goto err; | 92 | goto err; |
| 93 | return one; | 93 | return one; |
| 94 | |||
| 94 | err: | 95 | err: |
| 95 | OCSP_ONEREQ_free(one); | 96 | OCSP_ONEREQ_free(one); |
| 96 | return NULL; | 97 | return NULL; |
| @@ -115,7 +116,7 @@ OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm) | |||
| 115 | req->tbsRequest->requestorName = gen; | 116 | req->tbsRequest->requestorName = gen; |
| 116 | return 1; | 117 | return 1; |
| 117 | } | 118 | } |
| 118 | 119 | ||
| 119 | /* Add a certificate to an OCSP request */ | 120 | /* Add a certificate to an OCSP request */ |
| 120 | int | 121 | int |
| 121 | OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert) | 122 | OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert) |
| @@ -132,7 +133,7 @@ OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert) | |||
| 132 | if (!sig->certs && !(sig->certs = sk_X509_new_null())) | 133 | if (!sig->certs && !(sig->certs = sk_X509_new_null())) |
| 133 | return 0; | 134 | return 0; |
| 134 | 135 | ||
| 135 | if(!sk_X509_push(sig->certs, cert)) | 136 | if (!sk_X509_push(sig->certs, cert)) |
| 136 | return 0; | 137 | return 0; |
| 137 | CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509); | 138 | CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509); |
| 138 | return 1; | 139 | return 1; |
| @@ -167,7 +168,7 @@ OCSP_request_sign(OCSP_REQUEST *req, X509 *signer, EVP_PKEY *key, | |||
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | if (!(flags & OCSP_NOCERTS)) { | 170 | if (!(flags & OCSP_NOCERTS)) { |
| 170 | if(!OCSP_request_add1_cert(req, signer)) | 171 | if (!OCSP_request_add1_cert(req, signer)) |
| 171 | goto err; | 172 | goto err; |
| 172 | for (i = 0; i < sk_X509_num(certs); i++) { | 173 | for (i = 0; i < sk_X509_num(certs); i++) { |
| 173 | x = sk_X509_value(certs, i); | 174 | x = sk_X509_value(certs, i); |
| @@ -177,6 +178,7 @@ OCSP_request_sign(OCSP_REQUEST *req, X509 *signer, EVP_PKEY *key, | |||
| 177 | } | 178 | } |
| 178 | 179 | ||
| 179 | return 1; | 180 | return 1; |
| 181 | |||
| 180 | err: | 182 | err: |
| 181 | OCSP_SIGNATURE_free(req->optionalSignature); | 183 | OCSP_SIGNATURE_free(req->optionalSignature); |
| 182 | req->optionalSignature = NULL; | 184 | req->optionalSignature = NULL; |
| @@ -257,7 +259,7 @@ OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last) | |||
| 257 | } | 259 | } |
| 258 | 260 | ||
| 259 | /* Extract status information from an OCSP_SINGLERESP structure. | 261 | /* Extract status information from an OCSP_SINGLERESP structure. |
| 260 | * Note: the revtime and reason values are only set if the | 262 | * Note: the revtime and reason values are only set if the |
| 261 | * certificate status is revoked. Returns numerical value of | 263 | * certificate status is revoked. Returns numerical value of |
| 262 | * status. | 264 | * status. |
| 263 | */ | 265 | */ |
| @@ -280,7 +282,8 @@ OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, | |||
| 280 | *revtime = rev->revocationTime; | 282 | *revtime = rev->revocationTime; |
| 281 | if (reason) { | 283 | if (reason) { |
| 282 | if (rev->revocationReason) | 284 | if (rev->revocationReason) |
| 283 | *reason = ASN1_ENUMERATED_get(rev->revocationReason); | 285 | *reason = ASN1_ENUMERATED_get( |
| 286 | rev->revocationReason); | ||
| 284 | else | 287 | else |
| 285 | *reason = -1; | 288 | *reason = -1; |
| 286 | } | 289 | } |
