From: tb Date: Mon, 2 Oct 2023 11:14:15 +0000 (+0000) Subject: Add some coverage for ASN1_TIME_cmp_time_t() as well X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a1d6a9e32d5c5f297d750058fd9b8bd536898236;p=openbsd Add some coverage for ASN1_TIME_cmp_time_t() as well ASN1_UTCTIME_cmp_tim_t() could be done similarly, but then I have to mess with LIBRESSL_INTERNAL. Let's do this after unlock. --- diff --git a/regress/lib/libcrypto/asn1/asn1time.c b/regress/lib/libcrypto/asn1/asn1time.c index f21c284e1cc..bb58f617221 100644 --- a/regress/lib/libcrypto/asn1/asn1time.c +++ b/regress/lib/libcrypto/asn1/asn1time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1time.c,v 1.19 2023/10/02 10:40:43 tb Exp $ */ +/* $OpenBSD: asn1time.c,v 1.20 2023/10/02 11:14:15 tb Exp $ */ /* * Copyright (c) 2015 Joel Sing * @@ -518,6 +518,19 @@ asn1_time_compare_families(const struct asn1_time_test *fam1, size_t fam1_size, att1->str, att2->str, time_cmp, asn1_cmp); comparison_failure |= 1; } + + time_cmp = ASN1_TIME_cmp_time_t(t1, att2->time); + if (time_cmp != asn1_cmp) { + fprintf(stderr, "%s vs. %lld: want %d, got %d\n", + att1->str, (long long)att2->time, + asn1_cmp, time_cmp); + comparison_failure |= 1; + } + + /* + * XXX - add ASN1_UTCTIME_cmp_time_t later. Don't want + * to mess with LIBRESSL_INTERNAL right before lock. + */ } }