Ignore unused return values from some sk_*() macros

Some compilers are very picky about unused return values.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12781)
This commit is contained in:
Matt Caswell 2020-09-10 16:34:17 +01:00
parent 89b46350a3
commit 225c9660a5
7 changed files with 12 additions and 8 deletions

View File

@ -445,7 +445,11 @@ int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val)
return 0;
}
}
sk_void_set(ad->sk, idx, val);
if (sk_void_set(ad->sk, idx, val) != val) {
/* Probably the index is out of bounds */
CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA, ERR_R_PASSED_INVALID_ARGUMENT);
return 0;
}
return 1;
}

View File

@ -316,7 +316,7 @@ int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid,
if (impl->method.method == method) {
impl_free(impl);
sk_IMPLEMENTATION_delete(alg->impls, i);
(void)sk_IMPLEMENTATION_delete(alg->impls, i);
ossl_property_unlock(store);
return 1;
}

View File

@ -1257,7 +1257,7 @@ static int addr_validate_path_internal(X509_STORE_CTX *ctx,
|| addr_contains(fp->ipAddressChoice->u.addressesOrRanges,
fc->ipAddressChoice->u.addressesOrRanges,
length_from_afi(X509v3_addr_get_afi(fc))))
sk_IPAddressFamily_set(child, j, fp);
(void)sk_IPAddressFamily_set(child, j, fp);
else
validation_err(X509_V_ERR_UNNESTED_RESOURCE);
}

View File

@ -1683,7 +1683,7 @@ static int check_policy(X509_STORE_CTX *ctx)
ret = X509_policy_check(&ctx->tree, &ctx->explicit_policy, ctx->chain,
ctx->param->policies, ctx->param->flags);
if (ctx->bare_ta_signed)
sk_X509_pop(ctx->chain);
(void)sk_X509_pop(ctx->chain);
if (ret == X509_PCY_TREE_INTERNAL) {
X509err(X509_F_CHECK_POLICY, ERR_R_MALLOC_FAILURE);

View File

@ -186,7 +186,7 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
entry->set = i;
if (!sk_X509_NAME_ENTRY_push(nm.x->entries, entry))
goto err;
sk_X509_NAME_ENTRY_set(entries, j, NULL);
(void)sk_X509_NAME_ENTRY_set(entries, j, NULL);
}
}
ret = x509_name_canon(nm.x);

View File

@ -1379,7 +1379,7 @@ static int update_cipher_list(STACK_OF(SSL_CIPHER) **cipher_list,
while (sk_SSL_CIPHER_num(tmp_cipher_list) > 0
&& sk_SSL_CIPHER_value(tmp_cipher_list, 0)->min_tls
== TLS1_3_VERSION)
sk_SSL_CIPHER_delete(tmp_cipher_list, 0);
(void)sk_SSL_CIPHER_delete(tmp_cipher_list, 0);
/* Insert the new TLSv1.3 ciphersuites */
for (i = 0; i < sk_SSL_CIPHER_num(tls13_ciphersuites); i++)

View File

@ -131,7 +131,7 @@ static int test_int_stack(int reserve)
/* sorting */
if (!TEST_false(sk_sint_is_sorted(s)))
goto end;
sk_sint_set_cmp_func(s, &int_compare);
(void)sk_sint_set_cmp_func(s, &int_compare);
sk_sint_sort(s);
if (!TEST_true(sk_sint_is_sorted(s)))
goto end;
@ -237,7 +237,7 @@ static int test_uchar_stack(int reserve)
goto end;
/* set */
sk_uchar_set(r, 1, v + 1);
(void)sk_uchar_set(r, 1, v + 1);
for (i = 0; i < 2; i++)
if (!TEST_ptr_eq(sk_uchar_value(r, i), v + i)) {
TEST_info("uchar set %d", i);