File: aead.h

package info (click to toggle)
linux 6.1.153-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,496,348 kB
  • sloc: ansic: 23,476,872; asm: 266,650; sh: 110,570; makefile: 49,899; python: 36,950; perl: 36,836; cpp: 6,055; yacc: 4,908; lex: 2,725; awk: 1,440; ruby: 25; sed: 5
file content (56 lines) | stat: -rw-r--r-- 1,262 bytes parent folder | download | duplicates (32)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2021, Linaro Limited. All rights reserved.
 */

#ifndef _AEAD_H_
#define _AEAD_H_

#include "common.h"
#include "core.h"

#define QCE_MAX_KEY_SIZE		64
#define QCE_CCM4309_SALT_SIZE		3

struct qce_aead_ctx {
	u8 enc_key[QCE_MAX_KEY_SIZE];
	u8 auth_key[QCE_MAX_KEY_SIZE];
	u8 ccm4309_salt[QCE_CCM4309_SALT_SIZE];
	unsigned int enc_keylen;
	unsigned int auth_keylen;
	unsigned int authsize;
	bool need_fallback;
	struct crypto_aead *fallback;
};

struct qce_aead_reqctx {
	unsigned long flags;
	u8 *iv;
	unsigned int ivsize;
	int src_nents;
	int dst_nents;
	struct scatterlist result_sg;
	struct scatterlist adata_sg;
	struct sg_table dst_tbl;
	struct sg_table src_tbl;
	struct scatterlist *dst_sg;
	struct scatterlist *src_sg;
	unsigned int cryptlen;
	unsigned int assoclen;
	unsigned char *adata;
	u8 ccm_nonce[QCE_MAX_NONCE];
	u8 ccmresult_buf[QCE_BAM_BURST_SIZE];
	u8 ccm_rfc4309_iv[QCE_MAX_IV_SIZE];
	struct aead_request fallback_req;
};

static inline struct qce_alg_template *to_aead_tmpl(struct crypto_aead *tfm)
{
	struct aead_alg *alg = crypto_aead_alg(tfm);

	return container_of(alg, struct qce_alg_template, alg.aead);
}

extern const struct qce_algo_ops aead_ops;

#endif /* _AEAD_H_ */