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