0001
0002
0003
0004
0005
0006 #ifndef _AEAD_H_
0007 #define _AEAD_H_
0008
0009 #include "common.h"
0010 #include "core.h"
0011
0012 #define QCE_MAX_KEY_SIZE 64
0013 #define QCE_CCM4309_SALT_SIZE 3
0014
0015 struct qce_aead_ctx {
0016 u8 enc_key[QCE_MAX_KEY_SIZE];
0017 u8 auth_key[QCE_MAX_KEY_SIZE];
0018 u8 ccm4309_salt[QCE_CCM4309_SALT_SIZE];
0019 unsigned int enc_keylen;
0020 unsigned int auth_keylen;
0021 unsigned int authsize;
0022 bool need_fallback;
0023 struct crypto_aead *fallback;
0024 };
0025
0026 struct qce_aead_reqctx {
0027 unsigned long flags;
0028 u8 *iv;
0029 unsigned int ivsize;
0030 int src_nents;
0031 int dst_nents;
0032 struct scatterlist result_sg;
0033 struct scatterlist adata_sg;
0034 struct sg_table dst_tbl;
0035 struct sg_table src_tbl;
0036 struct scatterlist *dst_sg;
0037 struct scatterlist *src_sg;
0038 unsigned int cryptlen;
0039 unsigned int assoclen;
0040 unsigned char *adata;
0041 u8 ccm_nonce[QCE_MAX_NONCE];
0042 u8 ccmresult_buf[QCE_BAM_BURST_SIZE];
0043 u8 ccm_rfc4309_iv[QCE_MAX_IV_SIZE];
0044 struct aead_request fallback_req;
0045 };
0046
0047 static inline struct qce_alg_template *to_aead_tmpl(struct crypto_aead *tfm)
0048 {
0049 struct aead_alg *alg = crypto_aead_alg(tfm);
0050
0051 return container_of(alg, struct qce_alg_template, alg.aead);
0052 }
0053
0054 extern const struct qce_algo_ops aead_ops;
0055
0056 #endif