fix for BSD cryptodev
by levitte
@@ -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},
