Support the EBCDIC character set and BS2000/OSD-POSIX (work in progress).
authorUlf Möller <ulf@openssl.org>
Fri, 4 Jun 1999 21:54:13 +0000 (21:54 +0000)
committerUlf Möller <ulf@openssl.org>
Fri, 4 Jun 1999 21:54:13 +0000 (21:54 +0000)
Submitted by: Martin Kraemer <Martin.Kraemer@MchP.Siemens.De>

ssl/s2_lib.c
ssl/s3_enc.c
ssl/ssl_ciph.c
ssl/tls1.h

index 5186724c435ff8efb9958d2b06f98a87e25c3c30..ff804d8e0d1b0b66b578feead844914f74dc19d4 100644 (file)
@@ -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; i<s->s2->key_material_length; i+=MD5_DIGEST_LENGTH)
                {
index 3ef8676c34cee8cd5e0bb37ec95a3e7753e48fa0..15d4af6dfbae633d8a12638e58ca919e24476388 100644 (file)
@@ -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<num; i+=MD5_DIGEST_LENGTH)
                {
@@ -514,9 +517,15 @@ 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;
index d684758a8644e0d878578cc0713282ed50765ff3..569cfde16422b519ce9263b15b067da0d5740cc0 100644 (file)
@@ -458,10 +458,14 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(SSL_METHOD *ssl_method,
                        {
                        ch= *l;
                        i=0;
+#ifndef CHARSET_EBCDIC
                        while ( ((ch >= 'A') && (ch <= 'Z')) ||
                                ((ch >= '0') && (ch <= '9')) ||
                                ((ch >= 'a') && (ch <= 'z')) ||
                                 (ch == '-'))
+#else
+                       while ( isalnum(ch) || (ch == '-'))
+#endif
                                 {
                                 buf[i]=ch;
                                 ch= *(++l);
index 07dfe2b13d4896037f9978ac21b517c0b5510f83..a931efa936a0e5f642b29b7b15ae12ce3cb15151 100644 (file)
@@ -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