From 63d0de34df5d43d981410566371b39415bd5a77b Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Mon, 1 Nov 2021 08:28:32 +0000 Subject: Rework x509attribute regress test in such a way that it doesn't need to reach into opaque structs. --- regress/lib/libcrypto/x509/x509attribute.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'regress/lib') 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 * @@ -15,8 +15,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define LIBRESSL_CRYPTO_INTERNAL - #include #include #include @@ -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) -- cgit v1.2.3