1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
6 struct bpf_crypto_type
{
7 void *(*alloc_tfm
)(const char *algo
);
8 void (*free_tfm
)(void *tfm
);
9 int (*has_algo
)(const char *algo
);
10 int (*setkey
)(void *tfm
, const u8
*key
, unsigned int keylen
);
11 int (*setauthsize
)(void *tfm
, unsigned int authsize
);
12 int (*encrypt
)(void *tfm
, const u8
*src
, u8
*dst
, unsigned int len
, u8
*iv
);
13 int (*decrypt
)(void *tfm
, const u8
*src
, u8
*dst
, unsigned int len
, u8
*iv
);
14 unsigned int (*ivsize
)(void *tfm
);
15 unsigned int (*statesize
)(void *tfm
);
16 u32 (*get_flags
)(void *tfm
);
21 int bpf_crypto_register_type(const struct bpf_crypto_type
*type
);
22 int bpf_crypto_unregister_type(const struct bpf_crypto_type
*type
);
24 #endif /* _BPF_CRYPTO_H */