summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-08-24 04:54:27 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-08-24 04:54:27 +0000
commit0aed0ecadb444e4fd1a72d8900bb57b087524442 (patch)
tree92b9df7c32fc1bbbc6e72410ccbe16dccbf53b29 /lib
parent166b5aa72da4a1abf3faf2993139c7f3747c43ff (diff)
Some tweaking of cms_content_bio()
More idiomatic error checking and drop an always false test for !*pos. Use a slightly closer approximation to actual English sentences in comments. ok jsing
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/cms/cms_lib.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/libcrypto/cms/cms_lib.c b/lib/libcrypto/cms/cms_lib.c
index 950d8764ad2..5891302fdff 100644
--- a/lib/libcrypto/cms/cms_lib.c
+++ b/lib/libcrypto/cms/cms_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_lib.c,v 1.22 2023/08/24 04:46:56 tb Exp $ */
+/* $OpenBSD: cms_lib.c,v 1.23 2023/08/24 04:54:26 tb Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -124,20 +124,20 @@ cms_Data_create(void)
BIO *
cms_content_bio(CMS_ContentInfo *cms)
{
- ASN1_OCTET_STRING **pos = CMS_get0_content(cms);
+ ASN1_OCTET_STRING **pos;
- if (!pos)
+ if ((pos = CMS_get0_content(cms)) == NULL)
return NULL;
- /* If content detached data goes nowhere: create NULL BIO */
- if (!*pos)
+
+ /* If content is detached, data goes nowhere: create null BIO. */
+ if (*pos == NULL)
return BIO_new(BIO_s_null());
- /*
- * If content not detached and created return memory BIO
- */
- if (!*pos || ((*pos)->flags == ASN1_STRING_FLAG_CONT))
+
+ /* If content is not detached and was created, return memory BIO. */
+ if ((*pos)->flags == ASN1_STRING_FLAG_CONT)
return BIO_new(BIO_s_mem());
- /* Else content was read in: return read only BIO for it */
+ /* Else content was read in: return read-only BIO for it. */
return BIO_new_mem_buf((*pos)->data, (*pos)->length);
}