| OLD | NEW |
| 1 /* ocsp_lib.c */ | 1 /* ocsp_lib.c */ |
| 2 /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL | 2 /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL |
| 3 * project. */ | 3 * project. */ |
| 4 | 4 |
| 5 /* History: | 5 /* History: |
| 6 This file was transfered to Richard Levitte from CertCo by Kathy | 6 This file was transfered to Richard Levitte from CertCo by Kathy |
| 7 Weinhold in mid-spring 2000 to be included in OpenSSL or released | 7 Weinhold in mid-spring 2000 to be included in OpenSSL or released |
| 8 as a patch kit. */ | 8 as a patch kit. */ |
| 9 | 9 |
| 10 /* ==================================================================== | 10 /* ==================================================================== |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 */ | 62 */ |
| 63 | 63 |
| 64 #include <stdio.h> | 64 #include <stdio.h> |
| 65 #include <cryptlib.h> | 65 #include <cryptlib.h> |
| 66 #include <openssl/objects.h> | 66 #include <openssl/objects.h> |
| 67 #include <openssl/rand.h> | 67 #include <openssl/rand.h> |
| 68 #include <openssl/x509.h> | 68 #include <openssl/x509.h> |
| 69 #include <openssl/pem.h> | 69 #include <openssl/pem.h> |
| 70 #include <openssl/x509v3.h> | 70 #include <openssl/x509v3.h> |
| 71 #include <openssl/ocsp.h> | 71 #include <openssl/ocsp.h> |
| 72 #include <openssl/asn1t.h> |
| 72 | 73 |
| 73 /* Convert a certificate and its issuer to an OCSP_CERTID */ | 74 /* Convert a certificate and its issuer to an OCSP_CERTID */ |
| 74 | 75 |
| 75 OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer) | 76 OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer) |
| 76 { | 77 { |
| 77 X509_NAME *iname; | 78 X509_NAME *iname; |
| 78 ASN1_INTEGER *serial; | 79 ASN1_INTEGER *serial; |
| 79 ASN1_BIT_STRING *ikey; | 80 ASN1_BIT_STRING *ikey; |
| 80 #ifndef OPENSSL_NO_SHA1 | 81 #ifndef OPENSSL_NO_SHA1 |
| 81 if(!dgst) dgst = EVP_sha1(); | 82 if(!dgst) dgst = EVP_sha1(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 /* Parse a URL and split it up into host, port and path components and whether | 163 /* Parse a URL and split it up into host, port and path components and whether |
| 163 * it is SSL. | 164 * it is SSL. |
| 164 */ | 165 */ |
| 165 | 166 |
| 166 int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss
l) | 167 int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss
l) |
| 167 { | 168 { |
| 168 char *p, *buf; | 169 char *p, *buf; |
| 169 | 170 |
| 170 char *host, *port; | 171 char *host, *port; |
| 171 | 172 |
| 173 *phost = NULL; |
| 174 *pport = NULL; |
| 175 *ppath = NULL; |
| 176 |
| 172 /* dup the buffer since we are going to mess with it */ | 177 /* dup the buffer since we are going to mess with it */ |
| 173 buf = BUF_strdup(url); | 178 buf = BUF_strdup(url); |
| 174 if (!buf) goto mem_err; | 179 if (!buf) goto mem_err; |
| 175 | 180 |
| 176 *phost = NULL; | |
| 177 *pport = NULL; | |
| 178 *ppath = NULL; | |
| 179 | |
| 180 /* Check for initial colon */ | 181 /* Check for initial colon */ |
| 181 p = strchr(buf, ':'); | 182 p = strchr(buf, ':'); |
| 182 | 183 |
| 183 if (!p) goto parse_err; | 184 if (!p) goto parse_err; |
| 184 | 185 |
| 185 *(p++) = '\0'; | 186 *(p++) = '\0'; |
| 186 | 187 |
| 187 if (!strcmp(buf, "http")) | 188 if (!strcmp(buf, "http")) |
| 188 { | 189 { |
| 189 *pssl = 0; | 190 *pssl = 0; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 254 |
| 254 | 255 |
| 255 err: | 256 err: |
| 256 if (buf) OPENSSL_free(buf); | 257 if (buf) OPENSSL_free(buf); |
| 257 if (*ppath) OPENSSL_free(*ppath); | 258 if (*ppath) OPENSSL_free(*ppath); |
| 258 if (*pport) OPENSSL_free(*pport); | 259 if (*pport) OPENSSL_free(*pport); |
| 259 if (*phost) OPENSSL_free(*phost); | 260 if (*phost) OPENSSL_free(*phost); |
| 260 return 0; | 261 return 0; |
| 261 | 262 |
| 262 } | 263 } |
| 264 |
| 265 IMPLEMENT_ASN1_DUP_FUNCTION(OCSP_CERTID) |
| OLD | NEW |