fix for BSD cryptodev
authorIaroslav Gridin <voker57@gmail.com>
Sat, 29 Oct 2016 14:47:03 +0000 (17:47 +0300)
committerRichard Levitte <levitte@openssl.org>
Tue, 10 Jan 2017 07:21:45 +0000 (08:21 +0100)
by levitte

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1784)

crypto/engine/eng_cryptodev.c

index 24692b111f2c74a0fc0b4f0ee177c47e5211ca09..71a6565cd8bc515b5512c3d566ef690a81146210 100644 (file)
@@ -81,6 +81,14 @@ void engine_load_cryptodev_int(void)
 
 #else
 
+/* Available on cryptodev-linux but not on FreeBSD 8.4 */
+# ifndef CRYPTO_HMAC_MAX_KEY_LEN
+#  define CRYPTO_HMAC_MAX_KEY_LEN 512
+# endif
+# ifndef CRYPTO_CIPHER_MAX_KEY_LEN
+#  define CRYPTO_CIPHER_MAX_KEY_LEN 64
+# endif
+
 struct dev_crypto_state {
     struct session_op d_sess;
     int d_fd;
@@ -169,16 +177,22 @@ static struct {
     {CRYPTO_ARC4, NID_rc4, 0, 16},
     {CRYPTO_DES_CBC, NID_des_cbc, 8, 8},
     {CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24},
+# if !defined(CRYPTO_ALGORITHM_MIN) || defined(CRYPTO_3DES_ECB)
     {CRYPTO_3DES_ECB, NID_des_ede3_ecb, 0, 24},
+# endif
     {CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16},
     {CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24},
     {CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32},
+# if !defined(CRYPTO_ALGORITHM_MIN) || defined(CRYPTO_AES_CTR)
     {CRYPTO_AES_CTR, NID_aes_128_ctr, 14, 16},
     {CRYPTO_AES_CTR, NID_aes_192_ctr, 14, 24},
     {CRYPTO_AES_CTR, NID_aes_256_ctr, 14, 32},
+# endif
+# if !defined(CRYPTO_ALGORITHM_MIN) || defined(CRYPTO_AES_ECB)
     {CRYPTO_AES_ECB, NID_aes_128_ecb, 0, 16},
     {CRYPTO_AES_ECB, NID_aes_192_ecb, 0, 24},
     {CRYPTO_AES_ECB, NID_aes_256_ecb, 0, 32},
+# endif
     {CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16},
     {CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16},
     {CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0},