No functional change.
-/* $OpenBSD: a_strex.c,v 1.30 2021/12/14 17:35:21 jsing Exp $ */
+/* $OpenBSD: a_strex.c,v 1.31 2021/12/25 12:11:57 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
{
return do_print_ex(send_fp_chars, fp, flags, str);
}
-
-/* Utility function: convert any string type to UTF8, returns number of bytes
- * in output string or a negative error code
- */
-
-int
-ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in)
-{
- ASN1_STRING stmp, *str = &stmp;
- int mbflag, ret;
-
- if (!in)
- return -1;
-
- if ((mbflag = asn1_tag2charwidth(in->type)) == -1)
- return -1;
- mbflag |= MBSTRING_FLAG;
-
- stmp.data = NULL;
- stmp.length = 0;
- ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag,
- B_ASN1_UTF8STRING);
- if (ret < 0)
- return ret;
- *out = stmp.data;
- return stmp.length;
-}
-/* $OpenBSD: a_string.c,v 1.2 2021/12/24 14:12:26 jsing Exp $ */
+/* $OpenBSD: a_string.c,v 1.3 2021/12/25 12:11:57 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <openssl/buffer.h>
#include <openssl/err.h>
+#include "asn1_locl.h"
+
ASN1_STRING *
ASN1_STRING_new(void)
{
return (x->data);
}
+int
+ASN1_STRING_print(BIO *bp, const ASN1_STRING *v)
+{
+ int i, n;
+ char buf[80];
+ const char *p;
+
+ if (v == NULL)
+ return (0);
+ n = 0;
+ p = (const char *)v->data;
+ for (i = 0; i < v->length; i++) {
+ if ((p[i] > '~') || ((p[i] < ' ') &&
+ (p[i] != '\n') && (p[i] != '\r')))
+ buf[n] = '.';
+ else
+ buf[n] = p[i];
+ n++;
+ if (n >= 80) {
+ if (BIO_write(bp, buf, n) <= 0)
+ return (0);
+ n = 0;
+ }
+ }
+ if (n > 0)
+ if (BIO_write(bp, buf, n) <= 0)
+ return (0);
+ return (1);
+}
+
+/*
+ * Utility function: convert any string type to UTF8, returns number of bytes
+ * in output string or a negative error code
+ */
+int
+ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in)
+{
+ ASN1_STRING stmp, *str = &stmp;
+ int mbflag, ret;
+
+ if (!in)
+ return -1;
+
+ if ((mbflag = asn1_tag2charwidth(in->type)) == -1)
+ return -1;
+ mbflag |= MBSTRING_FLAG;
+
+ stmp.data = NULL;
+ stmp.length = 0;
+ ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag,
+ B_ASN1_UTF8STRING);
+ if (ret < 0)
+ return ret;
+ *out = stmp.data;
+ return stmp.length;
+}
+
int
i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type)
{
-/* $OpenBSD: t_x509.c,v 1.35 2021/11/01 20:53:08 tb Exp $ */
+/* $OpenBSD: t_x509.c,v 1.36 2021/12/25 12:11:57 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return 1;
}
-int
-ASN1_STRING_print(BIO *bp, const ASN1_STRING *v)
-{
- int i, n;
- char buf[80];
- const char *p;
-
- if (v == NULL)
- return (0);
- n = 0;
- p = (const char *)v->data;
- for (i = 0; i < v->length; i++) {
- if ((p[i] > '~') || ((p[i] < ' ') &&
- (p[i] != '\n') && (p[i] != '\r')))
- buf[n] = '.';
- else
- buf[n] = p[i];
- n++;
- if (n >= 80) {
- if (BIO_write(bp, buf, n) <= 0)
- return (0);
- n = 0;
- }
- }
- if (n > 0)
- if (BIO_write(bp, buf, n) <= 0)
- return (0);
- return (1);
-}
-
int
ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
{