Add modes/cts128.c, Ciphertext Stealing implementation.
[openssl.git] / ssl / ssl_ciph.c
index 430c1b379ba44dcbfe8660ef7aa5d85a709d240b..02cf181aad891373b40082f3010f7981488ae676 100644 (file)
 #include <stdio.h>
 #include <openssl/objects.h>
 #include <openssl/comp.h>
+#ifndef OPENSSL_NO_ENGINE
 #include <openssl/engine.h>
+#endif
 #include "ssl_locl.h"
 
 #define SSL_ENC_DES_IDX                0
@@ -314,20 +316,38 @@ static const SSL_CIPHER cipher_aliases[]={
 /* Search for public key algorithm with given name and 
  * return its pkey_id if it is available. Otherwise return 0
  */
+#ifdef OPENSSL_NO_ENGINE
+
 static int get_optional_pkey_id(const char *pkey_name)
        {
        const EVP_PKEY_ASN1_METHOD *ameth;
-       ENGINE *tmpeng = NULL;
        int pkey_id=0;
-       ameth = EVP_PKEY_asn1_find_str(&tmpeng,pkey_name,-1);
+       ameth = EVP_PKEY_asn1_find_str(NULL,pkey_name,-1);
        if (ameth) 
                {
                EVP_PKEY_asn1_get0_info(&pkey_id, NULL,NULL,NULL,NULL,ameth);
                }               
-       if (tmpeng) ENGINE_finish(tmpeng);      
        return pkey_id;
        }
 
+#else
+
+static int get_optional_pkey_id(const char *pkey_name)
+       {
+       const EVP_PKEY_ASN1_METHOD *ameth;
+       ENGINE *tmpeng = NULL;
+       int pkey_id=0;
+       ameth = EVP_PKEY_asn1_find_str(&tmpeng,pkey_name,-1);
+       if (ameth)
+               {
+               EVP_PKEY_asn1_get0_info(&pkey_id, NULL,NULL,NULL,NULL,ameth);
+               }
+       if (tmpeng) ENGINE_finish(tmpeng);
+       return pkey_id;
+       }
+
+#endif
+
 void ssl_load_ciphers(void)
        {
        ssl_cipher_methods[SSL_ENC_DES_IDX]= 
@@ -1258,7 +1278,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
        STACK_OF(SSL_CIPHER) *cipherstack, *tmp_cipher_list;
        const char *rule_p;
        CIPHER_ORDER *co_list = NULL, *head = NULL, *tail = NULL, *curr;
-       SSL_CIPHER **ca_list = NULL;
+       const SSL_CIPHER **ca_list = NULL;
 
        /*
         * Return with error if nothing to do.
@@ -1353,8 +1373,8 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
                return(NULL);   /* Failure */
                }
        ssl_cipher_collect_aliases(ca_list, num_of_group_aliases,
-                                  disabled_mkey, disabled_auth, disabled_enc, disabled_mac, disabled_ssl,
-                                  head);
+                                  disabled_mkey, disabled_auth, disabled_enc,
+                                  disabled_mac, disabled_ssl, head);
 
        /*
         * If the rule_string begins with DEFAULT, apply the default rule
@@ -1374,7 +1394,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
        if (ok && (strlen(rule_p) > 0))
                ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list);
 
-       OPENSSL_free(ca_list);  /* Not needed anymore */
+       OPENSSL_free((void *)ca_list);  /* Not needed anymore */
 
        if (!ok)
                {       /* Rule processing failure */