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;
|
int sadb_alg;
|
||||||
const struct enc_xform *xform;
|
const struct enc_xform *xform;
|
||||||
} supported_ealgs[] = {
|
} supported_ealgs[] = {
|
||||||
{ SADB_X_EALG_AES, &enc_xform_rijndael128 },
|
{ SADB_X_EALG_AES, &enc_xform_aes_cbc },
|
||||||
{ SADB_EALG_NULL, &enc_xform_null },
|
{ SADB_EALG_NULL, &enc_xform_null },
|
||||||
{ SADB_X_EALG_AESCTR, &enc_xform_aes_icm },
|
{ SADB_X_EALG_AESCTR, &enc_xform_aes_icm },
|
||||||
{ SADB_X_EALG_AESGCM16, &enc_xform_aes_nist_gcm },
|
{ 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) {
|
switch (csp->csp_cipher_alg) {
|
||||||
case CRYPTO_RIJNDAEL128_CBC:
|
case CRYPTO_AES_CBC:
|
||||||
return (&enc_xform_rijndael128);
|
return (&enc_xform_aes_cbc);
|
||||||
case CRYPTO_AES_XTS:
|
case CRYPTO_AES_XTS:
|
||||||
return (&enc_xform_aes_xts);
|
return (&enc_xform_aes_xts);
|
||||||
case CRYPTO_AES_ICM:
|
case CRYPTO_AES_ICM:
|
||||||
|
@ -346,7 +346,7 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop)
|
|||||||
txform = NULL;
|
txform = NULL;
|
||||||
break;
|
break;
|
||||||
case CRYPTO_AES_CBC:
|
case CRYPTO_AES_CBC:
|
||||||
txform = &enc_xform_rijndael128;
|
txform = &enc_xform_aes_cbc;
|
||||||
break;
|
break;
|
||||||
case CRYPTO_AES_XTS:
|
case CRYPTO_AES_XTS:
|
||||||
txform = &enc_xform_aes_xts;
|
txform = &enc_xform_aes_xts;
|
||||||
|
@ -73,7 +73,7 @@ MALLOC_DEFINE(M_XDATA, "xform", "xform data buffers");
|
|||||||
|
|
||||||
/* Include the encryption algorithms */
|
/* Include the encryption algorithms */
|
||||||
#include "xform_null.c"
|
#include "xform_null.c"
|
||||||
#include "xform_rijndael.c"
|
#include "xform_aes_cbc.c"
|
||||||
#include "xform_aes_icm.c"
|
#include "xform_aes_icm.c"
|
||||||
#include "xform_aes_xts.c"
|
#include "xform_aes_xts.c"
|
||||||
#include "xform_cml.c"
|
#include "xform_cml.c"
|
||||||
|
@ -53,41 +53,41 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <crypto/rijndael/rijndael.h>
|
#include <crypto/rijndael/rijndael.h>
|
||||||
#include <opencrypto/xform_enc.h>
|
#include <opencrypto/xform_enc.h>
|
||||||
|
|
||||||
static int rijndael128_setkey(void *, const uint8_t *, int);
|
static int aes_cbc_setkey(void *, const uint8_t *, int);
|
||||||
static void rijndael128_encrypt(void *, const uint8_t *, uint8_t *);
|
static void aes_cbc_encrypt(void *, const uint8_t *, uint8_t *);
|
||||||
static void rijndael128_decrypt(void *, const uint8_t *, uint8_t *);
|
static void aes_cbc_decrypt(void *, const uint8_t *, uint8_t *);
|
||||||
|
|
||||||
/* Encryption instances */
|
/* Encryption instances */
|
||||||
const struct enc_xform enc_xform_rijndael128 = {
|
const struct enc_xform enc_xform_aes_cbc = {
|
||||||
.type = CRYPTO_RIJNDAEL128_CBC,
|
.type = CRYPTO_AES_CBC,
|
||||||
.name = "Rijndael-128/AES",
|
.name = "AES-CBC",
|
||||||
.ctxsize = sizeof(rijndael_ctx),
|
.ctxsize = sizeof(rijndael_ctx),
|
||||||
.blocksize = RIJNDAEL128_BLOCK_LEN,
|
.blocksize = AES_BLOCK_LEN,
|
||||||
.ivsize = RIJNDAEL128_BLOCK_LEN,
|
.ivsize = AES_BLOCK_LEN,
|
||||||
.minkey = RIJNDAEL_MIN_KEY,
|
.minkey = AES_MIN_KEY,
|
||||||
.maxkey = RIJNDAEL_MAX_KEY,
|
.maxkey = AES_MAX_KEY,
|
||||||
.encrypt = rijndael128_encrypt,
|
.encrypt = aes_cbc_encrypt,
|
||||||
.decrypt = rijndael128_decrypt,
|
.decrypt = aes_cbc_decrypt,
|
||||||
.setkey = rijndael128_setkey,
|
.setkey = aes_cbc_setkey,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Encryption wrapper routines.
|
* Encryption wrapper routines.
|
||||||
*/
|
*/
|
||||||
static void
|
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);
|
rijndael_encrypt(key, in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
rijndael_decrypt(key, in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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)
|
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_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_icm;
|
||||||
extern const struct enc_xform enc_xform_aes_nist_gcm;
|
extern const struct enc_xform enc_xform_aes_nist_gcm;
|
||||||
extern const struct enc_xform enc_xform_aes_nist_gmac;
|
extern const struct enc_xform enc_xform_aes_nist_gmac;
|
||||||
|
Loading…
Reference in New Issue
Block a user