message = "cert has an invalid not after field";
break;
default:
- message= "cert is invalid for an unspecfied reason";
+ message = "cert is invalid for an unspecfied reason";
break;
}
* (-1, 0, or 1) in *out_comparison.
*/
static int x509_cmp_time_internal(const ASN1_TIME *ctm, const time_t *cmp_time,
- int* out_comparison)
+ int *out_comparison)
{
time_t t = cmp_time == NULL ? time(NULL) : *cmp_time;
int comparison;
* Return 1 on success, 0 otherwise.
*/
int ossl_x509_compare_asn1_time(const X509_VERIFY_PARAM *vpm,
- const ASN1_TIME *time, int *comparison)
+ const ASN1_TIME *asn1_time, int *comparison)
{
+ const time_t now = time(NULL);
const time_t *check_time = NULL;
- if ((vpm->flags & X509_V_FLAG_USE_CHECK_TIME) != 0) {
+ if (vpm == NULL) {
+ check_time = &now;
+ } else if ((vpm->flags & X509_V_FLAG_USE_CHECK_TIME) != 0) {
check_time = &vpm->check_time;
} else if ((vpm->flags & X509_V_FLAG_NO_CHECK_TIME) != 0) {
*comparison = 0;
return 1;
}
- return x509_cmp_time_internal(time, check_time, comparison);
+ return x509_cmp_time_internal(asn1_time, check_time, comparison);
}
/*-
-/* Copyright 2016-2025 The OpenSSL Project Authors. All Rights Reserved.
+/*
+ * Copyright 2016-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
return 0;
}
-static int do_x509_time_tests(CERT_TEST_DATA *tests, size_t ntests, int64_t lower_limit, int64_t upper_limit)
+static int do_x509_time_tests(CERT_TEST_DATA *tests, size_t ntests,
+ int64_t lower_limit, int64_t upper_limit)
{
int ret = 0;
int failures = 0;