]> git.ipfire.org Git - thirdparty/curl.git/commit
gtls: add return checks and optimize the code
authorx2018 <xkernel.wang@foxmail.com>
Tue, 4 Nov 2025 18:16:54 +0000 (02:16 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 5 Nov 2025 13:09:34 +0000 (14:09 +0100)
commit2db36f11b8e2c3de99552fc9db830ac22f248a64
tree2ea3de44a38e581bce71b91a992643ca4f612d24
parentdd71f61ea224e135b7ac3e16c8c83b2ca7d01b15
gtls: add return checks and optimize the code

This commit does the following things:

1. Update the description of gtls_init()

2. In gtls_client_init(), check the invaild SSLVERSION at first. Note
   that this part refactors the duplicate/incompatible checks and removes
   the useless local variable `sni`.

3. Check the return value of gnutls_ocsp_resp_init(). Although the
   original code is safe because gnutls_ocsp_resp_import() will check
   the validity of `ocsp_resp`, it is better to catch the error in time
   and record the proper message to output log.

Closes #19366
lib/vtls/gtls.c