]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wolfSSL: wolfSSL_use_PrivateKey_* correct return codes
authorJuliusz Sosinowicz <juliusz@wolfssl.com>
Mon, 8 Feb 2021 08:34:07 +0000 (09:34 +0100)
committerJouni Malinen <j@w1.fi>
Tue, 9 Feb 2021 18:54:34 +0000 (20:54 +0200)
The wolfSSL_use_PrivateKey_* APIs return 1 on success. 0 is also an
error.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
src/crypto/tls_wolfssl.c

index ea8f7063b098659559fa4b06d52f82e97802190b..cf482bfc3a16aef27882c58e33813ae470268f01 100644 (file)
@@ -534,7 +534,7 @@ static int tls_connection_private_key(void *tls_ctx,
        if (private_key_blob) {
                if (wolfSSL_use_PrivateKey_buffer(conn->ssl,
                                                  private_key_blob, blob_len,
-                                                 SSL_FILETYPE_ASN1) < 0) {
+                                                 SSL_FILETYPE_ASN1) <= 0) {
                        wpa_printf(MSG_INFO,
                                   "SSL: use private DER blob failed");
                } else {
@@ -545,11 +545,11 @@ static int tls_connection_private_key(void *tls_ctx,
 
        if (!ok && private_key) {
                if (wolfSSL_use_PrivateKey_file(conn->ssl, private_key,
-                                               SSL_FILETYPE_PEM) < 0) {
+                                               SSL_FILETYPE_PEM) <= 0) {
                        wpa_printf(MSG_INFO,
                                   "SSL: use private key PEM file failed");
                        if (wolfSSL_use_PrivateKey_file(conn->ssl, private_key,
-                                                       SSL_FILETYPE_ASN1) < 0)
+                                                       SSL_FILETYPE_ASN1) <= 0)
                        {
                                wpa_printf(MSG_INFO,
                                           "SSL: use private key DER file failed");