summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2021-11-01 08:28:32 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2021-11-01 08:28:32 +0000
commit63d0de34df5d43d981410566371b39415bd5a77b (patch)
treec26eb1758d78ac65d85a72fb5a82775e1cb4a7d9 /regress/lib
parent5f8de3ca96b7296e0b92c0e1f7083fa222039059 (diff)
Rework x509attribute regress test in such a way that it doesn't need
to reach into opaque structs.
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libcrypto/x509/x509attribute.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/regress/lib/libcrypto/x509/x509attribute.c b/regress/lib/libcrypto/x509/x509attribute.c
index 4f981144582..908935cb6e3 100644
--- a/regress/lib/libcrypto/x509/x509attribute.c
+++ b/regress/lib/libcrypto/x509/x509attribute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509attribute.c,v 1.2 2021/10/31 08:27:15 tb Exp $ */
+/* $OpenBSD: x509attribute.c,v 1.3 2021/11/01 08:28:31 tb Exp $ */
/*
* Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -15,8 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define LIBRESSL_CRYPTO_INTERNAL
-
#include <errno.h>
#include <stdio.h>
#include <string.h>
@@ -85,14 +83,12 @@ main(void)
if ((attrib = X509_ATTRIBUTE_create(NID_pkcs9_contentType,
V_ASN1_OBJECT, coid)) == NULL)
fail_str("X509_ATTRIBUTE_create", "NULL");
- else if (attrib->object == NULL)
- fail_str("attrib->object", "NULL");
- else if (attrib->single)
- fail_int("attrib->single", attrib->single);
- else if ((num = sk_ASN1_TYPE_num(attrib->value.set)) != 1)
- fail_int("num", num);
- else if ((any = sk_ASN1_TYPE_value(attrib->value.set, 0)) == NULL)
- fail_str("any", "NULL");
+ else if (X509_ATTRIBUTE_get0_object(attrib) == NULL)
+ fail_str("X509_ATTRIBUTE_get0_object", "NULL");
+ else if ((num = X509_ATTRIBUTE_count(attrib)) != 1)
+ fail_int("X509_ATTRIBUTE_count", num);
+ else if ((any = X509_ATTRIBUTE_get0_type(attrib, 0)) == NULL)
+ fail_str("X509_ATTRIBUTE_get0_type", "NULL");
else if (any->type != V_ASN1_OBJECT)
fail_int("any->type", any->type);
else if (any->value.object != coid)