Browse Source

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>
kris/onging/CECPQ3_patch15
Alex Chernyakhovsky 10 years ago
committed by Adam Langley
parent
commit
2897ed3634
16 changed files with 0 additions and 211 deletions
  1. +0
    -3
      crypto/asn1/a_gentm.c
  2. +0
    -7
      crypto/asn1/a_mbstr.c
  3. +0
    -8
      crypto/asn1/a_print.c
  4. +0
    -15
      crypto/asn1/a_time.c
  5. +0
    -18
      crypto/asn1/a_utctm.c
  6. +0
    -9
      crypto/asn1/f_int.c
  7. +0
    -9
      crypto/asn1/f_string.c
  8. +0
    -14
      crypto/pem/pem_lib.c
  9. +0
    -10
      crypto/x509/t_x509.c
  10. +0
    -37
      crypto/x509/x509_obj.c
  11. +0
    -3
      crypto/x509v3/v3_ia5.c
  12. +0
    -30
      crypto/x509v3/v3_prn.c
  13. +0
    -17
      crypto/x509v3/v3_utl.c
  14. +0
    -9
      ssl/s3_enc.c
  15. +0
    -4
      ssl/ssl_ciph.c
  16. +0
    -18
      ssl/tls1.h

+ 0
- 3
crypto/asn1/a_gentm.c View File

@@ -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);
}

+ 0
- 7
crypto/asn1/a_mbstr.c View File

@@ -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;
}

+ 0
- 8
crypto/asn1/a_print.c View File

@@ -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);


+ 0
- 15
crypto/asn1/a_time.c View File

@@ -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));


+ 0
- 18
crypto/asn1/a_utctm.c View File

@@ -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);
}



+ 0
- 9
crypto/asn1/f_int.c View File

@@ -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;


+ 0
- 9
crypto/asn1/f_string.c View File

@@ -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;


+ 0
- 14
crypto/pem/pem_lib.c View File

@@ -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';


+ 0
- 10
crypto/x509/t_x509.c View File

@@ -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;


+ 0
- 37
crypto/x509/x509_obj.c View File

@@ -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';
}


+ 0
- 3
crypto/x509v3/v3_ia5.c View File

@@ -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);


+ 0
- 30
crypto/x509v3/v3_prn.c View File

@@ -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;


+ 0
- 17
crypto/x509v3/v3_utl.c View File

@@ -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++;


+ 0
- 9
ssl/s3_enc.c View File

@@ -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;


+ 0
- 4
ssl/ssl_ciph.c View File

@@ -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++;


+ 0
- 18
ssl/tls1.h View File

@@ -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


Loading…
Cancel
Save