summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_strex.c
diff options
context:
space:
mode:
authordjm <>2011-11-03 02:32:23 +0000
committerdjm <>2011-11-03 02:32:23 +0000
commit113f799ec7d1728f0a5d7ab5b0e3b42e3de56407 (patch)
tree26d712b25a8fa580b8f2dfc6df470ba5ffea9eb7 /src/lib/libcrypto/asn1/a_strex.c
parent829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2 (diff)
downloadopenbsd-113f799ec7d1728f0a5d7ab5b0e3b42e3de56407.tar.gz
openbsd-113f799ec7d1728f0a5d7ab5b0e3b42e3de56407.tar.bz2
openbsd-113f799ec7d1728f0a5d7ab5b0e3b42e3de56407.zip
import OpenSSL 1.0.0e
Diffstat (limited to 'src/lib/libcrypto/asn1/a_strex.c')
-rw-r--r--src/lib/libcrypto/asn1/a_strex.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c
index 7fc14d3296..264ebf2393 100644
--- a/src/lib/libcrypto/asn1/a_strex.c
+++ b/src/lib/libcrypto/asn1/a_strex.c
@@ -74,6 +74,11 @@
74 74
75#define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253) 75#define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
76 76
77#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
78 ASN1_STRFLGS_ESC_QUOTE | \
79 ASN1_STRFLGS_ESC_CTRL | \
80 ASN1_STRFLGS_ESC_MSB)
81
77 82
78/* Three IO functions for sending data to memory, a BIO and 83/* Three IO functions for sending data to memory, a BIO and
79 * and a FILE pointer. 84 * and a FILE pointer.
@@ -148,6 +153,13 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch
148 if(!io_ch(arg, tmphex, 3)) return -1; 153 if(!io_ch(arg, tmphex, 3)) return -1;
149 return 3; 154 return 3;
150 } 155 }
156 /* If we get this far and do any escaping at all must escape
157 * the escape character itself: backslash.
158 */
159 if (chtmp == '\\' && flags & ESC_FLAGS) {
160 if(!io_ch(arg, "\\\\", 2)) return -1;
161 return 2;
162 }
151 if(!io_ch(arg, &chtmp, 1)) return -1; 163 if(!io_ch(arg, &chtmp, 1)) return -1;
152 return 1; 164 return 1;
153} 165}
@@ -292,11 +304,6 @@ static const signed char tag2nbyte[] = {
292 4, -1, 2 /* 28-30 */ 304 4, -1, 2 /* 28-30 */
293}; 305};
294 306
295#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
296 ASN1_STRFLGS_ESC_QUOTE | \
297 ASN1_STRFLGS_ESC_CTRL | \
298 ASN1_STRFLGS_ESC_MSB)
299
300/* This is the main function, print out an 307/* This is the main function, print out an
301 * ASN1_STRING taking note of various escape 308 * ASN1_STRING taking note of various escape
302 * and display options. Returns number of 309 * and display options. Returns number of