Apply Lutz Behnke's 56 bit cipher patch with a few
[openssl.git] / ssl / ssl_lib.c
index 3770bdf0f572afb59634afc20ef7c83c500a14c6..4d74f6e45cd5a7dc0b78fc8a8136cb6e50b7786d 100644 (file)
@@ -81,6 +81,18 @@ OPENSSL_GLOBAL SSL3_ENC_METHOD ssl3_undef_enc_method={
        (int (*)(SSL *, EVP_MD_CTX *, EVP_MD_CTX *, const char*, int, unsigned char *))ssl_undefined_function
        };
 
+union rsa_fn_to_char_u
+       {
+       char *char_p;
+       RSA *(*fn_p)(SSL *, int, int);
+       };
+
+union dh_fn_to_char_u
+       {
+       char *char_p;
+       DH *(*fn_p)(SSL *, int, int);
+       };
+
 int SSL_clear(SSL *s)
        {
        int state;
@@ -911,7 +923,7 @@ const char *SSL_get_cipher_list(SSL *s,int n)
        }
 
 /** specify the ciphers to be used by default by the SSL_CTX */
-int SSL_CTX_set_cipher_list(SSL_CTX *ctx,char *str)
+int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str)
        {
        STACK_OF(SSL_CIPHER) *sk;
        
@@ -922,7 +934,7 @@ int SSL_CTX_set_cipher_list(SSL_CTX *ctx,char *str)
        }
 
 /** specify the ciphers to be used by the SSL */
-int SSL_set_cipher_list(SSL *s,char *str)
+int SSL_set_cipher_list(SSL *s,const char *str)
        {
        STACK_OF(SSL_CIPHER) *sk;
        
@@ -1350,7 +1362,7 @@ X509 *ssl_get_server_send_cert(SSL *s)
        c=s->cert;
        ssl_set_cert_masks(c, s->s3->tmp.new_cipher);
        alg=s->s3->tmp.new_cipher->algorithms;
-       is_export=SSL_IS_EXPORT(alg);
+       is_export=SSL_C_IS_EXPORT(s->s3->tmp.new_cipher);
        mask=is_export?c->export_mask:c->mask;
        kalg=alg&(SSL_MKEY_MASK|SSL_AUTH_MASK);
 
@@ -1975,13 +1987,23 @@ int SSL_want(SSL *s)
 void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,RSA *(*cb)(SSL *ssl,
                                                          int is_export,
                                                          int keylength))
-    { SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA_CB,0,(char *)cb); }
+    {
+    union rsa_fn_to_char_u rsa_tmp_cb;
+
+    rsa_tmp_cb.fn_p = cb;
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA_CB,0,rsa_tmp_cb.char_p);
+    }
 #endif
 
 #ifndef NO_RSA
 void SSL_set_tmp_rsa_callback(SSL *ssl,RSA *(*cb)(SSL *ssl,int is_export,
                                                          int keylength))
-    { SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA_CB,0,(char *)cb); }
+    {
+    union rsa_fn_to_char_u rsa_tmp_cb;
+
+    rsa_tmp_cb.fn_p = cb;
+    SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA_CB,0,rsa_tmp_cb.char_p);
+    }
 #endif
 
 #ifdef DOXYGEN
@@ -2008,11 +2030,21 @@ RSA *cb(SSL *ssl,int is_export,int keylength)
 #ifndef NO_DH
 void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,DH *(*dh)(SSL *ssl,int is_export,
                                                        int keylength))
-    { SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH_CB,0,(char *)dh); }
+    {
+    union dh_fn_to_char_u dh_tmp_cb;
+
+    dh_tmp_cb.fn_p = dh;
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH_CB,0,dh_tmp_cb.char_p);
+    }
 
 void SSL_set_tmp_dh_callback(SSL *ssl,DH *(*dh)(SSL *ssl,int is_export,
                                                        int keylength))
-    { SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH_CB,0,(char *)dh); }
+    {
+    union dh_fn_to_char_u dh_tmp_cb;
+
+    dh_tmp_cb.fn_p = dh;
+    SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH_CB,0,dh_tmp_cb.char_p);
+    }
 #endif
 
 #if defined(_WINDLL) && defined(WIN16)