Modify S/MIME application so the -signer option writes the signer(s)
[openssl.git] / ssl / s3_enc.c
index 2113ff32504212e1f2c112183d5299f255b0e77a..15d4af6dfbae633d8a12638e58ca919e24476388 100644 (file)
@@ -57,6 +57,8 @@
  */
 
 #include <stdio.h>
+#include <openssl/md5.h>
+#include <openssl/sha.h>
 #include <openssl/evp.h>
 #include "ssl_locl.h"
 
@@ -91,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)
                {
@@ -512,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;