From: tb Date: Sun, 24 Jul 2022 19:25:36 +0000 (+0000) Subject: Prepare to provide various TS_STATUS_INFO accessors X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=65294ebe4a7abe212abb756caaf778b75fdd9c7e;p=openbsd Prepare to provide various TS_STATUS_INFO accessors 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 --- diff --git a/lib/libcrypto/ts/ts.h b/lib/libcrypto/ts/ts.h index 31b916983ed..3c6baf82e07 100644 --- a/lib/libcrypto/ts/ts.h +++ b/lib/libcrypto/ts/ts.h @@ -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); diff --git a/lib/libcrypto/ts/ts_rsp_utils.c b/lib/libcrypto/ts/ts_rsp_utils.c index 995dbb80358..2e37f26fdae 100644 --- a/lib/libcrypto/ts/ts_rsp_utils.c +++ b/lib/libcrypto/ts/ts_rsp_utils.c @@ -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)