Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/cryptodev.h
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
#define SHA2_224_HASH_LEN 28 | #define SHA2_224_HASH_LEN 28 | ||||
#define SHA2_256_HASH_LEN 32 | #define SHA2_256_HASH_LEN 32 | ||||
#define SHA2_384_HASH_LEN 48 | #define SHA2_384_HASH_LEN 48 | ||||
#define SHA2_512_HASH_LEN 64 | #define SHA2_512_HASH_LEN 64 | ||||
#define MD5_KPDK_HASH_LEN 16 | #define MD5_KPDK_HASH_LEN 16 | ||||
#define SHA1_KPDK_HASH_LEN 20 | #define SHA1_KPDK_HASH_LEN 20 | ||||
#define AES_GMAC_HASH_LEN 16 | #define AES_GMAC_HASH_LEN 16 | ||||
#define POLY1305_HASH_LEN 16 | #define POLY1305_HASH_LEN 16 | ||||
#define AES_CBC_MAC_HASH_LEN 16 | |||||
/* Maximum hash algorithm result length */ | /* Maximum hash algorithm result length */ | ||||
#define HASH_MAX_LEN SHA2_512_HASH_LEN /* Keep this updated */ | #define HASH_MAX_LEN SHA2_512_HASH_LEN /* Keep this updated */ | ||||
#define MD5_BLOCK_LEN 64 | #define MD5_BLOCK_LEN 64 | ||||
#define SHA1_BLOCK_LEN 64 | #define SHA1_BLOCK_LEN 64 | ||||
#define RIPEMD160_BLOCK_LEN 64 | #define RIPEMD160_BLOCK_LEN 64 | ||||
#define SHA2_224_BLOCK_LEN 64 | #define SHA2_224_BLOCK_LEN 64 | ||||
#define SHA2_256_BLOCK_LEN 64 | #define SHA2_256_BLOCK_LEN 64 | ||||
#define SHA2_384_BLOCK_LEN 128 | #define SHA2_384_BLOCK_LEN 128 | ||||
#define SHA2_512_BLOCK_LEN 128 | #define SHA2_512_BLOCK_LEN 128 | ||||
/* HMAC values */ | /* HMAC values */ | ||||
#define NULL_HMAC_BLOCK_LEN 64 | #define NULL_HMAC_BLOCK_LEN 64 | ||||
/* Maximum HMAC block length */ | /* Maximum HMAC block length */ | ||||
#define HMAC_MAX_BLOCK_LEN SHA2_512_BLOCK_LEN /* Keep this updated */ | #define HMAC_MAX_BLOCK_LEN SHA2_512_BLOCK_LEN /* Keep this updated */ | ||||
#define HMAC_IPAD_VAL 0x36 | #define HMAC_IPAD_VAL 0x36 | ||||
#define HMAC_OPAD_VAL 0x5C | #define HMAC_OPAD_VAL 0x5C | ||||
/* HMAC Key Length */ | /* HMAC Key Length */ | ||||
#define AES_128_GMAC_KEY_LEN 16 | #define AES_128_GMAC_KEY_LEN 16 | ||||
#define AES_192_GMAC_KEY_LEN 24 | #define AES_192_GMAC_KEY_LEN 24 | ||||
#define AES_256_GMAC_KEY_LEN 32 | #define AES_256_GMAC_KEY_LEN 32 | ||||
#define AES_128_CBC_MAC_KEY_LEN 16 | |||||
#define AES_192_CBC_MAC_KEY_LEN 24 | |||||
#define AES_256_CBC_MAC_KEY_LEN 32 | |||||
#define POLY1305_KEY_LEN 32 | #define POLY1305_KEY_LEN 32 | ||||
/* Encryption algorithm block sizes */ | /* Encryption algorithm block sizes */ | ||||
#define NULL_BLOCK_LEN 4 /* IPsec to maintain alignment */ | #define NULL_BLOCK_LEN 4 /* IPsec to maintain alignment */ | ||||
#define DES_BLOCK_LEN 8 | #define DES_BLOCK_LEN 8 | ||||
#define DES3_BLOCK_LEN 8 | #define DES3_BLOCK_LEN 8 | ||||
#define BLOWFISH_BLOCK_LEN 8 | #define BLOWFISH_BLOCK_LEN 8 | ||||
#define SKIPJACK_BLOCK_LEN 8 | #define SKIPJACK_BLOCK_LEN 8 | ||||
#define CAST128_BLOCK_LEN 8 | #define CAST128_BLOCK_LEN 8 | ||||
#define RIJNDAEL128_BLOCK_LEN 16 | #define RIJNDAEL128_BLOCK_LEN 16 | ||||
#define AES_BLOCK_LEN 16 | #define AES_BLOCK_LEN 16 | ||||
#define AES_ICM_BLOCK_LEN 1 | #define AES_ICM_BLOCK_LEN 1 | ||||
#define ARC4_BLOCK_LEN 1 | #define ARC4_BLOCK_LEN 1 | ||||
#define CAMELLIA_BLOCK_LEN 16 | #define CAMELLIA_BLOCK_LEN 16 | ||||
#define CHACHA20_NATIVE_BLOCK_LEN 64 | #define CHACHA20_NATIVE_BLOCK_LEN 64 | ||||
#define EALG_MAX_BLOCK_LEN CHACHA20_NATIVE_BLOCK_LEN /* Keep this updated */ | #define EALG_MAX_BLOCK_LEN CHACHA20_NATIVE_BLOCK_LEN /* Keep this updated */ | ||||
/* IV Lengths */ | /* IV Lengths */ | ||||
#define ARC4_IV_LEN 1 | #define ARC4_IV_LEN 1 | ||||
#define AES_GCM_IV_LEN 12 | #define AES_GCM_IV_LEN 12 | ||||
#define AES_CCM_IV_LEN 12 | |||||
#define AES_XTS_IV_LEN 8 | #define AES_XTS_IV_LEN 8 | ||||
#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ | #define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ | ||||
/* Min and Max Encryption Key Sizes */ | /* Min and Max Encryption Key Sizes */ | ||||
#define NULL_MIN_KEY 0 | #define NULL_MIN_KEY 0 | ||||
#define NULL_MAX_KEY 256 /* 2048 bits, max key */ | #define NULL_MAX_KEY 256 /* 2048 bits, max key */ | ||||
#define DES_MIN_KEY 8 | #define DES_MIN_KEY 8 | ||||
#define DES_MAX_KEY DES_MIN_KEY | #define DES_MAX_KEY DES_MIN_KEY | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
#define CRYPTO_CHACHA20 31 /* Chacha20 stream cipher */ | #define CRYPTO_CHACHA20 31 /* Chacha20 stream cipher */ | ||||
#define CRYPTO_SHA2_224_HMAC 32 | #define CRYPTO_SHA2_224_HMAC 32 | ||||
#define CRYPTO_RIPEMD160 33 | #define CRYPTO_RIPEMD160 33 | ||||
#define CRYPTO_SHA2_224 34 | #define CRYPTO_SHA2_224 34 | ||||
#define CRYPTO_SHA2_256 35 | #define CRYPTO_SHA2_256 35 | ||||
#define CRYPTO_SHA2_384 36 | #define CRYPTO_SHA2_384 36 | ||||
#define CRYPTO_SHA2_512 37 | #define CRYPTO_SHA2_512 37 | ||||
#define CRYPTO_POLY1305 38 | #define CRYPTO_POLY1305 38 | ||||
#define CRYPTO_ALGORITHM_MAX 38 /* Keep updated - see below */ | #define CRYPTO_AES_CCM_16 39 /* cipher side */ | ||||
#define CRYPTO_AES_128_CCM_CBC_MAC 41 /* auth side */ | |||||
#define CRYPTO_AES_192_CCM_CBC_MAC 42 /* auth side */ | |||||
#define CRYPTO_AES_256_CCM_CBC_MAC 43 /* auth side */ | |||||
#define CRYPTO_ALGORITHM_MAX 43 /* Keep updated - see below */ | |||||
jhb: You can't renumber this, this is part of the ABI. | |||||
Done Inline ActionsYeah, that's related to the age; CRYPTO_POLY1305 was added after I had done the changes. They should clearly start numbering at 39 now. sef: Yeah, that's related to the age; CRYPTO_POLY1305 was added after I had done the changes. They… | |||||
#define CRYPTO_ALGO_VALID(x) ((x) >= CRYPTO_ALGORITHM_MIN && \ | #define CRYPTO_ALGO_VALID(x) ((x) >= CRYPTO_ALGORITHM_MIN && \ | ||||
(x) <= CRYPTO_ALGORITHM_MAX) | (x) <= CRYPTO_ALGORITHM_MAX) | ||||
/* Algorithm flags */ | /* Algorithm flags */ | ||||
#define CRYPTO_ALG_FLAG_SUPPORTED 0x01 /* Algorithm is supported */ | #define CRYPTO_ALG_FLAG_SUPPORTED 0x01 /* Algorithm is supported */ | ||||
#define CRYPTO_ALG_FLAG_RNG_ENABLE 0x02 /* Has HW RNG for DH/DSA */ | #define CRYPTO_ALG_FLAG_RNG_ENABLE 0x02 /* Has HW RNG for DH/DSA */ | ||||
#define CRYPTO_ALG_FLAG_DSA_SHA 0x04 /* Can do SHA on msg */ | #define CRYPTO_ALG_FLAG_DSA_SHA 0x04 /* Can do SHA on msg */ | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | struct cryptostats { | ||||
struct cryptotstat cs_invoke; /* crypto_dipsatch -> crypto_invoke */ | struct cryptotstat cs_invoke; /* crypto_dipsatch -> crypto_invoke */ | ||||
struct cryptotstat cs_done; /* crypto_invoke -> crypto_done */ | struct cryptotstat cs_done; /* crypto_invoke -> crypto_done */ | ||||
struct cryptotstat cs_cb; /* crypto_done -> callback */ | struct cryptotstat cs_cb; /* crypto_done -> callback */ | ||||
struct cryptotstat cs_finis; /* callback -> callback return */ | struct cryptotstat cs_finis; /* callback -> callback return */ | ||||
}; | }; | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#if 0 | #ifdef CRYPTO_DEBUG | ||||
Not Done Inline ActionsYeah, I was going to just make this a straight-up sysctl eventually. Haven't gotten around to it. cem: Yeah, I was going to just make this a straight-up sysctl eventually. Haven't gotten around to… | |||||
#define CRYPTDEB(s, ...) do { \ | #define CRYPTDEB(s, ...) do { \ | ||||
printf("%s:%d: " s "\n", __FILE__, __LINE__, ## __VA_ARGS__); \ | printf("%s:%d: " s "\n", __FILE__, __LINE__, ## __VA_ARGS__); \ | ||||
} while (0) | } while (0) | ||||
#else | #else | ||||
#define CRYPTDEB(...) do { } while (0) | #define CRYPTDEB(...) do { } while (0) | ||||
#endif | #endif | ||||
/* Standard initialization structure beginning */ | /* Standard initialization structure beginning */ | ||||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |
You can't renumber this, this is part of the ABI.