[PATCH]Send whole certificate chain from file

Maciej Szmigiero mhej
Mon Nov 14 17:03:19 PST 2011

Currently OpenSSL implementation of TLS in hostapd loads only top
certificate in server certificate file.

This requires any intermediate certs to be installed on client
machine in order it to be able to verify server cert properly and
violates TLS specs (section 7.4.2) when used with such intermediate certs.

In contrast, the GnuTLS implementation correctly loads the whole
chain if it's present in server certificate file.

This patch tries to load whole chain first in OpenSSL implementation,
then reverts to old behavior if it fails.

Signed-off-by: Maciej Szmigiero <mhej at o2.pl>

--- src/crypto/tls_openssl.c.old        2010-09-07 17:43:39.000000000 +0200
+++ src/crypto/tls_openssl.c    2011-04-12 14:45:24.968047291 +0200
@@ -1586,6 +1586,7 @@

     if (SSL_CTX_use_certificate_file(ssl_ctx, client_cert,
                          SSL_FILETYPE_ASN1) != 1 &&
+        SSL_CTX_use_certificate_chain_file(ssl_ctx, client_cert) != 1 &&
         SSL_CTX_use_certificate_file(ssl_ctx, client_cert,
                          SSL_FILETYPE_PEM) != 1) {
        tls_show_errors(MSG_INFO, __func__,

More information about the Hostap mailing list