Commit b1fe6ca1 authored by Bodo Möller's avatar Bodo Möller
Browse files

Store verify_result with sessions to avoid potential security hole.

parent 91895a59
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -4,6 +4,17 @@

 Changes between 0.9.4 and 0.9.5  [xx XXX 1999]

  *) For servers, store verify_result in SSL_SESSION data structure
     (and add it to external session representation).
     This is needed when client certificate verifications fails,
     but an application-provided verification callback (set by
     SSL_CTX_set_cert_verify_callback) allows accepting the session
     anyway (i.e. leaves x509_store_ctx->error != X509_V_OK
     but returns 1): When the session is reused, we have to set
     ssl->verify_result to the appropriate error code to avoid
     security holes.
     [Bodo Moeller, problem pointed out by Lutz Jaenicke]

  *) Fix a bug in the new PKCS#7 code: it didn't consider the
     case in PKCS7_dataInit() where the signed PKCS7 structure
     didn't contain any existing data because it was being created.
+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ struct x509_store_state_st /* X509_STORE_CTX */
		X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)

#define		X509_V_OK					0
/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */

#define		X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT		2
#define		X509_V_ERR_UNABLE_TO_GET_CRL			3
+1 −0
Original line number Diff line number Diff line
@@ -921,6 +921,7 @@ static int request_certificate(SSL *s)
				X509_free(s->session->peer);
			s->session->peer=x509;
			CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
			s->session->verify_result = s->verify_result;
			ret=1;
			goto end;
			}
+1 −0
Original line number Diff line number Diff line
@@ -1627,6 +1627,7 @@ static int ssl3_get_client_certificate(SSL *s)
	if (s->session->peer != NULL) /* This should not be needed */
		X509_free(s->session->peer);
	s->session->peer=sk_X509_shift(sk);
	s->session->verify_result = s->verify_result;

	/* With the current implementation, sess_cert will always be NULL
	 * when we arrive here. */
+5 −1
Original line number Diff line number Diff line
@@ -215,7 +215,8 @@ typedef struct ssl_method_st
 *	Timeout [ 2 ] EXPLICIT	INTEGER,	-- optional Timeout ins seconds
 *	Peer [ 3 ] EXPLICIT	X509,		-- optional Peer Certificate
 *	Session_ID_context [ 4 ] EXPLICIT OCTET_STRING,   -- the Session ID context
 *	Compression [5] IMPLICIT ASN1_OBJECT	-- compression OID XXXXX
 *	Verify_result [ 5 ] EXPLICIT INTEGER    -- X509_V_... code for `Peer'
 *	Compression [6] IMPLICIT ASN1_OBJECT	-- compression OID XXXXX
 *	}
 * Look in ssl/ssl_asn1.c for more details
 * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
@@ -249,6 +250,9 @@ typedef struct ssl_session_st
	 * (the latter is not enough as sess_cert is not retained
	 * in the external representation of sessions, see ssl_asn1.c). */
	X509 *peer;
	/* when app_verify_callback accepts a session where the peer's certificate
	 * is not ok, we must remember the error for session reuse: */
	long verify_result; /* only for servers */

	int references;
	long timeout;
Loading