diff options
| author | tb <> | 2024-05-03 18:22:26 +0000 |
|---|---|---|
| committer | tb <> | 2024-05-03 18:22:26 +0000 |
| commit | b6b12c6b4d7e44619caf93e9c143c523b7ddfc2e (patch) | |
| tree | 635373b6dca425815af7816066c7fbf0e63aa3bc /src | |
| parent | 5458c6b35188e632472b2dbc209e92c1bca51c23 (diff) | |
| download | openbsd-b6b12c6b4d7e44619caf93e9c143c523b7ddfc2e.tar.gz openbsd-b6b12c6b4d7e44619caf93e9c143c523b7ddfc2e.tar.bz2 openbsd-b6b12c6b4d7e44619caf93e9c143c523b7ddfc2e.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_time_tm.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/a_time_tm.c b/src/lib/libcrypto/asn1/a_time_tm.c index 283a5c4453..d729af5f65 100644 --- a/src/lib/libcrypto/asn1/a_time_tm.c +++ b/src/lib/libcrypto/asn1/a_time_tm.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_time_tm.c,v 1.39 2024/05/03 18:15:27 tb Exp $ */ | 1 | /* $OpenBSD: a_time_tm.c,v 1.40 2024/05/03 18:22:26 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -322,15 +322,14 @@ static int | |||
| 322 | ASN1_TIME_set_string_internal(ASN1_TIME *s, const char *str, int mode) | 322 | ASN1_TIME_set_string_internal(ASN1_TIME *s, const char *str, int mode) |
| 323 | { | 323 | { |
| 324 | struct tm tm; | 324 | struct tm tm; |
| 325 | int type; | ||
| 326 | 325 | ||
| 327 | if ((type = ASN1_time_parse(str, strlen(str), &tm, mode)) == -1) | 326 | if (ASN1_time_parse(str, strlen(str), &tm, mode) == -1) |
| 328 | return 0; | 327 | return 0; |
| 329 | switch (mode) { | 328 | switch (mode) { |
| 330 | case V_ASN1_UTCTIME: | 329 | case V_ASN1_UTCTIME: |
| 331 | return type == mode && tm_to_utctime(&tm, s); | 330 | return tm_to_utctime(&tm, s); |
| 332 | case V_ASN1_GENERALIZEDTIME: | 331 | case V_ASN1_GENERALIZEDTIME: |
| 333 | return type == mode && tm_to_gentime(&tm, s); | 332 | return tm_to_gentime(&tm, s); |
| 334 | case RFC5280: | 333 | case RFC5280: |
| 335 | return tm_to_rfc5280_time(&tm, s); | 334 | return tm_to_rfc5280_time(&tm, s); |
| 336 | default: | 335 | default: |
