From ca570cfdbcaf35ba7e2554fd18eda8cfab2176e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulf=20M=C3=B6ller?= Date: Fri, 4 Jun 1999 21:54:13 +0000 Subject: [PATCH] Support the EBCDIC character set and BS2000/OSD-POSIX (work in progress). Submitted by: Martin Kraemer --- ssl/s2_lib.c | 5 +++++ ssl/s3_enc.c | 9 +++++++++ ssl/ssl_ciph.c | 4 ++++ ssl/tls1.h | 19 +++++++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index 5186724c43..ff804d8e0d 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -361,6 +361,11 @@ void ssl2_generate_key_material(SSL *s) unsigned char *km; unsigned char c='0'; +#ifdef CHARSET_EBCDIC + c = os_toascii['0']; /* Must be an ASCII '0', not EBCDIC '0', + see SSLv2 docu */ +#endif + km=s->s2->key_material; for (i=0; is2->key_material_length; i+=MD5_DIGEST_LENGTH) { diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index 3ef8676c34..15d4af6dfb 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -93,6 +93,9 @@ static void ssl3_generate_key_block(SSL *s, unsigned char *km, int num) unsigned char c='A'; int i,j,k; +#ifdef CHARSET_EBCDIC + c = os_toascii[c]; /*'A' in ASCII */ +#endif k=0; for (i=0; i= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-')) +#else + while ( isalnum(ch) || (ch == '-')) +#endif { buf[i]=ch; ch= *(++l); diff --git a/ssl/tls1.h b/ssl/tls1.h index 07dfe2b13d..a931efa936 100644 --- a/ssl/tls1.h +++ b/ssl/tls1.h @@ -127,6 +127,25 @@ extern "C" { #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 + #ifdef __cplusplus } #endif -- 2.25.1