summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-05-03 18:22:27 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-05-03 18:22:27 +0000
commit41f026d02fba75fe94dd6ec82a83efcdd4e7357f (patch)
treebb38d4e4f05e9b9832c3fadb4250dded4b35740c
parent52d9baea22a8008dd973ff1ee16a2c6c94e26ef0 (diff)
Simplify type handling in ASN1_TIME_set_string_internal()
ASN1_time_parse() takes a mode argument. If mode != 0, there is a check that mode is the same as the time type returned by asn1_time_parse_cbs() otherwise ASN1_time_parse() fails. Therefore the type == mode checks in ASN1_set_string_internal() are redundant and can be removed. ok beck
-rw-r--r--lib/libcrypto/asn1/a_time_tm.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libcrypto/asn1/a_time_tm.c b/lib/libcrypto/asn1/a_time_tm.c
index 283a5c44539..d729af5f656 100644
--- a/lib/libcrypto/asn1/a_time_tm.c
+++ b/lib/libcrypto/asn1/a_time_tm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: a_time_tm.c,v 1.39 2024/05/03 18:15:27 tb Exp $ */
+/* $OpenBSD: a_time_tm.c,v 1.40 2024/05/03 18:22:26 tb Exp $ */
/*
* Copyright (c) 2015 Bob Beck <beck@openbsd.org>
*
@@ -322,15 +322,14 @@ static int
ASN1_TIME_set_string_internal(ASN1_TIME *s, const char *str, int mode)
{
struct tm tm;
- int type;
- if ((type = ASN1_time_parse(str, strlen(str), &tm, mode)) == -1)
+ if (ASN1_time_parse(str, strlen(str), &tm, mode) == -1)
return 0;
switch (mode) {
case V_ASN1_UTCTIME:
- return type == mode && tm_to_utctime(&tm, s);
+ return tm_to_utctime(&tm, s);
case V_ASN1_GENERALIZEDTIME:
- return type == mode && tm_to_gentime(&tm, s);
+ return tm_to_gentime(&tm, s);
case RFC5280:
return tm_to_rfc5280_time(&tm, s);
default: