Revert "Make it possible to have RFC2254 escapes with ASN1_STRING_print_ex()"
[openssl.git] / crypto / asn1 / a_strex.c
index 5fa7a31500a4083461827c595e5c7dc5b103d0f7..35fd44cd22b8e7438aad1fbdd257913c893cf682 100644 (file)
@@ -75,7 +75,6 @@
 #define CHARTYPE_BS_ESC         (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
 
 #define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
-                  ASN1_STRFLGS_ESC_2254 | \
                   ASN1_STRFLGS_ESC_QUOTE | \
                   ASN1_STRFLGS_ESC_CTRL | \
                   ASN1_STRFLGS_ESC_MSB)
@@ -125,8 +124,7 @@ typedef int char_io (void *arg, const void *buf, int len);
 static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes,
                        char_io *io_ch, void *arg)
 {
-    unsigned short chflgs;
-    unsigned char chtmp;
+    unsigned char chflgs, chtmp;
     char tmphex[HEX_SIZE(long) + 3];
 
     if (c > 0xffffffffL)
@@ -163,9 +161,7 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes,
             return -1;
         return 2;
     }
-    if (chflgs & (ASN1_STRFLGS_ESC_CTRL
-                  | ASN1_STRFLGS_ESC_MSB
-                  | ASN1_STRFLGS_ESC_2254)) {
+    if (chflgs & (ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB)) {
         BIO_snprintf(tmphex, 11, "\\%02X", chtmp);
         if (!io_ch(arg, tmphex, 3))
             return -1;
@@ -195,12 +191,11 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes,
  */
 
 static int do_buf(unsigned char *buf, int buflen,
-                  int type, unsigned short flags, char *quotes, char_io *io_ch,
+                  int type, unsigned char flags, char *quotes, char_io *io_ch,
                   void *arg)
 {
     int i, outlen, len;
-    unsigned short orflags;
-    unsigned char *p, *q;
+    unsigned char orflags, *p, *q;
     unsigned long c;
     p = buf;
     q = buf + buflen;
@@ -250,7 +245,7 @@ static int do_buf(unsigned char *buf, int buflen,
                  * character will never be escaped on first and last.
                  */
                 len =
-                    do_esc_char(utfbuf[i], (unsigned short)(flags | orflags),
+                    do_esc_char(utfbuf[i], (unsigned char)(flags | orflags),
                                 quotes, io_ch, arg);
                 if (len < 0)
                     return -1;
@@ -258,7 +253,7 @@ static int do_buf(unsigned char *buf, int buflen,
             }
         } else {
             len =
-                do_esc_char(c, (unsigned short)(flags | orflags), quotes,
+                do_esc_char(c, (unsigned char)(flags | orflags), quotes,
                             io_ch, arg);
             if (len < 0)
                 return -1;
@@ -360,10 +355,10 @@ static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags,
     int outlen, len;
     int type;
     char quotes;
-    unsigned short flags;
+    unsigned char flags;
     quotes = 0;
     /* Keep a copy of escape flags */
-    flags = (unsigned short)(lflags & ESC_FLAGS);
+    flags = (unsigned char)(lflags & ESC_FLAGS);
 
     type = str->type;