Horia Geantă | 8cea7b6 | 2016-11-22 15:44:09 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Shared descriptors for aead, ablkcipher algorithms |
| 3 | * |
| 4 | * Copyright 2016 NXP |
| 5 | */ |
| 6 | |
| 7 | #ifndef _CAAMALG_DESC_H_ |
| 8 | #define _CAAMALG_DESC_H_ |
| 9 | |
| 10 | /* length of descriptors text */ |
| 11 | #define DESC_AEAD_BASE (4 * CAAM_CMD_SZ) |
| 12 | #define DESC_AEAD_ENC_LEN (DESC_AEAD_BASE + 11 * CAAM_CMD_SZ) |
| 13 | #define DESC_AEAD_DEC_LEN (DESC_AEAD_BASE + 15 * CAAM_CMD_SZ) |
| 14 | #define DESC_AEAD_GIVENC_LEN (DESC_AEAD_ENC_LEN + 7 * CAAM_CMD_SZ) |
Horia Geantă | b189817 | 2017-03-17 12:06:02 +0200 | [diff] [blame] | 15 | #define DESC_QI_AEAD_ENC_LEN (DESC_AEAD_ENC_LEN + 3 * CAAM_CMD_SZ) |
| 16 | #define DESC_QI_AEAD_DEC_LEN (DESC_AEAD_DEC_LEN + 3 * CAAM_CMD_SZ) |
| 17 | #define DESC_QI_AEAD_GIVENC_LEN (DESC_AEAD_GIVENC_LEN + 3 * CAAM_CMD_SZ) |
Horia Geantă | 8cea7b6 | 2016-11-22 15:44:09 +0200 | [diff] [blame] | 18 | |
| 19 | /* Note: Nonce is counted in cdata.keylen */ |
| 20 | #define DESC_AEAD_CTR_RFC3686_LEN (4 * CAAM_CMD_SZ) |
| 21 | |
| 22 | #define DESC_AEAD_NULL_BASE (3 * CAAM_CMD_SZ) |
| 23 | #define DESC_AEAD_NULL_ENC_LEN (DESC_AEAD_NULL_BASE + 11 * CAAM_CMD_SZ) |
| 24 | #define DESC_AEAD_NULL_DEC_LEN (DESC_AEAD_NULL_BASE + 13 * CAAM_CMD_SZ) |
| 25 | |
| 26 | #define DESC_GCM_BASE (3 * CAAM_CMD_SZ) |
| 27 | #define DESC_GCM_ENC_LEN (DESC_GCM_BASE + 16 * CAAM_CMD_SZ) |
| 28 | #define DESC_GCM_DEC_LEN (DESC_GCM_BASE + 12 * CAAM_CMD_SZ) |
| 29 | |
| 30 | #define DESC_RFC4106_BASE (3 * CAAM_CMD_SZ) |
| 31 | #define DESC_RFC4106_ENC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ) |
| 32 | #define DESC_RFC4106_DEC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ) |
| 33 | |
| 34 | #define DESC_RFC4543_BASE (3 * CAAM_CMD_SZ) |
| 35 | #define DESC_RFC4543_ENC_LEN (DESC_RFC4543_BASE + 11 * CAAM_CMD_SZ) |
| 36 | #define DESC_RFC4543_DEC_LEN (DESC_RFC4543_BASE + 12 * CAAM_CMD_SZ) |
| 37 | |
| 38 | #define DESC_ABLKCIPHER_BASE (3 * CAAM_CMD_SZ) |
| 39 | #define DESC_ABLKCIPHER_ENC_LEN (DESC_ABLKCIPHER_BASE + \ |
| 40 | 20 * CAAM_CMD_SZ) |
| 41 | #define DESC_ABLKCIPHER_DEC_LEN (DESC_ABLKCIPHER_BASE + \ |
| 42 | 15 * CAAM_CMD_SZ) |
| 43 | |
| 44 | void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata, |
| 45 | unsigned int icvsize); |
| 46 | |
| 47 | void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata, |
| 48 | unsigned int icvsize); |
| 49 | |
| 50 | void cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata, |
Horia Geantă | b189817 | 2017-03-17 12:06:02 +0200 | [diff] [blame] | 51 | struct alginfo *adata, unsigned int ivsize, |
| 52 | unsigned int icvsize, const bool is_rfc3686, |
| 53 | u32 *nonce, const u32 ctx1_iv_off, |
| 54 | const bool is_qi); |
Horia Geantă | 8cea7b6 | 2016-11-22 15:44:09 +0200 | [diff] [blame] | 55 | |
| 56 | void cnstr_shdsc_aead_decap(u32 * const desc, struct alginfo *cdata, |
| 57 | struct alginfo *adata, unsigned int ivsize, |
| 58 | unsigned int icvsize, const bool geniv, |
| 59 | const bool is_rfc3686, u32 *nonce, |
Horia Geantă | b189817 | 2017-03-17 12:06:02 +0200 | [diff] [blame] | 60 | const u32 ctx1_iv_off, const bool is_qi); |
Horia Geantă | 8cea7b6 | 2016-11-22 15:44:09 +0200 | [diff] [blame] | 61 | |
| 62 | void cnstr_shdsc_aead_givencap(u32 * const desc, struct alginfo *cdata, |
| 63 | struct alginfo *adata, unsigned int ivsize, |
| 64 | unsigned int icvsize, const bool is_rfc3686, |
Horia Geantă | b189817 | 2017-03-17 12:06:02 +0200 | [diff] [blame] | 65 | u32 *nonce, const u32 ctx1_iv_off, |
| 66 | const bool is_qi); |
Horia Geantă | 8cea7b6 | 2016-11-22 15:44:09 +0200 | [diff] [blame] | 67 | |
| 68 | void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata, |
| 69 | unsigned int icvsize); |
| 70 | |
| 71 | void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata, |
| 72 | unsigned int icvsize); |
| 73 | |
| 74 | void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata, |
| 75 | unsigned int icvsize); |
| 76 | |
| 77 | void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata, |
| 78 | unsigned int icvsize); |
| 79 | |
| 80 | void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata, |
| 81 | unsigned int icvsize); |
| 82 | |
| 83 | void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata, |
| 84 | unsigned int icvsize); |
| 85 | |
| 86 | void cnstr_shdsc_ablkcipher_encap(u32 * const desc, struct alginfo *cdata, |
| 87 | unsigned int ivsize, const bool is_rfc3686, |
| 88 | const u32 ctx1_iv_off); |
| 89 | |
| 90 | void cnstr_shdsc_ablkcipher_decap(u32 * const desc, struct alginfo *cdata, |
| 91 | unsigned int ivsize, const bool is_rfc3686, |
| 92 | const u32 ctx1_iv_off); |
| 93 | |
| 94 | void cnstr_shdsc_ablkcipher_givencap(u32 * const desc, struct alginfo *cdata, |
| 95 | unsigned int ivsize, const bool is_rfc3686, |
| 96 | const u32 ctx1_iv_off); |
| 97 | |
| 98 | void cnstr_shdsc_xts_ablkcipher_encap(u32 * const desc, struct alginfo *cdata); |
| 99 | |
| 100 | void cnstr_shdsc_xts_ablkcipher_decap(u32 * const desc, struct alginfo *cdata); |
| 101 | |
| 102 | #endif /* _CAAMALG_DESC_H_ */ |