diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-02-13 17:22:21 +0100 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-02-13 17:22:47 +0100 |
commit | 41e37bea8f2c7df65315be3d32e2b9bdae9910ee (patch) | |
tree | 24a85937bab3a9b72db5596d506e667306bde58f | |
parent | dafe8285fd3911d25d5b4f0680d886c22b461ab2 (diff) | |
download | gnutls-tmp-cleanup-cert.tar.gz |
Cleanup lib/auth/cert.c as suggested by cppchecktmp-cleanup-cert
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rw-r--r-- | lib/auth/cert.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/lib/auth/cert.c b/lib/auth/cert.c index 5868ca244d..bff9170a6c 100644 --- a/lib/auth/cert.c +++ b/lib/auth/cert.c @@ -327,7 +327,7 @@ find_rawpk_client_cert(gnutls_session_t session, static int get_issuers_num(gnutls_session_t session, const uint8_t * data, ssize_t data_size) { - int issuers_dn_len = 0, result; + int issuers_dn_len = 0; unsigned size; /* Count the number of the given issuers; @@ -338,34 +338,23 @@ get_issuers_num(gnutls_session_t session, const uint8_t * data, ssize_t data_siz if (data_size == 0 || data == NULL) return 0; - if (data_size > 0) - do { - /* This works like DECR_LEN() - */ - result = GNUTLS_E_UNEXPECTED_PACKET_LENGTH; - DECR_LENGTH_COM(data_size, 2, goto error); - size = _gnutls_read_uint16(data); - - result = GNUTLS_E_UNEXPECTED_PACKET_LENGTH; - DECR_LENGTH_COM(data_size, size, goto error); - - data += 2; + while (data_size > 0) { + /* This works like DECR_LEN() + */ + DECR_LENGTH_RET(data_size, 2, GNUTLS_E_UNEXPECTED_PACKET_LENGTH); + size = _gnutls_read_uint16(data); - if (size > 0) { - issuers_dn_len++; - data += size; - } + DECR_LENGTH_RET(data_size, size, GNUTLS_E_UNEXPECTED_PACKET_LENGTH); - if (data_size == 0) - break; + data += 2; + if (size > 0) { + issuers_dn_len++; + data += size; } - while (1); + } return issuers_dn_len; - - error: - return result; } /* Returns the issuers in the server's certificate request @@ -990,7 +979,6 @@ cleanup: int _gnutls_proc_crt(gnutls_session_t session, uint8_t * data, size_t data_size) { - int ret; gnutls_certificate_credentials_t cred; gnutls_certificate_type_t cert_type; @@ -1014,8 +1002,6 @@ int _gnutls_proc_crt(gnutls_session_t session, uint8_t * data, size_t data_size) default: return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); } - - return ret; } /* Checks if we support the given signature algorithm |