Return 0/1 from ssl3_{send,get}_client_kex_gost()
authorjsing <jsing@openbsd.org>
Sun, 9 Jan 2022 15:34:21 +0000 (15:34 +0000)
committerjsing <jsing@openbsd.org>
Sun, 9 Jan 2022 15:34:21 +0000 (15:34 +0000)
Like other KEX handling functions, there is no need to return anything
other than failure/success here.

ok inoguchi@ tb@

lib/libssl/ssl_clnt.c
lib/libssl/ssl_srvr.c

index d0910c8..cc66ed0 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_clnt.c,v 1.130 2022/01/09 15:29:42 jsing Exp $ */
+/* $OpenBSD: ssl_clnt.c,v 1.131 2022/01/09 15:34:21 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -1931,9 +1931,9 @@ ssl3_send_client_kex_gost(SSL *s, CBB *cbb)
        size_t msglen;
        unsigned int md_len;
        EVP_MD_CTX *ukm_hash;
-       int ret = -1;
        int nid;
        CBB gostblob;
+       int ret = 0;
 
        /* Get server sertificate PKEY and create ctx from it */
        peer_cert = s->session->peer_pkeys[SSL_PKEY_GOST01].x509;
@@ -2027,7 +2027,7 @@ ssl3_send_client_kex_gost(SSL *s, CBB *cbb)
        explicit_bzero(premaster_secret, sizeof(premaster_secret));
        EVP_PKEY_free(pub_key);
 
-       return (ret);
+       return ret;
 }
 
 int
@@ -2055,7 +2055,7 @@ ssl3_send_client_key_exchange(SSL *s)
                        if (!ssl3_send_client_kex_ecdhe(s, &kex))
                                goto err;
                } else if (alg_k & SSL_kGOST) {
-                       if (ssl3_send_client_kex_gost(s, &kex) != 1)
+                       if (!ssl3_send_client_kex_gost(s, &kex))
                                goto err;
                } else {
                        ssl3_send_alert(s, SSL3_AL_FATAL,
index aa1b62c..1f6753f 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_srvr.c,v 1.135 2022/01/09 15:28:47 jsing Exp $ */
+/* $OpenBSD: ssl_srvr.c,v 1.136 2022/01/09 15:34:21 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -1830,7 +1830,7 @@ ssl3_get_client_kex_gost(SSL *s, CBS *cbs)
        SSLerror(s, SSL_R_BAD_PACKET_LENGTH);
        ssl3_send_alert(s, SSL3_AL_FATAL, al);
  err:
-       return (-1);
+       return 0;
 }
 
 int
@@ -1862,7 +1862,7 @@ ssl3_get_client_key_exchange(SSL *s)
                if (!ssl3_get_client_kex_ecdhe(s, &cbs))
                        goto err;
        } else if (alg_k & SSL_kGOST) {
-               if (ssl3_get_client_kex_gost(s, &cbs) != 1)
+               if (!ssl3_get_client_kex_gost(s, &cbs))
                        goto err;
        } else {
                al = SSL_AD_HANDSHAKE_FAILURE;