summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_cert.c
diff options
context:
space:
mode:
authorViktor Dukhovni <openssl-users@dukhovni.org>2016-03-18 22:09:41 -0400
committerViktor Dukhovni <openssl-users@dukhovni.org>2016-04-03 11:35:35 -0400
commitfbb82a60dcbe820714a246ab3e7617eaf3a7b656 (patch)
tree261c976e4e3d6dbea776b0fb54c635bd2a10eebd /ssl/ssl_cert.c
parent70dd3c6593d87e4cbb56b485717cb2cfff730f3e (diff)
Move peer chain security checks into x509_vfy.c
A new X509_VERIFY_PARAM_set_auth_level() function sets the authentication security level. For verification of SSL peers, this is automatically set from the SSL security level. Otherwise, for now, the authentication security level remains at (effectively) 0 by default. The new "-auth_level" verify(1) option is available in all the command-line tools that support the standard verify(1) options. New verify(1) tests added to check enforcement of chain signature and public key security levels. Also added new tests of enforcement of the verify_depth limit. Updated documentation. Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Diffstat (limited to 'ssl/ssl_cert.c')
-rw-r--r--ssl/ssl_cert.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index 4081ebe4ff..24ac352d1d 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -494,6 +494,12 @@ int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk)
return (0);
}
param = X509_STORE_CTX_get0_param(&ctx);
+ /*
+ * XXX: Separate @AUTHSECLEVEL and @TLSSECLEVEL would be useful at some
+ * point, for now a single @SECLEVEL sets the same policy for TLS crypto
+ * and PKI authentication.
+ */
+ X509_VERIFY_PARAM_set_auth_level(param, SSL_get_security_level(s));
/* Set suite B flags if needed */
X509_STORE_CTX_set_flags(&ctx, tls1_suiteb(s));
@@ -520,17 +526,8 @@ int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk)
if (s->ctx->app_verify_callback != NULL)
i = s->ctx->app_verify_callback(&ctx, s->ctx->app_verify_arg);
- else {
+ else
i = X509_verify_cert(&ctx);
-# if 0
- /* Dummy error calls so mkerr generates them */
- SSLerr(SSL_F_SSL_VERIFY_CERT_CHAIN, SSL_R_EE_KEY_TOO_SMALL);
- SSLerr(SSL_F_SSL_VERIFY_CERT_CHAIN, SSL_R_CA_KEY_TOO_SMALL);
- SSLerr(SSL_F_SSL_VERIFY_CERT_CHAIN, SSL_R_CA_MD_TOO_WEAK);
-# endif
- if (i > 0)
- i = ssl_security_cert_chain(s, ctx.chain, NULL, 1);
- }
s->verify_result = ctx.error;
sk_X509_pop_free(s->verified_chain, X509_free);
@@ -894,12 +891,18 @@ int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l)
* ignore the error return from this call. We're not actually verifying
* the cert - we're just building as much of the chain as we can
*/
- X509_verify_cert(&xs_ctx);
+ (void) X509_verify_cert(&xs_ctx);
/* Don't leave errors in the queue */
ERR_clear_error();
i = ssl_security_cert_chain(s, xs_ctx.chain, NULL, 0);
if (i != 1) {
X509_STORE_CTX_cleanup(&xs_ctx);
+#if 0
+ /* Dummy error calls so mkerr generates them */
+ SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, SSL_R_EE_KEY_TOO_SMALL);
+ SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, SSL_R_CA_KEY_TOO_SMALL);
+ SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, SSL_R_CA_MD_TOO_WEAK);
+#endif
SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, i);
return 0;
}