aesni TLS GCM support
[openssl.git] / crypto / evp / e_rc2.c
index 3932f60..d4c33b5 100644 (file)
@@ -168,21 +168,23 @@ static int rc2_magic_to_meth(int i)
 static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
        {
        long num=0;
-       int i=0,l;
+       int i=0;
        int key_bits;
+       unsigned int l;
        unsigned char iv[EVP_MAX_IV_LENGTH];
 
        if (type != NULL)
                {
                l=EVP_CIPHER_CTX_iv_length(c);
-               OPENSSL_assert(l <= sizeof iv);
+               OPENSSL_assert(l <= sizeof(iv));
                i=ASN1_TYPE_get_int_octetstring(type,&num,iv,l);
-               if (i != l)
+               if (i != (int)l)
                        return(-1);
                key_bits =rc2_magic_to_meth((int)num);
                if (!key_bits)
                        return(-1);
-               if(i > 0) EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1);
+               if(i > 0 && !EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1))
+                       return -1;
                EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL);
                EVP_CIPHER_CTX_set_key_length(c, key_bits / 8);
                }
@@ -222,6 +224,11 @@ static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
                        return 1;
                        }
                return 0;
+#ifdef PBE_PRF_TEST
+       case EVP_CTRL_PBE_PRF_NID:
+               *(int *)ptr = NID_hmacWithMD5;
+               return 1;
+#endif
 
        default:
                return -1;