summaryrefslogtreecommitdiffstats
path: root/crypto/ts
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-03-05 08:43:06 +0100
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-03-10 16:09:44 +0100
commitda42c2a3d752628e15b47aa7511e7044745080cb (patch)
tree754877a6fd3b6cae5c15543c568fcc526291222b /crypto/ts
parentb5adba204244563346d4acefb06723629e6d8f11 (diff)
Extract sk_ASN1_UTF8STRING2text() from ts_get_status_text() in ts_rsp_verify.c to asn1_lib.c
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11142)
Diffstat (limited to 'crypto/ts')
-rw-r--r--crypto/ts/ts_rsp_verify.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/crypto/ts/ts_rsp_verify.c b/crypto/ts/ts_rsp_verify.c
index 7d2161f2d0..dfb068c8b6 100644
--- a/crypto/ts/ts_rsp_verify.c
+++ b/crypto/ts/ts_rsp_verify.c
@@ -495,34 +495,7 @@ static int ts_check_status_info(TS_RESP *response)
static char *ts_get_status_text(STACK_OF(ASN1_UTF8STRING) *text)
{
- int i;
- int length = 0;
- char *result = NULL;
- char *p;
-
- for (i = 0; i < sk_ASN1_UTF8STRING_num(text); ++i) {
- ASN1_UTF8STRING *current = sk_ASN1_UTF8STRING_value(text, i);
- if (ASN1_STRING_length(current) > TS_MAX_STATUS_LENGTH - length - 1)
- return NULL;
- length += ASN1_STRING_length(current);
- length += 1; /* separator character */
- }
- if ((result = OPENSSL_malloc(length)) == NULL) {
- TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE);
- return NULL;
- }
-
- for (i = 0, p = result; i < sk_ASN1_UTF8STRING_num(text); ++i) {
- ASN1_UTF8STRING *current = sk_ASN1_UTF8STRING_value(text, i);
- length = ASN1_STRING_length(current);
- if (i > 0)
- *p++ = '/';
- strncpy(p, (const char *)ASN1_STRING_get0_data(current), length);
- p += length;
- }
- *p = '\0';
-
- return result;
+ return sk_ASN1_UTF8STRING2text(text, "/", TS_MAX_STATUS_LENGTH);
}
static int ts_check_policy(const ASN1_OBJECT *req_oid,