wc_afalg.h
1 /* wc_afalg.h
2  *
3  * Copyright (C) 2006-2020 wolfSSL Inc.
4  *
5  * This file is part of wolfSSL.
6  *
7  * wolfSSL is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * wolfSSL is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20  */
21 
22 
23 #ifndef WOLFSSL_AFALG_H
24 #define WOLFSSL_AFALG_H
25 
27 
28 #include <sys/socket.h>
29 #include <linux/if_alg.h>
30 #include <linux/socket.h>
31 
32 #define WC_SOCK_NOTSET -1
33 
34 /* In some cases these flags are not set in AF_ALG header files.
35  * Documentation provided at kernel.org/doc/html/v4.16/crypto/userspace-if.html
36  * suggests using these values if not set */
37 #ifndef AF_ALG
38  #define AF_ALG 38
39 #endif
40 #ifndef SOL_ALG
41  #define SOL_ALG 279
42 #endif
43 
44 WOLFSSL_LOCAL void wc_Afalg_SockAddr(struct sockaddr_alg* in, const char* type, const char* name);
45 WOLFSSL_LOCAL int wc_Afalg_Accept(struct sockaddr_alg* in, int inSz, int sock);
46 WOLFSSL_LOCAL int wc_Afalg_Socket(void);
47 WOLFSSL_LOCAL int wc_Afalg_CreateRead(int sock, const char* type, const char* name);
48 WOLFSSL_LOCAL int wc_Afalg_SetIv(struct cmsghdr* cmsg, byte* iv, word32 ivSz);
49 WOLFSSL_LOCAL int wc_Afalg_SetOp(struct cmsghdr* cmsg, int dir);
50 WOLFSSL_LOCAL int wc_Afalg_SetAad(struct cmsghdr* cmsg, word32 sz);
51 
52 #endif /* WOLFSSL_AFALG_H */
53