Readd EVP_CIPHER_CTX_set_key_length.
This only applies to RC4, but it is still used by some Android code.
Change-Id: I4cf86269ffb7a230576da1bb2bfef7e1d4f234d6
Reviewed-on: https://boringssl-review.googlesource.com/1621
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h
index 3a3a856..4eae33b 100644
--- a/include/openssl/cipher.h
+++ b/include/openssl/cipher.h
@@ -261,6 +261,11 @@
* to disable. */
OPENSSL_EXPORT int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad);
+/* EVP_CIPHER_CTX_set_key_length sets the key length for |ctx|. This is only
+ * valid for ciphers that can take a variable length key. It returns one on
+ * success and zero on error. */
+OPENSSL_EXPORT int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *ctx, unsigned key_len);
+
/* Cipher accessors. */
@@ -467,6 +472,7 @@
#define CIPHER_F_aead_aes_key_wrap_seal 119
#define CIPHER_F_aead_aes_key_wrap_init 120
#define CIPHER_F_aead_aes_key_wrap_open 121
+#define CIPHER_F_EVP_CIPHER_CTX_set_key_length 122
#define CIPHER_R_WRAP_MODE_NOT_ALLOWED 100
#define CIPHER_R_AES_KEY_SETUP_FAILED 101
#define CIPHER_R_INPUT_NOT_INITIALIZED 102
@@ -490,5 +496,6 @@
#define CIPHER_R_UNSUPPORTED_INPUT_SIZE 120
#define CIPHER_R_UNSUPPORTED_AD_SIZE 121
#define CIPHER_R_UNSUPPORTED_NONCE_SIZE 122
+#define CIPHER_R_INVALID_KEY_LENGTH 123
#endif /* OPENSSL_HEADER_CIPHER_H */