Remove the ASN1_STRING_FLAG_X509_TIME flag

It's only use was to do some somewhat confused cruftery
inside of ossl_asn1_time_to_tm as a special case to
implement ASN1_TIME_set_string_X509.

As it turns out, you don't need the cruftery of a special
case inside of ossl_asn1_time_to_tm to implement this
function, so the flag is completely unnecessary.

This removes flag, and simplifies this to work without it.

It removes the cruft only from ossl_asn1_time_to_tm,
minimally. This function really needs some cleanup and
makes my eyes bleed but I am resisting the temptation
to do that with this PR and making this a the minimal
change needed for review. I will clean up that function
in a follow on pr.

As tests on the behaviour of ASN1_TIME_set_string_X509
were added with it, Beyonce dances happily for me and I
only need to pass the existing tests, not write as bunch
of new ones.. .

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29187)
This commit is contained in:
Bob Beck
2025-11-20 17:06:11 -07:00
committed by Neil Horman
parent 441a2c105c
commit 61c876198d
3 changed files with 46 additions and 69 deletions

View File

@@ -160,8 +160,6 @@ extern "C" {
#define ASN1_STRING_FLAG_MSTRING 0x040
/* String is embedded and only content should be freed */
#define ASN1_STRING_FLAG_EMBED 0x080
/* String should be parsed in RFC 5280's time format */
#define ASN1_STRING_FLAG_X509_TIME 0x100
/* This is the base type that holds just about everything :-) */
struct asn1_string_st {
int length;