Prepare to provide various TS_STATUS_INFO accessors
authortb <tb@openbsd.org>
Sun, 24 Jul 2022 19:25:36 +0000 (19:25 +0000)
committertb <tb@openbsd.org>
Sun, 24 Jul 2022 19:25:36 +0000 (19:25 +0000)
This adds TS_STATUS_get0_{failure_info,text,status}() as well as
TS_STATUS_INFO_set_status(). These will be needed by Ruby and openssl(1)
when we make the structs in ts.h opaque.

ok kn jsing

lib/libcrypto/ts/ts.h
lib/libcrypto/ts/ts_rsp_utils.c

index 31b9169..3c6baf8 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ts.h,v 1.15 2022/07/24 08:16:47 tb Exp $ */
+/* $OpenBSD: ts.h,v 1.16 2022/07/24 19:25:36 tb Exp $ */
 /* Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL
  * project 2002, 2003, 2004.
  */
@@ -398,6 +398,14 @@ int TS_REQ_print_bio(BIO *bio, TS_REQ *a);
 int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info);
 TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a);
 
+#if defined(LIBRESSL_INTERNAL)
+const ASN1_UTF8STRING *TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *si);
+const STACK_OF(ASN1_UTF8STRING) *
+    TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *si);
+const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *si);
+int TS_STATUS_INFO_set_status(TS_STATUS_INFO *si, int i);
+#endif
+
 /* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
 void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info);
 PKCS7 *TS_RESP_get_token(TS_RESP *a);
index 995dbb8..2e37f26 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ts_rsp_utils.c,v 1.8 2022/07/24 08:16:47 tb Exp $ */
+/* $OpenBSD: ts_rsp_utils.c,v 1.9 2022/07/24 19:25:36 tb Exp $ */
 /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
  * project 2002.
  */
@@ -91,6 +91,30 @@ TS_RESP_get_status_info(TS_RESP *a)
        return a->status_info;
 }
 
+const ASN1_UTF8STRING *
+TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *si)
+{
+       return si->failure_info;
+}
+
+const STACK_OF(ASN1_UTF8STRING) *
+TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *si)
+{
+       return si->text;
+}
+
+const ASN1_INTEGER *
+TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *si)
+{
+       return si->status;
+}
+
+int
+TS_STATUS_INFO_set_status(TS_STATUS_INFO *si, int i)
+{
+       return ASN1_INTEGER_set(si->status, i);
+}
+
 /* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
 void
 TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info)