diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-09-22 16:05:33 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-09-22 16:05:33 +0100 |
commit | 0d0099ea3b1825fe51bce11e076292e408b55feb (patch) | |
tree | ab8f54fdbc335fbe23b15a791a72c478640776ee /crypto/asn1/a_print.c | |
parent | 035014cd22c502bca93c73e6475da73ee31f1078 (diff) |
Move functions.
Move various functions tagged onto t_x509.c to more appropriate places.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/asn1/a_print.c')
-rw-r--r-- | crypto/asn1/a_print.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crypto/asn1/a_print.c b/crypto/asn1/a_print.c index 05d12a5927..9ad4866b04 100644 --- a/crypto/asn1/a_print.c +++ b/crypto/asn1/a_print.c @@ -126,3 +126,32 @@ int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s) s->type = ASN1_PRINTABLE_type(s->data, s->length); 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); +} |