summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorPeiwei Hu <jlu.hpw@foxmail.com>2022-12-02 15:43:01 +0800
committerTomas Mraz <tomas@openssl.org>2022-12-16 19:00:44 +0100
commit4ae8fe6cc8df9ef8567c7b2eab3ae5b669339493 (patch)
tree58dff6f498aba7076d7e63cb083c75f988cb6179 /crypto
parent75fa52ddc97ba21627a2718da8376b75f250bb20 (diff)
Refine the documents of several APIs
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19816) (cherry picked from commit dd1f28427b375931fda45180619c8f5971cd6bca)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/evp_lib.c4
-rw-r--r--crypto/rsa/rsa_sign.c2
-rw-r--r--crypto/x509/x509_v3.c5
-rw-r--r--crypto/x509/x509name.c5
4 files changed, 11 insertions, 5 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index 61640a3488..cf2ea37215 100644
--- a/crypto/evp/evp_lib.c
+++ b/crypto/evp/evp_lib.c
@@ -602,7 +602,7 @@ int EVP_CIPHER_CTX_get_updated_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len)
params[0] =
OSSL_PARAM_construct_octet_string(OSSL_CIPHER_PARAM_UPDATED_IV, buf, len);
- return evp_do_ciph_ctx_getparams(ctx->cipher, ctx->algctx, params);
+ return evp_do_ciph_ctx_getparams(ctx->cipher, ctx->algctx, params) > 0;
}
int EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len)
@@ -611,7 +611,7 @@ int EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len)
params[0] =
OSSL_PARAM_construct_octet_string(OSSL_CIPHER_PARAM_IV, buf, len);
- return evp_do_ciph_ctx_getparams(ctx->cipher, ctx->algctx, params);
+ return evp_do_ciph_ctx_getparams(ctx->cipher, ctx->algctx, params) > 0;
}
unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx)
diff --git a/crypto/rsa/rsa_sign.c b/crypto/rsa/rsa_sign.c
index c5a664dc0b..5745513c2f 100644
--- a/crypto/rsa/rsa_sign.c
+++ b/crypto/rsa/rsa_sign.c
@@ -280,7 +280,7 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
#ifndef FIPS_MODULE
if (rsa->meth->rsa_sign != NULL)
- return rsa->meth->rsa_sign(type, m, m_len, sigret, siglen, rsa);
+ return rsa->meth->rsa_sign(type, m, m_len, sigret, siglen, rsa) > 0;
#endif /* FIPS_MODULE */
/* Compute the encoded digest. */
diff --git a/crypto/x509/x509_v3.c b/crypto/x509/x509_v3.c
index 262061a20f..62ae7d6b8d 100644
--- a/crypto/x509/x509_v3.c
+++ b/crypto/x509/x509_v3.c
@@ -19,9 +19,12 @@
int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x)
{
+ int ret;
+
if (x == NULL)
return 0;
- return sk_X509_EXTENSION_num(x);
+ ret = sk_X509_EXTENSION_num(x);
+ return ret > 0 ? ret : 0;
}
int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, int nid,
diff --git a/crypto/x509/x509name.c b/crypto/x509/x509name.c
index 690e2799ff..9ae0dc5de4 100644
--- a/crypto/x509/x509name.c
+++ b/crypto/x509/x509name.c
@@ -49,9 +49,12 @@ int X509_NAME_get_text_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,
int X509_NAME_entry_count(const X509_NAME *name)
{
+ int ret;
+
if (name == NULL)
return 0;
- return sk_X509_NAME_ENTRY_num(name->entries);
+ ret = sk_X509_NAME_ENTRY_num(name->entries);
+ return ret > 0 ? ret : 0;
}
int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos)