summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-07-24 20:02:05 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-07-24 20:02:05 +0000
commit48f53c3225b6fcf94538764055ba5ffc16c5b7d5 (patch)
tree043c58ec058a748c111da6138634fa7c9342f957 /lib
parent0637b1db15802cf1b36ee618a69c9694ba3ae332 (diff)
Prepare to resurrect TS_RESP_CTX_set_time_cb()
This was removed shortly after the fork since TS is not 2038-ready and since there were no consumers of this API. Now there are consumers and they add it themselves if it's missing from libcrypto. This will no longer be possible with opaque TS structs, so begrudgingly add it back. ok jsing kn
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/ts/ts.h7
-rw-r--r--lib/libcrypto/ts/ts_rsp_sign.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/libcrypto/ts/ts.h b/lib/libcrypto/ts/ts.h
index 83bd6829ae4..0397fb8b087 100644
--- a/lib/libcrypto/ts/ts.h
+++ b/lib/libcrypto/ts/ts.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ts.h,v 1.17 2022/07/24 19:54:46 tb Exp $ */
+/* $OpenBSD: ts.h,v 1.18 2022/07/24 20:02:04 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL
* project 2002, 2003, 2004.
*/
@@ -567,6 +567,11 @@ void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags);
/* Default callback always returns a constant. */
void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data);
+#if defined(LIBRESSL_INTERNAL)
+/* Default callback uses gettimeofday() and gmtime(). */
+void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data);
+#endif
+
/* Default callback rejects all extensions. The extension callback is called
* when the TS_TST_INFO object is already set up and not signed yet. */
/* FIXME: extension handling is not tested yet. */
diff --git a/lib/libcrypto/ts/ts_rsp_sign.c b/lib/libcrypto/ts/ts_rsp_sign.c
index 665dc1cec49..5e152954bf1 100644
--- a/lib/libcrypto/ts/ts_rsp_sign.c
+++ b/lib/libcrypto/ts/ts_rsp_sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ts_rsp_sign.c,v 1.28 2022/07/24 08:16:47 tb Exp $ */
+/* $OpenBSD: ts_rsp_sign.c,v 1.29 2022/07/24 20:02:04 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
* project 2002.
*/
@@ -143,6 +143,13 @@ def_extension_cb(struct TS_resp_ctx *ctx, X509_EXTENSION *ext, void *data)
return 0;
}
+void
+TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data)
+{
+ ctx->time_cb = cb;
+ ctx->time_cb_data = data;
+}
+
/* TS_RESP_CTX management functions. */
TS_RESP_CTX *