diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index 64cb1b562..f6f9c4634 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index d8ec85f7c..d2c672c02 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -55,7 +55,7 @@ * [including the GNU Public Licence.] */ #include -#include +#include #include #include diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index 2963bbe7a..f21435d8b 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include diff --git a/crypto/asn1/asn1_test.cc b/crypto/asn1/asn1_test.cc index c2e5f5b4d..76d6889e2 100644 --- a/crypto/asn1/asn1_test.cc +++ b/crypto/asn1/asn1_test.cc @@ -29,8 +29,8 @@ #include #include #include +#include #include -#include #include #include "../test/test_util.h" diff --git a/crypto/asn1/posix_time.c b/crypto/asn1/posix_time.c index 31d184c08..5ac4eeb24 100644 --- a/crypto/asn1/posix_time.c +++ b/crypto/asn1/posix_time.c @@ -15,7 +15,7 @@ // Time conversion to/from POSIX time_t and struct tm, with no support // for time zones other than UTC -#include +#include #include #include diff --git a/include/openssl/posix_time.h b/include/openssl/posix_time.h new file mode 100644 index 000000000..7910e3424 --- /dev/null +++ b/include/openssl/posix_time.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2022, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_POSIX_TIME_H +#define OPENSSL_HEADER_POSIX_TIME_H + +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +// Time functions. + + +// OPENSSL_posix_to_tm converts a int64_t POSIX time value in |time|, which must +// be in the range of year 0000 to 9999, to a broken out time value in |tm|. It +// returns one on success and zero on error. +OPENSSL_EXPORT int OPENSSL_posix_to_tm(int64_t time, struct tm *out_tm); + +// OPENSSL_tm_to_posix converts a time value between the years 0 and 9999 in +// |tm| to a POSIX time value in |out|. One is returned on success, zero is +// returned on failure. It is a failure if |tm| contains out of range values. +OPENSSL_EXPORT int OPENSSL_tm_to_posix(const struct tm *tm, int64_t *out); + + +#if defined(__cplusplus) +} // extern C +#endif + +#endif // OPENSSL_HEADER_POSIX_TIME_H diff --git a/include/openssl/time.h b/include/openssl/time.h index 50db22d32..690959470 100644 --- a/include/openssl/time.h +++ b/include/openssl/time.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2022, Google Inc. +/* Copyright (c) 2024, Google Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,31 +15,8 @@ #ifndef OPENSSL_HEADER_TIME_H #define OPENSSL_HEADER_TIME_H -#include +// Compatibility header, to be deprecated. use instead. -#include - -#if defined(__cplusplus) -extern "C" { -#endif - - -// Time functions. - - -// OPENSSL_posix_to_tm converts a int64_t POSIX time value in |time|, which must -// be in the range of year 0000 to 9999, to a broken out time value in |tm|. It -// returns one on success and zero on error. -OPENSSL_EXPORT int OPENSSL_posix_to_tm(int64_t time, struct tm *out_tm); - -// OPENSSL_tm_to_posix converts a time value between the years 0 and 9999 in -// |tm| to a POSIX time value in |out|. One is returned on success, zero is -// returned on failure. It is a failure if |tm| contains out of range values. -OPENSSL_EXPORT int OPENSSL_tm_to_posix(const struct tm *tm, int64_t *out); - - -#if defined(__cplusplus) -} // extern C -#endif +#include #endif // OPENSSL_HEADER_TIME_H diff --git a/pki/encode_values.cc b/pki/encode_values.cc index 25dc677b8..0054fa28f 100644 --- a/pki/encode_values.cc +++ b/pki/encode_values.cc @@ -6,7 +6,7 @@ #include "parse_values.h" -#include +#include namespace bssl::der { diff --git a/util/doc.config b/util/doc.config index 29bba6701..d2bc5003a 100644 --- a/util/doc.config +++ b/util/doc.config @@ -14,9 +14,9 @@ "include/openssl/mem.h", "include/openssl/obj.h", "include/openssl/pool.h", + "include/openssl/posix_time.h", "include/openssl/rand.h", - "include/openssl/stack.h", - "include/openssl/time.h" + "include/openssl/stack.h" ] },{ "Name": "Low-level crypto primitives",