summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_print.c')
-rw-r--r--src/lib/libcrypto/asn1/a_print.c56
1 files changed, 11 insertions, 45 deletions
diff --git a/src/lib/libcrypto/asn1/a_print.c b/src/lib/libcrypto/asn1/a_print.c
index 3023361dee..8035513f04 100644
--- a/src/lib/libcrypto/asn1/a_print.c
+++ b/src/lib/libcrypto/asn1/a_print.c
@@ -58,49 +58,9 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62 62
63/* ASN1err(ASN1_F_D2I_ASN1_PRINT_TYPE,ASN1_R_WRONG_PRINTABLE_TYPE); 63int ASN1_PRINTABLE_type(unsigned char *s, int len)
64 * ASN1err(ASN1_F_D2I_ASN1_PRINT_TYPE,ASN1_R_TAG_VALUE_TOO_HIGH);
65 */
66
67int i2d_ASN1_IA5STRING(a,pp)
68ASN1_IA5STRING *a;
69unsigned char **pp;
70 { return(M_i2d_ASN1_IA5STRING(a,pp)); }
71
72ASN1_IA5STRING *d2i_ASN1_IA5STRING(a,pp,l)
73ASN1_IA5STRING **a;
74unsigned char **pp;
75long l;
76 { return(M_d2i_ASN1_IA5STRING(a,pp,l)); }
77
78ASN1_T61STRING *d2i_ASN1_T61STRING(a,pp,l)
79ASN1_T61STRING **a;
80unsigned char **pp;
81long l;
82 { return(M_d2i_ASN1_T61STRING(a,pp,l)); }
83
84ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(a,pp,l)
85ASN1_PRINTABLESTRING **a;
86unsigned char **pp;
87long l;
88 { return(M_d2i_ASN1_PRINTABLESTRING(a,pp,l)); }
89
90int i2d_ASN1_PRINTABLE(a,pp)
91ASN1_STRING *a;
92unsigned char **pp;
93 { return(M_i2d_ASN1_PRINTABLE(a,pp)); }
94
95ASN1_STRING *d2i_ASN1_PRINTABLE(a,pp,l)
96ASN1_STRING **a;
97unsigned char **pp;
98long l;
99 { return(M_d2i_ASN1_PRINTABLE(a,pp,l)); }
100
101int ASN1_PRINTABLE_type(s,len)
102unsigned char *s;
103int len;
104 { 64 {
105 int c; 65 int c;
106 int ia5=0; 66 int ia5=0;
@@ -112,6 +72,7 @@ int len;
112 while ((*s) && (len-- != 0)) 72 while ((*s) && (len-- != 0))
113 { 73 {
114 c= *(s++); 74 c= *(s++);
75#ifndef CHARSET_EBCDIC
115 if (!( ((c >= 'a') && (c <= 'z')) || 76 if (!( ((c >= 'a') && (c <= 'z')) ||
116 ((c >= 'A') && (c <= 'Z')) || 77 ((c >= 'A') && (c <= 'Z')) ||
117 (c == ' ') || 78 (c == ' ') ||
@@ -125,14 +86,20 @@ int len;
125 ia5=1; 86 ia5=1;
126 if (c&0x80) 87 if (c&0x80)
127 t61=1; 88 t61=1;
89#else
90 if (!isalnum(c) && (c != ' ') &&
91 strchr("'()+,-./:=?", c) == NULL)
92 ia5=1;
93 if (os_toascii[c] & 0x80)
94 t61=1;
95#endif
128 } 96 }
129 if (t61) return(V_ASN1_T61STRING); 97 if (t61) return(V_ASN1_T61STRING);
130 if (ia5) return(V_ASN1_IA5STRING); 98 if (ia5) return(V_ASN1_IA5STRING);
131 return(V_ASN1_PRINTABLESTRING); 99 return(V_ASN1_PRINTABLESTRING);
132 } 100 }
133 101
134int ASN1_UNIVERSALSTRING_to_string(s) 102int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)
135ASN1_UNIVERSALSTRING *s;
136 { 103 {
137 int i; 104 int i;
138 unsigned char *p; 105 unsigned char *p;
@@ -158,4 +125,3 @@ ASN1_UNIVERSALSTRING *s;
158 s->type=ASN1_PRINTABLE_type(s->data,s->length); 125 s->type=ASN1_PRINTABLE_type(s->data,s->length);
159 return(1); 126 return(1);
160 } 127 }
161