mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
icp: brutally remove unused AES modes
Still retaining the struture, for now. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16209
This commit is contained in:
committed by
Brian Behlendorf
parent
4185179190
commit
57249bcddc
@@ -45,12 +45,8 @@ extern "C" {
|
||||
extern boolean_t gcm_avx_can_use_movbe;
|
||||
#endif
|
||||
|
||||
#define ECB_MODE 0x00000002
|
||||
#define CBC_MODE 0x00000004
|
||||
#define CTR_MODE 0x00000008
|
||||
#define CCM_MODE 0x00000010
|
||||
#define GCM_MODE 0x00000020
|
||||
#define GMAC_MODE 0x00000040
|
||||
|
||||
/*
|
||||
* cc_keysched: Pointer to key schedule.
|
||||
@@ -76,7 +72,7 @@ extern boolean_t gcm_avx_can_use_movbe;
|
||||
* by the caller, or internally, e.g. an init routine.
|
||||
* If allocated by the latter, then it needs to be freed.
|
||||
*
|
||||
* ECB_MODE, CBC_MODE, CTR_MODE, or CCM_MODE
|
||||
* CCM_MODE
|
||||
*/
|
||||
struct common_ctx {
|
||||
void *cc_keysched;
|
||||
@@ -91,57 +87,6 @@ struct common_ctx {
|
||||
|
||||
typedef struct common_ctx common_ctx_t;
|
||||
|
||||
typedef struct ecb_ctx {
|
||||
struct common_ctx ecb_common;
|
||||
uint64_t ecb_lastblock[2];
|
||||
} ecb_ctx_t;
|
||||
|
||||
#define ecb_keysched ecb_common.cc_keysched
|
||||
#define ecb_keysched_len ecb_common.cc_keysched_len
|
||||
#define ecb_iv ecb_common.cc_iv
|
||||
#define ecb_remainder ecb_common.cc_remainder
|
||||
#define ecb_remainder_len ecb_common.cc_remainder_len
|
||||
#define ecb_lastp ecb_common.cc_lastp
|
||||
#define ecb_copy_to ecb_common.cc_copy_to
|
||||
#define ecb_flags ecb_common.cc_flags
|
||||
|
||||
typedef struct cbc_ctx {
|
||||
struct common_ctx cbc_common;
|
||||
uint64_t cbc_lastblock[2];
|
||||
} cbc_ctx_t;
|
||||
|
||||
#define cbc_keysched cbc_common.cc_keysched
|
||||
#define cbc_keysched_len cbc_common.cc_keysched_len
|
||||
#define cbc_iv cbc_common.cc_iv
|
||||
#define cbc_remainder cbc_common.cc_remainder
|
||||
#define cbc_remainder_len cbc_common.cc_remainder_len
|
||||
#define cbc_lastp cbc_common.cc_lastp
|
||||
#define cbc_copy_to cbc_common.cc_copy_to
|
||||
#define cbc_flags cbc_common.cc_flags
|
||||
|
||||
/*
|
||||
* ctr_lower_mask Bit-mask for lower 8 bytes of counter block.
|
||||
* ctr_upper_mask Bit-mask for upper 8 bytes of counter block.
|
||||
*/
|
||||
typedef struct ctr_ctx {
|
||||
struct common_ctx ctr_common;
|
||||
uint64_t ctr_lower_mask;
|
||||
uint64_t ctr_upper_mask;
|
||||
uint32_t ctr_tmp[4];
|
||||
} ctr_ctx_t;
|
||||
|
||||
/*
|
||||
* ctr_cb Counter block.
|
||||
*/
|
||||
#define ctr_keysched ctr_common.cc_keysched
|
||||
#define ctr_keysched_len ctr_common.cc_keysched_len
|
||||
#define ctr_cb ctr_common.cc_iv
|
||||
#define ctr_remainder ctr_common.cc_remainder
|
||||
#define ctr_remainder_len ctr_common.cc_remainder_len
|
||||
#define ctr_lastp ctr_common.cc_lastp
|
||||
#define ctr_copy_to ctr_common.cc_copy_to
|
||||
#define ctr_flags ctr_common.cc_flags
|
||||
|
||||
/*
|
||||
*
|
||||
* ccm_mac_len: Stores length of the MAC in CCM mode.
|
||||
@@ -241,27 +186,21 @@ typedef struct gcm_ctx {
|
||||
#define gcm_copy_to gcm_common.cc_copy_to
|
||||
#define gcm_flags gcm_common.cc_flags
|
||||
|
||||
#define AES_GMAC_IV_LEN 12
|
||||
#define AES_GMAC_TAG_BITS 128
|
||||
|
||||
void gcm_clear_ctx(gcm_ctx_t *ctx);
|
||||
|
||||
typedef struct aes_ctx {
|
||||
union {
|
||||
ecb_ctx_t acu_ecb;
|
||||
cbc_ctx_t acu_cbc;
|
||||
ctr_ctx_t acu_ctr;
|
||||
ccm_ctx_t acu_ccm;
|
||||
gcm_ctx_t acu_gcm;
|
||||
} acu;
|
||||
} aes_ctx_t;
|
||||
|
||||
#define ac_flags acu.acu_ecb.ecb_common.cc_flags
|
||||
#define ac_remainder_len acu.acu_ecb.ecb_common.cc_remainder_len
|
||||
#define ac_keysched acu.acu_ecb.ecb_common.cc_keysched
|
||||
#define ac_keysched_len acu.acu_ecb.ecb_common.cc_keysched_len
|
||||
#define ac_iv acu.acu_ecb.ecb_common.cc_iv
|
||||
#define ac_lastp acu.acu_ecb.ecb_common.cc_lastp
|
||||
#define ac_flags acu.acu_ccm.ccm_common.cc_flags
|
||||
#define ac_remainder_len acu.acu_ccm.ccm_common.cc_remainder_len
|
||||
#define ac_keysched acu.acu_ccm.ccm_common.cc_keysched
|
||||
#define ac_keysched_len acu.acu_ccm.ccm_common.cc_keysched_len
|
||||
#define ac_iv acu.acu_ccm.ccm_common.cc_iv
|
||||
#define ac_lastp acu.acu_ccm.ccm_common.cc_lastp
|
||||
#define ac_pt_buf acu.acu_ccm.ccm_pt_buf
|
||||
#define ac_mac_len acu.acu_ccm.ccm_mac_len
|
||||
#define ac_data_len acu.acu_ccm.ccm_data_len
|
||||
@@ -269,27 +208,6 @@ typedef struct aes_ctx {
|
||||
#define ac_processed_data_len acu.acu_ccm.ccm_processed_data_len
|
||||
#define ac_tag_len acu.acu_gcm.gcm_tag_len
|
||||
|
||||
extern int ecb_cipher_contiguous_blocks(ecb_ctx_t *, char *, size_t,
|
||||
crypto_data_t *, size_t, int (*cipher)(const void *, const uint8_t *,
|
||||
uint8_t *));
|
||||
|
||||
extern int cbc_encrypt_contiguous_blocks(cbc_ctx_t *, char *, size_t,
|
||||
crypto_data_t *, size_t,
|
||||
int (*encrypt)(const void *, const uint8_t *, uint8_t *),
|
||||
void (*copy_block)(uint8_t *, uint8_t *),
|
||||
void (*xor_block)(uint8_t *, uint8_t *));
|
||||
|
||||
extern int cbc_decrypt_contiguous_blocks(cbc_ctx_t *, char *, size_t,
|
||||
crypto_data_t *, size_t,
|
||||
int (*decrypt)(const void *, const uint8_t *, uint8_t *),
|
||||
void (*copy_block)(uint8_t *, uint8_t *),
|
||||
void (*xor_block)(uint8_t *, uint8_t *));
|
||||
|
||||
extern int ctr_mode_contiguous_blocks(ctr_ctx_t *, char *, size_t,
|
||||
crypto_data_t *, size_t,
|
||||
int (*cipher)(const void *, const uint8_t *, uint8_t *),
|
||||
void (*xor_block)(uint8_t *, uint8_t *));
|
||||
|
||||
extern int ccm_mode_encrypt_contiguous_blocks(ccm_ctx_t *, char *, size_t,
|
||||
crypto_data_t *, size_t,
|
||||
int (*encrypt_block)(const void *, const uint8_t *, uint8_t *),
|
||||
@@ -332,15 +250,6 @@ extern int gcm_decrypt_final(gcm_ctx_t *, crypto_data_t *, size_t,
|
||||
int (*encrypt_block)(const void *, const uint8_t *, uint8_t *),
|
||||
void (*xor_block)(uint8_t *, uint8_t *));
|
||||
|
||||
extern int ctr_mode_final(ctr_ctx_t *, crypto_data_t *,
|
||||
int (*encrypt_block)(const void *, const uint8_t *, uint8_t *));
|
||||
|
||||
extern int cbc_init_ctx(cbc_ctx_t *, char *, size_t, size_t,
|
||||
void (*copy_block)(uint8_t *, uint64_t *));
|
||||
|
||||
extern int ctr_init_ctx(ctr_ctx_t *, ulong_t, uint8_t *,
|
||||
void (*copy_block)(uint8_t *, uint8_t *));
|
||||
|
||||
extern int ccm_init_ctx(ccm_ctx_t *, char *, int, boolean_t, size_t,
|
||||
int (*encrypt_block)(const void *, const uint8_t *, uint8_t *),
|
||||
void (*xor_block)(uint8_t *, uint8_t *));
|
||||
@@ -350,11 +259,6 @@ extern int gcm_init_ctx(gcm_ctx_t *, char *, size_t,
|
||||
void (*copy_block)(uint8_t *, uint8_t *),
|
||||
void (*xor_block)(uint8_t *, uint8_t *));
|
||||
|
||||
extern int gmac_init_ctx(gcm_ctx_t *, char *, size_t,
|
||||
int (*encrypt_block)(const void *, const uint8_t *, uint8_t *),
|
||||
void (*copy_block)(uint8_t *, uint8_t *),
|
||||
void (*xor_block)(uint8_t *, uint8_t *));
|
||||
|
||||
extern void calculate_ccm_mac(ccm_ctx_t *, uint8_t *,
|
||||
int (*encrypt_block)(const void *, const uint8_t *, uint8_t *));
|
||||
|
||||
@@ -364,12 +268,8 @@ extern void crypto_init_ptrs(crypto_data_t *, void **, offset_t *);
|
||||
extern void crypto_get_ptrs(crypto_data_t *, void **, offset_t *,
|
||||
uint8_t **, size_t *, uint8_t **, size_t);
|
||||
|
||||
extern void *ecb_alloc_ctx(int);
|
||||
extern void *cbc_alloc_ctx(int);
|
||||
extern void *ctr_alloc_ctx(int);
|
||||
extern void *ccm_alloc_ctx(int);
|
||||
extern void *gcm_alloc_ctx(int);
|
||||
extern void *gmac_alloc_ctx(int);
|
||||
extern void crypto_free_mode_ctx(void *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user