crypto: Consistently use AES instead of Rijndael128 for the AES-CBC cipher.
Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33486
This commit is contained in:
parent
47fc049585
commit
246982c196
@ -590,7 +590,7 @@ static struct supported_ealgs {
|
||||
int sadb_alg;
|
||||
const struct enc_xform *xform;
|
||||
} supported_ealgs[] = {
|
||||
{ SADB_X_EALG_AES, &enc_xform_rijndael128 },
|
||||
{ SADB_X_EALG_AES, &enc_xform_aes_cbc },
|
||||
{ SADB_EALG_NULL, &enc_xform_null },
|
||||
{ SADB_X_EALG_AESCTR, &enc_xform_aes_icm },
|
||||
{ SADB_X_EALG_AESGCM16, &enc_xform_aes_nist_gcm },
|
||||
|
@ -559,8 +559,8 @@ crypto_cipher(const struct crypto_session_params *csp)
|
||||
{
|
||||
|
||||
switch (csp->csp_cipher_alg) {
|
||||
case CRYPTO_RIJNDAEL128_CBC:
|
||||
return (&enc_xform_rijndael128);
|
||||
case CRYPTO_AES_CBC:
|
||||
return (&enc_xform_aes_cbc);
|
||||
case CRYPTO_AES_XTS:
|
||||
return (&enc_xform_aes_xts);
|
||||
case CRYPTO_AES_ICM:
|
||||
|
@ -346,7 +346,7 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop)
|
||||
txform = NULL;
|
||||
break;
|
||||
case CRYPTO_AES_CBC:
|
||||
txform = &enc_xform_rijndael128;
|
||||
txform = &enc_xform_aes_cbc;
|
||||
break;
|
||||
case CRYPTO_AES_XTS:
|
||||
txform = &enc_xform_aes_xts;
|
||||
|
@ -73,7 +73,7 @@ MALLOC_DEFINE(M_XDATA, "xform", "xform data buffers");
|
||||
|
||||
/* Include the encryption algorithms */
|
||||
#include "xform_null.c"
|
||||
#include "xform_rijndael.c"
|
||||
#include "xform_aes_cbc.c"
|
||||
#include "xform_aes_icm.c"
|
||||
#include "xform_aes_xts.c"
|
||||
#include "xform_cml.c"
|
||||
|
@ -53,41 +53,41 @@ __FBSDID("$FreeBSD$");
|
||||
#include <crypto/rijndael/rijndael.h>
|
||||
#include <opencrypto/xform_enc.h>
|
||||
|
||||
static int rijndael128_setkey(void *, const uint8_t *, int);
|
||||
static void rijndael128_encrypt(void *, const uint8_t *, uint8_t *);
|
||||
static void rijndael128_decrypt(void *, const uint8_t *, uint8_t *);
|
||||
static int aes_cbc_setkey(void *, const uint8_t *, int);
|
||||
static void aes_cbc_encrypt(void *, const uint8_t *, uint8_t *);
|
||||
static void aes_cbc_decrypt(void *, const uint8_t *, uint8_t *);
|
||||
|
||||
/* Encryption instances */
|
||||
const struct enc_xform enc_xform_rijndael128 = {
|
||||
.type = CRYPTO_RIJNDAEL128_CBC,
|
||||
.name = "Rijndael-128/AES",
|
||||
const struct enc_xform enc_xform_aes_cbc = {
|
||||
.type = CRYPTO_AES_CBC,
|
||||
.name = "AES-CBC",
|
||||
.ctxsize = sizeof(rijndael_ctx),
|
||||
.blocksize = RIJNDAEL128_BLOCK_LEN,
|
||||
.ivsize = RIJNDAEL128_BLOCK_LEN,
|
||||
.minkey = RIJNDAEL_MIN_KEY,
|
||||
.maxkey = RIJNDAEL_MAX_KEY,
|
||||
.encrypt = rijndael128_encrypt,
|
||||
.decrypt = rijndael128_decrypt,
|
||||
.setkey = rijndael128_setkey,
|
||||
.blocksize = AES_BLOCK_LEN,
|
||||
.ivsize = AES_BLOCK_LEN,
|
||||
.minkey = AES_MIN_KEY,
|
||||
.maxkey = AES_MAX_KEY,
|
||||
.encrypt = aes_cbc_encrypt,
|
||||
.decrypt = aes_cbc_decrypt,
|
||||
.setkey = aes_cbc_setkey,
|
||||
};
|
||||
|
||||
/*
|
||||
* Encryption wrapper routines.
|
||||
*/
|
||||
static void
|
||||
rijndael128_encrypt(void *key, const uint8_t *in, uint8_t *out)
|
||||
aes_cbc_encrypt(void *key, const uint8_t *in, uint8_t *out)
|
||||
{
|
||||
rijndael_encrypt(key, in, out);
|
||||
}
|
||||
|
||||
static void
|
||||
rijndael128_decrypt(void *key, const uint8_t *in, uint8_t *out)
|
||||
aes_cbc_decrypt(void *key, const uint8_t *in, uint8_t *out)
|
||||
{
|
||||
rijndael_decrypt(key, in, out);
|
||||
}
|
||||
|
||||
static int
|
||||
rijndael128_setkey(void *sched, const uint8_t *key, int len)
|
||||
aes_cbc_setkey(void *sched, const uint8_t *key, int len)
|
||||
{
|
||||
|
||||
if (len != 16 && len != 24 && len != 32)
|
@ -81,7 +81,7 @@ struct enc_xform {
|
||||
|
||||
|
||||
extern const struct enc_xform enc_xform_null;
|
||||
extern const struct enc_xform enc_xform_rijndael128;
|
||||
extern const struct enc_xform enc_xform_aes_cbc;
|
||||
extern const struct enc_xform enc_xform_aes_icm;
|
||||
extern const struct enc_xform enc_xform_aes_nist_gcm;
|
||||
extern const struct enc_xform enc_xform_aes_nist_gmac;
|
||||
|
Loading…
Reference in New Issue
Block a user