diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/auth/psk_passwd.c | 2 | ||||
-rw-r--r-- | lib/auth/srp_passwd.c | 4 | ||||
-rw-r--r-- | lib/ext/pre_shared_key.c | 2 | ||||
-rw-r--r-- | lib/x509/key_decode.c | 18 | ||||
-rw-r--r-- | lib/x509/output.c | 8 | ||||
-rw-r--r-- | lib/x509/privkey.c | 77 | ||||
-rw-r--r-- | lib/x509/verify.c | 7 | ||||
-rw-r--r-- | lib/x509_b64.c | 2 |
8 files changed, 50 insertions, 70 deletions
diff --git a/lib/auth/psk_passwd.c b/lib/auth/psk_passwd.c index 9a9d68c488..2953c2d8ad 100644 --- a/lib/auth/psk_passwd.c +++ b/lib/auth/psk_passwd.c @@ -105,7 +105,7 @@ static bool username_matches(const gnutls_datum_t *username, hexline.data = (void *) &line[1]; hexline.size = i - 1; - if ((retval = gnutls_hex_decode2(&hexline, &hex_username)) < 0) + if (gnutls_hex_decode2(&hexline, &hex_username) < 0) return gnutls_assert_val(0); if (hex_username.size == username->size) diff --git a/lib/auth/srp_passwd.c b/lib/auth/srp_passwd.c index 49039a66e7..e7d8d602e6 100644 --- a/lib/auth/srp_passwd.c +++ b/lib/auth/srp_passwd.c @@ -218,9 +218,7 @@ pwd_read_conf(const char *pconf_file, SRP_PWD_ENTRY * entry, int idx) } if (strncmp(indexstr, line, MAX(i, len)) == 0) { - if ((idx = - parse_tpasswd_conf_values(entry, - line)) >= 0) { + if (parse_tpasswd_conf_values(entry, line) >= 0) { ret = 0; goto cleanup; } else { diff --git a/lib/ext/pre_shared_key.c b/lib/ext/pre_shared_key.c index 7965ee760d..b5a86b7db1 100644 --- a/lib/ext/pre_shared_key.c +++ b/lib/ext/pre_shared_key.c @@ -575,7 +575,7 @@ static int server_recv_params(gnutls_session_t session, /* This will unpack the session ticket if it is well * formed and has the expected name */ if (!(session->internals.flags & GNUTLS_NO_TICKETS) && - (ret = _gnutls13_unpack_session_ticket(session, &psk.identity, &ticket_data)) == 0) { + _gnutls13_unpack_session_ticket(session, &psk.identity, &ticket_data) == 0) { prf = ticket_data.prf; session->internals.resumption_requested = 1; diff --git a/lib/x509/key_decode.c b/lib/x509/key_decode.c index c79f6eee37..00378af94d 100644 --- a/lib/x509/key_decode.c +++ b/lib/x509/key_decode.c @@ -76,16 +76,15 @@ _gnutls_x509_read_rsa_pubkey(uint8_t * der, int dersize, } - if ((result = - _gnutls_x509_read_int(spk, "modulus", - ¶ms->params[0])) < 0) { + if (_gnutls_x509_read_int(spk, "modulus", + ¶ms->params[0]) < 0) { gnutls_assert(); asn1_delete_structure(&spk); return GNUTLS_E_ASN1_GENERIC_ERROR; } - if ((result = _gnutls_x509_read_int(spk, "publicExponent", - ¶ms->params[1])) < 0) { + if (_gnutls_x509_read_int(spk, "publicExponent", + ¶ms->params[1]) < 0) { gnutls_assert(); _gnutls_mpi_release(¶ms->params[0]); asn1_delete_structure(&spk); @@ -200,8 +199,7 @@ _gnutls_x509_read_dsa_params(uint8_t * der, int dersize, /* Read p */ - if ((result = - _gnutls_x509_read_int(spk, "p", ¶ms->params[0])) < 0) { + if (_gnutls_x509_read_int(spk, "p", ¶ms->params[0]) < 0) { gnutls_assert(); asn1_delete_structure(&spk); return GNUTLS_E_ASN1_GENERIC_ERROR; @@ -209,8 +207,7 @@ _gnutls_x509_read_dsa_params(uint8_t * der, int dersize, /* Read q */ - if ((result = - _gnutls_x509_read_int(spk, "q", ¶ms->params[1])) < 0) { + if (_gnutls_x509_read_int(spk, "q", ¶ms->params[1]) < 0) { gnutls_assert(); asn1_delete_structure(&spk); _gnutls_mpi_release(¶ms->params[0]); @@ -219,8 +216,7 @@ _gnutls_x509_read_dsa_params(uint8_t * der, int dersize, /* Read g */ - if ((result = - _gnutls_x509_read_int(spk, "g", ¶ms->params[2])) < 0) { + if (_gnutls_x509_read_int(spk, "g", ¶ms->params[2]) < 0) { gnutls_assert(); asn1_delete_structure(&spk); _gnutls_mpi_release(¶ms->params[0]); diff --git a/lib/x509/output.c b/lib/x509/output.c index 705e8babfa..b669b86b22 100644 --- a/lib/x509/output.c +++ b/lib/x509/output.c @@ -897,18 +897,18 @@ static void print_subject_sign_tool(gnutls_buffer_st * str, const char *prefix, static void print_issuer_sign_tool(gnutls_buffer_st * str, const char *prefix, const gnutls_datum_t *der) { - int ret, result; + int ret; ASN1_TYPE tmpasn = ASN1_TYPE_EMPTY; char asn1_err[ASN1_MAX_ERROR_DESCRIPTION_SIZE] = ""; gnutls_datum_t tmp; - if ((result = asn1_create_element(_gnutls_get_gnutls_asn(), "GNUTLS.IssuerSignTool", - &tmpasn)) != ASN1_SUCCESS) { + if (asn1_create_element(_gnutls_get_gnutls_asn(), "GNUTLS.IssuerSignTool", + &tmpasn) != ASN1_SUCCESS) { gnutls_assert(); goto hexdump; } - if ((result = _asn1_strict_der_decode(&tmpasn, der->data, der->size, asn1_err)) != ASN1_SUCCESS) { + if (_asn1_strict_der_decode(&tmpasn, der->data, der->size, asn1_err) != ASN1_SUCCESS) { gnutls_assert(); _gnutls_debug_log("_asn1_strict_der_decode: %s\n", asn1_err); goto hexdump; diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c index 3852064648..f35575be9a 100644 --- a/lib/x509/privkey.c +++ b/lib/x509/privkey.c @@ -135,10 +135,9 @@ _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum_t * raw_key, gnutls_pk_params_init(&pkey->params); - if ((result = - asn1_create_element(_gnutls_get_gnutls_asn(), - "GNUTLS.RSAPrivateKey", - &pkey_asn)) != ASN1_SUCCESS) { + if (asn1_create_element(_gnutls_get_gnutls_asn(), + "GNUTLS.RSAPrivateKey", + &pkey_asn) != ASN1_SUCCESS) { gnutls_assert(); return NULL; } @@ -151,65 +150,58 @@ _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum_t * raw_key, goto error; } - if ((result = _gnutls_x509_read_int(pkey_asn, "modulus", - &pkey->params.params[0])) < 0) + if (_gnutls_x509_read_int(pkey_asn, "modulus", + &pkey->params.params[0]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = - _gnutls_x509_read_int(pkey_asn, "publicExponent", - &pkey->params.params[1])) < 0) { + if (_gnutls_x509_read_int(pkey_asn, "publicExponent", + &pkey->params.params[1]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = - _gnutls_x509_read_key_int(pkey_asn, "privateExponent", - &pkey->params.params[2])) < 0) { + if (_gnutls_x509_read_key_int(pkey_asn, "privateExponent", + &pkey->params.params[2]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = _gnutls_x509_read_key_int(pkey_asn, "prime1", - &pkey->params.params[3])) < 0) - { + if (_gnutls_x509_read_key_int(pkey_asn, "prime1", + &pkey->params.params[3]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = _gnutls_x509_read_key_int(pkey_asn, "prime2", - &pkey->params.params[4])) < 0) - { + if (_gnutls_x509_read_key_int(pkey_asn, "prime2", + &pkey->params.params[4]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = _gnutls_x509_read_key_int(pkey_asn, "coefficient", - &pkey->params.params[5])) < 0) - { + if (_gnutls_x509_read_key_int(pkey_asn, "coefficient", + &pkey->params.params[5]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = _gnutls_x509_read_key_int(pkey_asn, "exponent1", - &pkey->params.params[6])) < 0) - { + if (_gnutls_x509_read_key_int(pkey_asn, "exponent1", + &pkey->params.params[6]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = _gnutls_x509_read_key_int(pkey_asn, "exponent2", - &pkey->params.params[7])) < 0) - { + if (_gnutls_x509_read_key_int(pkey_asn, "exponent2", + &pkey->params.params[7]) < 0) { gnutls_assert(); goto error; } @@ -353,10 +345,9 @@ decode_dsa_key(const gnutls_datum_t * raw_key, gnutls_x509_privkey_t pkey) char oid[MAX_OID_SIZE]; int oid_size; - if ((result = - asn1_create_element(_gnutls_get_gnutls_asn(), - "GNUTLS.DSAPrivateKey", - &dsa_asn)) != ASN1_SUCCESS) { + if (asn1_create_element(_gnutls_get_gnutls_asn(), + "GNUTLS.DSAPrivateKey", + &dsa_asn) != ASN1_SUCCESS) { gnutls_assert(); return NULL; } @@ -372,40 +363,36 @@ decode_dsa_key(const gnutls_datum_t * raw_key, gnutls_x509_privkey_t pkey) goto error; } - if ((result = - _gnutls_x509_read_int(dsa_asn, "p", - &pkey->params.params[0])) < 0) { + if (_gnutls_x509_read_int(dsa_asn, "p", + &pkey->params.params[0]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = - _gnutls_x509_read_int(dsa_asn, "q", - &pkey->params.params[1])) < 0) { + if (_gnutls_x509_read_int(dsa_asn, "q", + &pkey->params.params[1]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = - _gnutls_x509_read_int(dsa_asn, "g", - &pkey->params.params[2])) < 0) { + if (_gnutls_x509_read_int(dsa_asn, "g", + &pkey->params.params[2]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = - _gnutls_x509_read_int(dsa_asn, "Y", - &pkey->params.params[3])) < 0) { + if (_gnutls_x509_read_int(dsa_asn, "Y", + &pkey->params.params[3]) < 0) { gnutls_assert(); goto error; } pkey->params.params_nr++; - if ((result = _gnutls_x509_read_key_int(dsa_asn, "priv", - &pkey->params.params[4])) < 0) + if (_gnutls_x509_read_key_int(dsa_asn, "priv", + &pkey->params.params[4]) < 0) { gnutls_assert(); goto error; diff --git a/lib/x509/verify.c b/lib/x509/verify.c index 4363e818b1..bab223ceca 100644 --- a/lib/x509/verify.c +++ b/lib/x509/verify.c @@ -1074,13 +1074,12 @@ _gnutls_verify_crt_status(gnutls_x509_trust_list_t tlist, flags |= GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT; } - if ((ret = - verify_crt(tlist, - certificate_list[i - 1], + if (!verify_crt(tlist, + certificate_list[i - 1], &certificate_list[i], 1, flags, &output, &vparams, - i==1?1:0)) != 1) { + i==1?1:0)) { gnutls_assert(); status |= output; status |= GNUTLS_CERT_INVALID; diff --git a/lib/x509_b64.c b/lib/x509_b64.c index fcace95a6f..668760a0b3 100644 --- a/lib/x509_b64.c +++ b/lib/x509_b64.c @@ -86,7 +86,7 @@ _gnutls_fbase64_encode(const char *msg, const uint8_t * data, return GNUTLS_E_MEMORY_ERROR; } - bytes = pos = 0; + bytes = 0; INCR(bytes, top_len, max); pos = top_len; |