diff options
author | Alex Chernyakhovsky <achernya@google.com> | 2014-07-05 02:47:48 +0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-07-07 23:30:35 +0400 |
commit | 2897ed36347fa436f6108897862251567e23110e (patch) | |
tree | cd94cde35fe43a5a420e43f848cb33a247425651 | |
parent | 8af663956519f7302284c0c36b413c0495986e14 (diff) |
Remove CHARSET_EBCDIC
Since crypto/ebcdic.{c,h} are not present in BoringSSL, remove the #ifdefs
Changes were made by running
find . -type f -name *.c | xargs unifdef -m -U CHARSET_EBCDIC
find . -type f -name *.h | xargs unifdef -m -U CHARSET_EBCDIC
using unifdef 2.10.
An additional two ifdefs (CHARSET_EBCDIC_not) were removed manually.
Change-Id: Ie174bb00782cc44c63b0f9fab69619b3a9f66d42
Reviewed-on: https://boringssl-review.googlesource.com/1093
Reviewed-by: Adam Langley <agl@google.com>
-rw-r--r-- | crypto/asn1/a_gentm.c | 3 | ||||
-rw-r--r-- | crypto/asn1/a_mbstr.c | 7 | ||||
-rw-r--r-- | crypto/asn1/a_print.c | 8 | ||||
-rw-r--r-- | crypto/asn1/a_time.c | 15 | ||||
-rw-r--r-- | crypto/asn1/a_utctm.c | 18 | ||||
-rw-r--r-- | crypto/asn1/f_int.c | 9 | ||||
-rw-r--r-- | crypto/asn1/f_string.c | 9 | ||||
-rw-r--r-- | crypto/pem/pem_lib.c | 14 | ||||
-rw-r--r-- | crypto/x509/t_x509.c | 10 | ||||
-rw-r--r-- | crypto/x509/x509_obj.c | 37 | ||||
-rw-r--r-- | crypto/x509v3/v3_ia5.c | 3 | ||||
-rw-r--r-- | crypto/x509v3/v3_prn.c | 30 | ||||
-rw-r--r-- | crypto/x509v3/v3_utl.c | 17 | ||||
-rw-r--r-- | ssl/s3_enc.c | 9 | ||||
-rw-r--r-- | ssl/ssl_ciph.c | 4 | ||||
-rw-r--r-- | ssl/tls1.h | 18 |
16 files changed, 0 insertions, 211 deletions
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index 1b8d78ed..b5bddb8b 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -248,8 +248,5 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); s->length=strlen(p); s->type=V_ASN1_GENERALIZEDTIME; -#ifdef CHARSET_EBCDIC_not - ebcdic2ascii(s->data, s->data, s->length); -#endif return(s); } diff --git a/crypto/asn1/a_mbstr.c b/crypto/asn1/a_mbstr.c index 6543f528..007f0e16 100644 --- a/crypto/asn1/a_mbstr.c +++ b/crypto/asn1/a_mbstr.c @@ -380,16 +380,9 @@ static int is_printable(unsigned long value) /* Note: we can't use 'isalnum' because certain accented * characters may count as alphanumeric in some environments. */ -#ifndef CHARSET_EBCDIC if((ch >= 'a') && (ch <= 'z')) return 1; if((ch >= 'A') && (ch <= 'Z')) return 1; if((ch >= '0') && (ch <= '9')) return 1; if ((ch == ' ') || strchr("'()+,-./:=?", ch)) return 1; -#else /*CHARSET_EBCDIC*/ - if((ch >= os_toascii['a']) && (ch <= os_toascii['z'])) return 1; - if((ch >= os_toascii['A']) && (ch <= os_toascii['Z'])) return 1; - if((ch >= os_toascii['0']) && (ch <= os_toascii['9'])) return 1; - if ((ch == os_toascii[' ']) || strchr("'()+,-./:=?", os_toebcdic[ch])) return 1; -#endif /*CHARSET_EBCDIC*/ return 0; } diff --git a/crypto/asn1/a_print.c b/crypto/asn1/a_print.c index e2cde687..3b6be10b 100644 --- a/crypto/asn1/a_print.c +++ b/crypto/asn1/a_print.c @@ -72,7 +72,6 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len) while ((*s) && (len-- != 0)) { c= *(s++); -#ifndef CHARSET_EBCDIC if (!( ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || (c == ' ') || @@ -86,13 +85,6 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len) ia5=1; if (c&0x80) t61=1; -#else - if (!isalnum(c) && (c != ' ') && - strchr("'()+,-./:=?", c) == NULL) - ia5=1; - if (os_toascii[c] & 0x80) - t61=1; -#endif } if (t61) return(V_ASN1_T61STRING); if (ia5) return(V_ASN1_IA5STRING); diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index 3b80ba42..4786024e 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -79,21 +79,6 @@ IMPLEMENT_ASN1_FUNCTIONS(ASN1_TIME) #if 0 int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp) { -#ifdef CHARSET_EBCDIC - /* KLUDGE! We convert to ascii before writing DER */ - char tmp[24]; - ASN1_STRING tmpstr; - - if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) { - int len; - - tmpstr = *(ASN1_STRING *)a; - len = tmpstr.length; - ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len); - tmpstr.data = tmp; - a = (ASN1_GENERALIZEDTIME *) &tmpstr; - } -#endif if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, a->type ,V_ASN1_UNIVERSAL)); diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index 72a09be8..41f35947 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -64,20 +64,8 @@ #if 0 int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp) { -#ifndef CHARSET_EBCDIC return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL)); -#else - /* KLUDGE! We convert to ascii before writing DER */ - int len; - char tmp[24]; - ASN1_STRING x = *(ASN1_STRING *)a; - - len = x.length; - ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len); - x.data = tmp; - return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL); -#endif } @@ -93,9 +81,6 @@ ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp, OPENSSL_PUT_ERROR(ASN1, XXX, ERR_R_NESTED_ASN1_ERROR); return(NULL); } -#ifdef CHARSET_EBCDIC - ascii2ebcdic(ret->data, ret->data, ret->length); -#endif if (!ASN1_UTCTIME_check(ret)) { OPENSSL_PUT_ERROR(ASN1, XXX, ASN1_R_INVALID_TIME_FORMAT); @@ -276,9 +261,6 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); s->length=strlen(p); s->type=V_ASN1_UTCTIME; -#ifdef CHARSET_EBCDIC_not - ebcdic2ascii(s->data, s->data, s->length); -#endif return(s); } diff --git a/crypto/asn1/f_int.c b/crypto/asn1/f_int.c index d9ddcf85..7b8c61a9 100644 --- a/crypto/asn1/f_int.c +++ b/crypto/asn1/f_int.c @@ -122,18 +122,9 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) for (j=0; j<i; j++) { -#ifndef CHARSET_EBCDIC if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || ((buf[j] >= 'a') && (buf[j] <= 'f')) || ((buf[j] >= 'A') && (buf[j] <= 'F')))) -#else - /* This #ifdef is not strictly necessary, since - * the characters A...F a...f 0...9 are contiguous - * (yes, even in EBCDIC - but not the whole alphabet). - * Nevertheless, isxdigit() is faster. - */ - if (!isxdigit(buf[j])) -#endif { i=j; break; diff --git a/crypto/asn1/f_string.c b/crypto/asn1/f_string.c index 95e59ff1..d6f128dd 100644 --- a/crypto/asn1/f_string.c +++ b/crypto/asn1/f_string.c @@ -123,18 +123,9 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) for (j=i-1; j>0; j--) { -#ifndef CHARSET_EBCDIC if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || ((buf[j] >= 'a') && (buf[j] <= 'f')) || ((buf[j] >= 'A') && (buf[j] <= 'F')))) -#else - /* This #ifdef is not strictly necessary, since - * the characters A...F a...f 0...9 are contiguous - * (yes, even in EBCDIC - but not the whole alphabet). - * Nevertheless, isxdigit() is faster. - */ - if (!isxdigit(buf[j])) -#endif { i=j; break; diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index 23efd0ac..24fa877d 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -337,10 +337,6 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, OPENSSL_PUT_ERROR(PEM, PEM_ASN1_write_bio, PEM_R_READ_KEY); goto err; } -#ifdef CHARSET_EBCDIC - /* Convert the pass phrase from EBCDIC */ - ebcdic2ascii(buf, buf, klen); -#endif kstr=(unsigned char *)buf; } assert(iv_len <= (int)sizeof(iv)); @@ -412,10 +408,6 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, OPENSSL_PUT_ERROR(PEM, PEM_do_header, PEM_R_BAD_PASSWORD_READ); return(0); } -#ifdef CHARSET_EBCDIC - /* Convert the pass phrase from EBCDIC */ - ebcdic2ascii(buf, buf, klen); -#endif if (!EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]), (unsigned char *)buf,klen,1,key,NULL)) @@ -482,15 +474,9 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) for (;;) { c= *header; -#ifndef CHARSET_EBCDIC if (!( ((c >= 'A') && (c <= 'Z')) || (c == '-') || ((c >= '0') && (c <= '9')))) break; -#else - if (!( isupper(c) || (c == '-') || - isdigit(c))) - break; -#endif header++; } *header='\0'; diff --git a/crypto/x509/t_x509.c b/crypto/x509/t_x509.c index 91d4ac71..91a52de5 100644 --- a/crypto/x509/t_x509.c +++ b/crypto/x509/t_x509.c @@ -473,7 +473,6 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) c=s; for (;;) { -#ifndef CHARSET_EBCDIC if ( ((*s == '/') && ((s[1] >= 'A') && (s[1] <= 'Z') && ( (s[2] == '=') || @@ -481,15 +480,6 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) (s[3] == '=')) ))) || (*s == '\0')) -#else - if ( ((*s == '/') && - (isupper(s[1]) && ( - (s[2] == '=') || - (isupper(s[2]) && - (s[3] == '=')) - ))) || - (*s == '\0')) -#endif { i=s-c; if (BIO_write(bp,c,i) != i) goto err; diff --git a/crypto/x509/x509_obj.c b/crypto/x509/x509_obj.c index 434108ce..5f539ab5 100644 --- a/crypto/x509/x509_obj.c +++ b/crypto/x509/x509_obj.c @@ -75,9 +75,6 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) static const char hex[17]="0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; -#ifdef CHARSET_EBCDIC - char ebcdic_buf[1024]; -#endif if (buf == NULL) { @@ -114,19 +111,6 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) type=ne->value->type; num=ne->value->length; q=ne->value->data; -#ifdef CHARSET_EBCDIC - if (type == V_ASN1_GENERALSTRING || - type == V_ASN1_VISIBLESTRING || - type == V_ASN1_PRINTABLESTRING || - type == V_ASN1_TELETEXSTRING || - type == V_ASN1_VISIBLESTRING || - type == V_ASN1_IA5STRING) { - ascii2ebcdic(ebcdic_buf, q, - (num > sizeof ebcdic_buf) - ? sizeof ebcdic_buf : num); - q=ebcdic_buf; - } -#endif if ((type == V_ASN1_GENERALSTRING) && ((num%4) == 0)) { @@ -149,12 +133,7 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { if (!gs_doit[j&3]) continue; l2++; -#ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2+=3; -#else - if ((os_toascii[q[j]] < os_toascii[' ']) || - (os_toascii[q[j]] > os_toascii['~'])) l2+=3; -#endif } lold=l; @@ -174,14 +153,11 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) memcpy(p,s,(unsigned int)l1); p+=l1; *(p++)='='; -#ifndef CHARSET_EBCDIC /* q was assigned above already. */ q=ne->value->data; -#endif for (j=0; j<num; j++) { if (!gs_doit[j&3]) continue; -#ifndef CHARSET_EBCDIC n=q[j]; if ((n < ' ') || (n > '~')) { @@ -192,19 +168,6 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) } else *(p++)=n; -#else - n=os_toascii[q[j]]; - if ((n < os_toascii[' ']) || - (n > os_toascii['~'])) - { - *(p++)='\\'; - *(p++)='x'; - *(p++)=hex[(n>>4)&0x0f]; - *(p++)=hex[n&0x0f]; - } - else - *(p++)=q[j]; -#endif } *p='\0'; } diff --git a/crypto/x509v3/v3_ia5.c b/crypto/x509v3/v3_ia5.c index 04ef05c1..39d6ef8a 100644 --- a/crypto/x509v3/v3_ia5.c +++ b/crypto/x509v3/v3_ia5.c @@ -109,9 +109,6 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, M_ASN1_IA5STRING_free(ia5); goto err; } -#ifdef CHARSET_EBCDIC - ebcdic2ascii(ia5->data, ia5->data, ia5->length); -#endif /*CHARSET_EBCDIC*/ return ia5; err: OPENSSL_PUT_ERROR(X509V3, s2i_ASN1_IA5STRING, ERR_R_MALLOC_FAILURE); diff --git a/crypto/x509v3/v3_prn.c b/crypto/x509v3/v3_prn.c index 33746009..87aef4d4 100644 --- a/crypto/x509v3/v3_prn.c +++ b/crypto/x509v3/v3_prn.c @@ -85,22 +85,7 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml) nval = sk_CONF_VALUE_value(val, i); if(!nval->name) BIO_puts(out, nval->value); else if(!nval->value) BIO_puts(out, nval->name); -#ifndef CHARSET_EBCDIC else BIO_printf(out, "%s:%s", nval->name, nval->value); -#else - else { - int len; - char *tmp; - len = strlen(nval->value)+1; - tmp = OPENSSL_malloc(len); - if (tmp) - { - ascii2ebcdic(tmp, nval->value, len); - BIO_printf(out, "%s:%s", nval->name, tmp); - OPENSSL_free(tmp); - } - } -#endif if(ml) BIO_puts(out, "\n"); } } @@ -129,22 +114,7 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int inde ok = 0; goto err; } -#ifndef CHARSET_EBCDIC BIO_printf(out, "%*s%s", indent, "", value); -#else - { - int len; - char *tmp; - len = strlen(value)+1; - tmp = OPENSSL_malloc(len); - if (tmp) - { - ascii2ebcdic(tmp, value, len); - BIO_printf(out, "%*s%s", indent, "", tmp); - OPENSSL_free(tmp); - } - } -#endif } else if(method->i2v) { if(!(nval = method->i2v(method, ext_str, NULL))) { ok = 0; diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c index 3bbc6060..4cd0c0ca 100644 --- a/crypto/x509v3/v3_utl.c +++ b/crypto/x509v3/v3_utl.c @@ -383,9 +383,6 @@ char *hex_to_string(const unsigned char *buffer, long len) *q++ = ':'; } q[-1] = 0; -#ifdef CHARSET_EBCDIC - ebcdic2ascii(tmp, tmp, q - tmp - 1); -#endif return tmp; } @@ -405,14 +402,8 @@ unsigned char *string_to_hex(const char *str, long *len) if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err; for(p = (unsigned char *)str, q = hexbuf; *p;) { ch = *p++; -#ifdef CHARSET_EBCDIC - ch = os_toebcdic[ch]; -#endif if(ch == ':') continue; cl = *p++; -#ifdef CHARSET_EBCDIC - cl = os_toebcdic[cl]; -#endif if(!cl) { OPENSSL_PUT_ERROR(X509V3, string_to_hex, X509V3_R_ODD_NUMBER_OF_DIGITS); OPENSSL_free(hexbuf); @@ -1281,21 +1272,13 @@ int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk, * multiple instances */ for(p = type; *p ; p++) -#ifndef CHARSET_EBCDIC if ((*p == ':') || (*p == ',') || (*p == '.')) -#else - if ((*p == os_toascii[':']) || (*p == os_toascii[',']) || (*p == os_toascii['.'])) -#endif { p++; if(*p) type = p; break; } -#ifndef CHARSET_EBCDIC if (*type == '+') -#else - if (*type == os_toascii['+']) -#endif { mval = -1; type++; diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index 6ab267ec..8f6d75bf 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -169,9 +169,6 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num) unsigned char c='A'; unsigned int i,j,k; -#ifdef CHARSET_EBCDIC - c = os_toascii[c]; /*'A' in ASCII */ -#endif k=0; EVP_MD_CTX_init(&m5); EVP_MD_CTX_init(&s1); @@ -786,15 +783,9 @@ int ssl3_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p, int len) { static const unsigned char *salt[3]={ -#ifndef CHARSET_EBCDIC (const unsigned char *)"A", (const unsigned char *)"BB", (const unsigned char *)"CCC", -#else - (const unsigned char *)"\x41", - (const unsigned char *)"\x42\x42", - (const unsigned char *)"\x43\x43\x43", -#endif }; unsigned char buf[EVP_MAX_MD_SIZE]; EVP_MD_CTX ctx; diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index 79e52c80..f8238acc 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -1092,14 +1092,10 @@ static int ssl_cipher_process_rulestr(const char *rule_str, ch = *l; buf = l; buflen = 0; -#ifndef CHARSET_EBCDIC while ( ((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-') || (ch == '.')) -#else - while ( isalnum(ch) || (ch == '-') || (ch == '.')) -#endif { ch = *(++l); buflen++; @@ -732,24 +732,6 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb) #define TLS_MD_MASTER_SECRET_CONST "master secret" #define TLS_MD_MASTER_SECRET_CONST_SIZE 13 -#ifdef CHARSET_EBCDIC -#undef TLS_MD_CLIENT_FINISH_CONST -#define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*client finished*/ -#undef TLS_MD_SERVER_FINISH_CONST -#define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*server finished*/ -#undef TLS_MD_SERVER_WRITE_KEY_CONST -#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/ -#undef TLS_MD_KEY_EXPANSION_CONST -#define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" /*key expansion*/ -#undef TLS_MD_CLIENT_WRITE_KEY_CONST -#define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*client write key*/ -#undef TLS_MD_SERVER_WRITE_KEY_CONST -#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/ -#undef TLS_MD_IV_BLOCK_CONST -#define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" /*IV block*/ -#undef TLS_MD_MASTER_SECRET_CONST -#define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" /*master secret*/ -#endif /* TLS Session Ticket extension struct */ struct tls_session_ticket_ext_st |