Commit bf0d176e authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Update OCSP API.

Remove extensions argument from various functions
because it is not needed with the new extension
code.

New function OCSP_cert_to_id() to convert a pair
of certificates into an OCSP_CERTID.

New simple OCSP HTTP function. This is rather primitive
but just about adequate to send OCSP requests and
parse the response.

Fix typo in CRL distribution points extension.

Fix ASN1 code so it adds a final null to constructed
strings.
parent ec5add87
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3,6 +3,12 @@

 Changes between 0.9.6 and 0.9.7  [xx XXX 2000]

  *) Update OCSP API. Remove obsolete extensions argument from
     various functions. Extensions are now handled using the new
     OCSP extension code. New simple OCSP HTTP function which 
     can be used to send requests and parse the response.
     [Steve Henson]

  *) Fix the PKCS#7 (S/MIME) code to work with new ASN1. Two new
     ASN1_ITEM structures help with sign and verify. PKCS7_ATTR_SIGN
     uses the special reorder version of SET OF to sort the attributes
+9 −3
Original line number Diff line number Diff line
@@ -606,7 +606,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long inl
		cont = *in;
		/* If indefinite length constructed find the real end */
		if(inf) {
			asn1_collect(NULL, &p, plen, inf, -1, -1);
			if(!asn1_collect(NULL, &p, plen, inf, -1, -1)) goto err;
			len = p - cont;
		} else {
			len = p - cont + plen;
@@ -623,9 +623,15 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long inl
		 * internally irrespective of the type. So instead just check
		 * for UNIVERSAL class and ignore the tag.
		 */
		asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL);
		cont = (unsigned char *)buf.data;
		if(!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL)) goto err;
		len = buf.length;
		/* Append a final null to string */
		if(!BUF_MEM_grow(&buf, len + 1)) {
			ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
			return 0;
		}
		buf.data[len] = 0;
		cont = (unsigned char *)buf.data;
		free_cont = 1;
	} else {
		cont = p;
+2 −2
Original line number Diff line number Diff line
@@ -22,10 +22,10 @@ TEST=
APPS=

LIB=$(TOP)/libcrypto.a
LIBSRC= ocsp_asn.c ocsp_ext.c \
LIBSRC= ocsp_asn.c ocsp_ext.c ocsp_ht.c \
	ocsp_lib.c ocsp_prn.c ocsp_err.c

LIBOBJ= ocsp_asn.o ocsp_ext.o \
LIBOBJ= ocsp_asn.o ocsp_ext.o ocsp_ht.o \
	ocsp_lib.o ocsp_prn.o ocsp_err.o

SRC= $(LIBSRC)
+14 −8
Original line number Diff line number Diff line
@@ -384,6 +384,10 @@ typedef struct ocsp_service_locator_st
                (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
		(char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))

OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);

OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);

OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, 
			      X509_NAME *issuerName, 
			      ASN1_BIT_STRING* issuerKey, 
@@ -391,12 +395,10 @@ OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,

OCSP_CERTSTATUS *OCSP_cert_status_new(int status, int reason, char *tim);

OCSP_REQUEST *OCSP_request_new(X509_NAME* name,
			       STACK_OF(X509_EXTENSION) *extensions);
OCSP_REQUEST *OCSP_request_new(X509_NAME* name);

int OCSP_request_add(OCSP_REQUEST             *req,
		     OCSP_CERTID              *cid,
		     STACK_OF(X509_EXTENSION) *extensions);
		     OCSP_CERTID              *cid);

int OCSP_request_sign(OCSP_REQUEST   *req,
		      EVP_PKEY       *key,
@@ -406,15 +408,13 @@ int OCSP_request_sign(OCSP_REQUEST *req,
int OCSP_request_verify(OCSP_REQUEST *req, EVP_PKEY *pkey);

OCSP_BASICRESP *OCSP_basic_response_new(int tag,
					X509* cert,
					STACK_OF(X509_EXTENSION) *extensions);
					X509* cert);

int OCSP_basic_response_add(OCSP_BASICRESP           *rsp,
			    OCSP_CERTID              *cid,
			    OCSP_CERTSTATUS          *cst,
			    char                     *thisUpdate,
			    char                     *nextUpdate,
			    STACK_OF(X509_EXTENSION) *extensions);
			    char                     *nextUpdate);

int OCSP_basic_response_sign(OCSP_BASICRESP *brsp, 
			     EVP_PKEY       *key,
@@ -523,6 +523,7 @@ void ERR_load_OCSP_strings(void);
#define OCSP_F_CERT_ID_NEW				 102
#define OCSP_F_CERT_STATUS_NEW				 103
#define OCSP_F_D2I_OCSP_NONCE				 109
#define OCSP_F_OCSP_SENDREQ_BIO				 110
#define OCSP_F_REQUEST_VERIFY				 104
#define OCSP_F_RESPONSE_VERIFY				 105
#define OCSP_F_S2I_OCSP_NONCE				 107
@@ -537,10 +538,15 @@ void ERR_load_OCSP_strings(void);
#define OCSP_R_FAILED_TO_STAT				 111
#define OCSP_R_MISSING_VALUE				 112
#define OCSP_R_NO_CERTIFICATE				 102
#define OCSP_R_NO_CONTENT				 115
#define OCSP_R_NO_PUBLIC_KEY				 103
#define OCSP_R_NO_RESPONSE_DATA				 104
#define OCSP_R_NO_SIGNATURE				 105
#define OCSP_R_REVOKED_NO_TIME				 106
#define OCSP_R_SERVER_READ_ERROR			 116
#define OCSP_R_SERVER_RESPONSE_ERROR			 117
#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR		 118
#define OCSP_R_SERVER_WRITE_ERROR			 119
#define OCSP_R_UNKNOWN_NID				 107
#define OCSP_R_UNSUPPORTED_OPTION			 113
#define OCSP_R_VALUE_ALREADY				 114
+1 −1
Original line number Diff line number Diff line
/* ocsp.c */
/* ocsp_asn.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
 * project 2000.
 */
Loading