1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright 2019 Google LLC 4 */ 5 6 #ifndef LAPI_IF_ALG_H__ 7 #define LAPI_IF_ALG_H__ 8 9 #ifdef HAVE_LINUX_IF_ALG_H 10 # include <linux/if_alg.h> 11 #endif 12 # include <stdint.h> 13 14 #ifndef HAVE_STRUCT_SOCKADDR_ALG 15 struct sockaddr_alg { 16 uint16_t salg_family; 17 uint8_t salg_type[14]; 18 uint32_t salg_feat; 19 uint32_t salg_mask; 20 uint8_t salg_name[64]; 21 }; 22 #endif 23 24 #ifndef HAVE_STRUCT_AF_ALG_IV 25 struct af_alg_iv { 26 uint32_t ivlen; 27 uint8_t iv[0]; 28 }; 29 #endif 30 31 #ifndef ALG_SET_KEY 32 # define ALG_SET_KEY 1 33 #endif 34 35 #ifndef ALG_SET_IV 36 # define ALG_SET_IV 2 37 #endif 38 39 #ifndef ALG_SET_OP 40 # define ALG_SET_OP 3 41 #endif 42 43 #ifndef ALG_SET_AEAD_ASSOCLEN 44 # define ALG_SET_AEAD_ASSOCLEN 4 45 #endif 46 47 #ifndef ALG_SET_AEAD_AUTHSIZE 48 # define ALG_SET_AEAD_AUTHSIZE 5 49 #endif 50 51 #ifndef ALG_OP_DECRYPT 52 # define ALG_OP_DECRYPT 0 53 #endif 54 55 #ifndef ALG_OP_ENCRYPT 56 # define ALG_OP_ENCRYPT 1 57 #endif 58 59 #endif /* LAPI_IF_ALG_H__ */ 60