1*3e1c6f35SVadim Fedorenko /* SPDX-License-Identifier: GPL-2.0-only */ 2*3e1c6f35SVadim Fedorenko /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ 3*3e1c6f35SVadim Fedorenko #ifndef _BPF_CRYPTO_H 4*3e1c6f35SVadim Fedorenko #define _BPF_CRYPTO_H 5*3e1c6f35SVadim Fedorenko 6*3e1c6f35SVadim Fedorenko struct bpf_crypto_type { 7*3e1c6f35SVadim Fedorenko void *(*alloc_tfm)(const char *algo); 8*3e1c6f35SVadim Fedorenko void (*free_tfm)(void *tfm); 9*3e1c6f35SVadim Fedorenko int (*has_algo)(const char *algo); 10*3e1c6f35SVadim Fedorenko int (*setkey)(void *tfm, const u8 *key, unsigned int keylen); 11*3e1c6f35SVadim Fedorenko int (*setauthsize)(void *tfm, unsigned int authsize); 12*3e1c6f35SVadim Fedorenko int (*encrypt)(void *tfm, const u8 *src, u8 *dst, unsigned int len, u8 *iv); 13*3e1c6f35SVadim Fedorenko int (*decrypt)(void *tfm, const u8 *src, u8 *dst, unsigned int len, u8 *iv); 14*3e1c6f35SVadim Fedorenko unsigned int (*ivsize)(void *tfm); 15*3e1c6f35SVadim Fedorenko unsigned int (*statesize)(void *tfm); 16*3e1c6f35SVadim Fedorenko u32 (*get_flags)(void *tfm); 17*3e1c6f35SVadim Fedorenko struct module *owner; 18*3e1c6f35SVadim Fedorenko char name[14]; 19*3e1c6f35SVadim Fedorenko }; 20*3e1c6f35SVadim Fedorenko 21*3e1c6f35SVadim Fedorenko int bpf_crypto_register_type(const struct bpf_crypto_type *type); 22*3e1c6f35SVadim Fedorenko int bpf_crypto_unregister_type(const struct bpf_crypto_type *type); 23*3e1c6f35SVadim Fedorenko 24*3e1c6f35SVadim Fedorenko #endif /* _BPF_CRYPTO_H */ 25