github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/socket_alg.txt (about)

     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  
     6  include <linux/socket.h>
     7  include <linux/net.h>
     8  include <linux/crypto.h>
     9  include <uapi/linux/if_alg.h>
    10  
    11  resource sock_alg[sock]
    12  resource sock_algconn[sock]
    13  
    14  socket$alg(domain const[AF_ALG], type const[SOCK_SEQPACKET], proto const[0]) sock_alg
    15  bind$alg(fd sock_alg, addr ptr[in, sockaddr_alg], addrlen len[addr])
    16  setsockopt$ALG_SET_KEY(fd sock_alg, level const[SOL_ALG], opt const[ALG_SET_KEY], key buffer[in], keylen len[key])
    17  setsockopt$ALG_SET_AEAD_AUTHSIZE(fd sock_alg, level const[SOL_ALG], opt const[ALG_SET_AEAD_AUTHSIZE], val const[0], size intptr)
    18  accept$alg(fd sock_alg, peer const[0], peerlen const[0]) sock_algconn
    19  accept4$alg(fd sock_alg, peer const[0], peerlen const[0], flags flags[accept_flags]) sock_algconn
    20  sendmsg$alg(fd sock_algconn, msg ptr[in, msghdr_alg], f flags[send_flags])
    21  sendmmsg$alg(fd sock_algconn, mmsg ptr[in, array[msghdr_alg]], vlen len[mmsg], f flags[send_flags])
    22  read$alg(fd sock_algconn, buf buffer[out], size len[buf])
    23  
    24  # Special struct generated by Go code.
    25  sockaddr_alg {
    26  	family	const[AF_ALG, int16]
    27  	type	string["AUTOGENERATED", 14]
    28  	feat	flags[af_alg_type, int32]
    29  	mask	flags[af_alg_type, int32]
    30  	name	string["AUTOGENERATED", 64]
    31  }
    32  
    33  # Special struct generated by Go code.
    34  alg_name {
    35  	name	string["AUTOGENERATED", 64]
    36  }
    37  
    38  # Special struct generated by Go code.
    39  alg_aead_name {
    40  	name	string["AUTOGENERATED", 64]
    41  }
    42  
    43  # Special struct generated by Go code.
    44  alg_hash_name {
    45  	name	string["AUTOGENERATED", 64]
    46  }
    47  
    48  # Special struct generated by Go code.
    49  alg_skcipher_name {
    50  	name	string["AUTOGENERATED", 64]
    51  }
    52  
    53  alg_compress_name {
    54  	name	string[alg_compress_names, 64]
    55  }
    56  
    57  # This is what XFRM supports (see xfrm_calg_list).
    58  alg_compress_names = "deflate", "lzs", "lzjh"
    59  
    60  msghdr_alg {
    61  	addr	const[0, intptr]
    62  	addrlen	const[0, int32]
    63  	vec	ptr[in, array[iovec_in]]
    64  	vlen	len[vec, intptr]
    65  	ctrl	ptr[in, array[cmsghdr_alg], opt]
    66  	ctrllen	bytesize[ctrl, intptr]
    67  	f	flags[send_flags, int32]
    68  }
    69  
    70  cmsghdr_alg [
    71  	iv	cmsghdr_alg_iv
    72  	op	cmsghdr_alg_op
    73  	assoc	cmsghdr_alg_assoc
    74  ] [varlen]
    75  
    76  cmsghdr_alg_iv {
    77  	len	len[parent, intptr]
    78  	level	const[SOL_ALG, int32]
    79  	type	const[ALG_SET_IV, int32]
    80  	ivlen	len[iv, int32]
    81  	iv	array[int8]
    82  } [align[PTR_SIZE]]
    83  
    84  cmsghdr_alg_op {
    85  	len	len[parent, intptr]
    86  	level	const[SOL_ALG, int32]
    87  	type	const[ALG_SET_OP, int32]
    88  	op	flags[alg_op_op, int32]
    89  } [align[PTR_SIZE]]
    90  
    91  cmsghdr_alg_assoc {
    92  	len	len[parent, intptr]
    93  	level	const[SOL_ALG, int32]
    94  	type	const[ALG_SET_AEAD_ASSOCLEN, int32]
    95  	assoc	int32
    96  } [align[PTR_SIZE]]
    97  
    98  af_alg_type = CRYPTO_ALG_TYPE_MASK, CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_COMPRESS, CRYPTO_ALG_TYPE_AEAD, CRYPTO_ALG_TYPE_SKCIPHER, 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_TESTED, CRYPTO_ALG_INSTANCE, CRYPTO_ALG_KERN_DRIVER_ONLY, CRYPTO_ALG_INTERNAL
    99  
   100  alg_op_op = ALG_OP_DECRYPT, ALG_OP_ENCRYPT
   101  
   102  # Removed in next-20160210 (commit 11049218)
   103  define CRYPTO_ALG_TYPE_PCOMPRESS	0x0000000f