# Copyright 2017 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
# AF_ALG support.
include <linux/socket.h>
include <linux/net.h>
include <linux/crypto.h>
include <uapi/linux/if_alg.h>
resource sock_alg[sock]
resource sock_algconn[sock]
socket$alg(domain const[AF_ALG], type const[SOCK_SEQPACKET], proto const[0]) sock_alg
bind$alg(fd sock_alg, addr ptr[in, sockaddr_alg], addrlen len[addr])
setsockopt$ALG_SET_KEY(fd sock_alg, level const[SOL_ALG], opt const[ALG_SET_KEY], key buffer[in], keylen len[key])
setsockopt$ALG_SET_AEAD_AUTHSIZE(fd sock_alg, level const[SOL_ALG], opt const[ALG_SET_AEAD_AUTHSIZE], val const[0], size intptr)
accept$alg(fd sock_alg, peer const[0], peerlen const[0]) sock_algconn
accept4$alg(fd sock_alg, peer const[0], peerlen const[0], flags flags[accept_flags]) sock_algconn
sendmsg$alg(fd sock_algconn, msg ptr[in, msghdr_alg], f flags[send_flags])
sendmmsg$alg(fd sock_algconn, mmsg ptr[in, array[msghdr_alg]], vlen len[mmsg], f flags[send_flags])
# Special struct generated by Go code.
sockaddr_alg {
family const[AF_ALG, int16]
type string["filled later", 14]
feat flags[af_alg_type, int32]
mask flags[af_alg_type, int32]
name string["filled later", 64]
}
# Special struct generated by Go code.
alg_name {
name string["filled later", 64]
}
# Special struct generated by Go code.
alg_aead_name {
name string["filled later", 64]
}
# Special struct generated by Go code.
alg_hash_name {
name string["filled later", 64]
}
# Special struct generated by Go code.
alg_blkcipher_name {
name string["filled later", 64]
}
alg_compress_name {
name string[alg_compress_names, 64]
}
# This is what XFRM supports (see xfrm_calg_list).
alg_compress_names = "deflate", "lzs", "lzjh"
msghdr_alg {
addr const[0, intptr]
addrlen const[0, int32]
vec ptr[in, array[iovec_in]]
vlen len[vec, intptr]
ctrl ptr[in, array[cmsghdr_alg], opt]
ctrllen bytesize[ctrl, intptr]
f flags[send_flags, int32]
}
cmsghdr_alg [
iv cmsghdr_alg_iv
op cmsghdr_alg_op
assoc cmsghdr_alg_assoc
] [varlen]
cmsghdr_alg_iv {
len len[parent, intptr]
level const[SOL_ALG, int32]
type const[ALG_SET_IV, int32]
ivlen len[iv, int32]
iv array[int8]
} [align_ptr]
cmsghdr_alg_op {
len len[parent, intptr]
level const[SOL_ALG, int32]
type const[ALG_SET_OP, int32]
op flags[alg_op_op, int32]
} [align_ptr]
cmsghdr_alg_assoc {
len len[parent, intptr]
level const[SOL_ALG, int32]
type const[ALG_SET_AEAD_ASSOCLEN, int32]
assoc int32
} [align_ptr]
af_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
alg_op_op = ALG_OP_DECRYPT, ALG_OP_ENCRYPT
# Removed in next-20160210 (commit 11049218)
define CRYPTO_ALG_TYPE_PCOMPRESS 0x0000000f