• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 syzkaller project authors. All rights reserved.
2# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
3
4# AF_ALG support.
5
6include <linux/socket.h>
7include <linux/net.h>
8include <linux/crypto.h>
9include <uapi/linux/if_alg.h>
10
11resource sock_alg[sock]
12resource sock_algconn[sock]
13
14socket$alg(domain const[AF_ALG], type const[SOCK_SEQPACKET], proto const[0]) sock_alg
15bind$alg(fd sock_alg, addr ptr[in, sockaddr_alg], addrlen len[addr])
16setsockopt$ALG_SET_KEY(fd sock_alg, level const[SOL_ALG], opt const[ALG_SET_KEY], key buffer[in], keylen len[key])
17setsockopt$ALG_SET_AEAD_AUTHSIZE(fd sock_alg, level const[SOL_ALG], opt const[ALG_SET_AEAD_AUTHSIZE], val const[0], size intptr)
18accept$alg(fd sock_alg, peer const[0], peerlen const[0]) sock_algconn
19accept4$alg(fd sock_alg, peer const[0], peerlen const[0], flags flags[accept_flags]) sock_algconn
20sendmsg$alg(fd sock_algconn, msg ptr[in, msghdr_alg], f flags[send_flags])
21sendmmsg$alg(fd sock_algconn, mmsg ptr[in, array[msghdr_alg]], vlen len[mmsg], f flags[send_flags])
22
23# Special struct generated by Go code.
24sockaddr_alg {
25	family	const[AF_ALG, int16]
26	type	string["filled later", 14]
27	feat	flags[af_alg_type, int32]
28	mask	flags[af_alg_type, int32]
29	name	string["filled later", 64]
30}
31
32# Special struct generated by Go code.
33alg_name {
34	name	string["filled later", 64]
35}
36
37# Special struct generated by Go code.
38alg_aead_name {
39	name	string["filled later", 64]
40}
41
42# Special struct generated by Go code.
43alg_hash_name {
44	name	string["filled later", 64]
45}
46
47# Special struct generated by Go code.
48alg_blkcipher_name {
49	name	string["filled later", 64]
50}
51
52alg_compress_name {
53	name	string[alg_compress_names, 64]
54}
55
56# This is what XFRM supports (see xfrm_calg_list).
57alg_compress_names = "deflate", "lzs", "lzjh"
58
59msghdr_alg {
60	addr	const[0, intptr]
61	addrlen	const[0, int32]
62	vec	ptr[in, array[iovec_in]]
63	vlen	len[vec, intptr]
64	ctrl	ptr[in, array[cmsghdr_alg], opt]
65	ctrllen	bytesize[ctrl, intptr]
66	f	flags[send_flags, int32]
67}
68
69cmsghdr_alg [
70	iv	cmsghdr_alg_iv
71	op	cmsghdr_alg_op
72	assoc	cmsghdr_alg_assoc
73] [varlen]
74
75cmsghdr_alg_iv {
76	len	len[parent, intptr]
77	level	const[SOL_ALG, int32]
78	type	const[ALG_SET_IV, int32]
79	ivlen	len[iv, int32]
80	iv	array[int8]
81} [align_ptr]
82
83cmsghdr_alg_op {
84	len	len[parent, intptr]
85	level	const[SOL_ALG, int32]
86	type	const[ALG_SET_OP, int32]
87	op	flags[alg_op_op, int32]
88} [align_ptr]
89
90cmsghdr_alg_assoc {
91	len	len[parent, intptr]
92	level	const[SOL_ALG, int32]
93	type	const[ALG_SET_AEAD_ASSOCLEN, int32]
94	assoc	int32
95} [align_ptr]
96
97af_alg_type = CRYPTO_ALG_TYPE_MASK, CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_COMPRESS, CRYPTO_ALG_TYPE_AEAD, CRYPTO_ALG_TYPE_BLKCIPHER, CRYPTO_ALG_TYPE_ABLKCIPHER, CRYPTO_ALG_TYPE_GIVCIPHER, CRYPTO_ALG_TYPE_DIGEST, CRYPTO_ALG_TYPE_HASH, CRYPTO_ALG_TYPE_SHASH, CRYPTO_ALG_TYPE_AHASH, CRYPTO_ALG_TYPE_RNG, CRYPTO_ALG_TYPE_AKCIPHER, CRYPTO_ALG_TYPE_PCOMPRESS, CRYPTO_ALG_LARVAL, CRYPTO_ALG_DEAD, CRYPTO_ALG_DYING, CRYPTO_ALG_ASYNC, CRYPTO_ALG_NEED_FALLBACK, CRYPTO_ALG_GENIV, CRYPTO_ALG_TESTED, CRYPTO_ALG_INSTANCE, CRYPTO_ALG_KERN_DRIVER_ONLY, CRYPTO_ALG_INTERNAL
98
99alg_op_op = ALG_OP_DECRYPT, ALG_OP_ENCRYPT
100
101# Removed in next-20160210 (commit 11049218)
102define CRYPTO_ALG_TYPE_PCOMPRESS	0x0000000f
103