CVSROOT:        /cvs
Module name:    src
Changes by:     t...@cvs.openbsd.org    2022/04/28 11:31:29

Modified files:
        lib/libcrypto/asn1: a_time_tm.c 

Log message:
Refactor ASN1_TIME_adj_internal()

ASN1_TIME_adj_internal() does some strange dances with remembering
allocations in a boolean and using strlen(p) to deduce what happened
inside *_string_from_tm(). It also (mis)translates a NULL p to an
illegal time value error.

This can be streamlined by converting directly from a struct tm into an
ASN1_TIME and setting the errors when they occur instead of trying to
deduce them from a NULL return. This is made a bit uglier than necessary
due to the reuse-or-allocate semantics of the public API.

At the cost of a little code duplication, ASN1_TIME_adj_internal()
becomes very easy and ASN1_TIME_to_generalizedtime() is also simplified
somewhat.

ok inoguchi jsing

Reply via email to