]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login, lib-ssl-iostream: Clear errors caused by manual EC key selection when there...
authorTimo Sirainen <tss@iki.fi>
Thu, 3 Dec 2015 10:19:12 +0000 (12:19 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 3 Dec 2015 10:19:12 +0000 (12:19 +0200)
EVP_PKEY_get1_EC_KEY() would return an error, which should be ignored
instead of being logged later on.

src/lib-ssl-iostream/iostream-openssl-context.c
src/login-common/ssl-proxy-openssl.c

index ec5917676b4443c458210e9c3020be9431d3a439..87a9d3273b69a1704de86be7d86f8c846fadace9 100644 (file)
@@ -454,6 +454,10 @@ ssl_proxy_ctx_get_pkey_ec_curve_name(const struct ssl_iostream_settings *set,
                if ((eckey = EVP_PKEY_get1_EC_KEY(pkey)) != NULL &&
                    (ecgrp = EC_KEY_get0_group(eckey)) != NULL)
                        nid = EC_GROUP_get_curve_name(ecgrp);
+               else {
+                       /* clear errors added by the above calls */
+                       (void)openssl_iostream_error();
+               }
                EVP_PKEY_free(pkey);
        }
 
index f4983addc3418fd88ce736e51bc76cb8fc822310..cad0cf1c8e15c058e7998422977d848e7f4f97a7 100644 (file)
@@ -1129,6 +1129,10 @@ ssl_proxy_ctx_get_pkey_ec_curve_name(const struct master_service_ssl_settings *s
            (eckey = EVP_PKEY_get1_EC_KEY(pkey)) != NULL &&
            (ecgrp = EC_KEY_get0_group(eckey)) != NULL)
                nid = EC_GROUP_get_curve_name(ecgrp);
+       else {
+               /* clear errors added by the above calls */
+               (void)openssl_iostream_error();
+       }
        EVP_PKEY_free(pkey);
        return nid;
 }