diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-11-22 11:42:10 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-11-24 13:56:20 +0100 |
| commit | ddf7b3e0655cf6dfeacfe509e477c1486d2cc7db (patch) | |
| tree | dd3ce89e4c92cdb4ddaaae566222ec8cbd177676 /sys | |
| parent | d19770f1b9c6f1cb953b4a6e767aa914009deb20 (diff) | |
sys/linux: improve AF_ALG alg name generation
There is effectively infinite number of possible crypto
algorithm names due to templates. Plus there is tricky
relation between algorithms and algorithm type names.
This change adds custom mutator for sockaddr_alg struct
to improve variance in generated algorithms.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/linux/386.go | 6 | ||||
| -rw-r--r-- | sys/linux/alg.go | 506 | ||||
| -rw-r--r-- | sys/linux/alg_test.go | 215 | ||||
| -rw-r--r-- | sys/linux/amd64.go | 10 | ||||
| -rw-r--r-- | sys/linux/arm.go | 10 | ||||
| -rw-r--r-- | sys/linux/arm64.go | 10 | ||||
| -rw-r--r-- | sys/linux/init.go | 8 | ||||
| -rw-r--r-- | sys/linux/ppc64le.go | 10 | ||||
| -rw-r--r-- | sys/linux/socket_alg.txt | 8 | ||||
| -rw-r--r-- | sys/linux/socket_alg_386.const | 2 | ||||
| -rw-r--r-- | sys/linux/socket_alg_amd64.const | 2 | ||||
| -rw-r--r-- | sys/linux/socket_alg_arm.const | 2 | ||||
| -rw-r--r-- | sys/linux/socket_alg_arm64.const | 2 | ||||
| -rw-r--r-- | sys/linux/socket_alg_ppc64le.const | 2 |
14 files changed, 770 insertions, 23 deletions
diff --git a/sys/linux/386.go b/sys/linux/386.go index 7097136d2..217cc5834 100644 --- a/sys/linux/386.go +++ b/sys/linux/386.go @@ -412,7 +412,7 @@ var structDescs_386 = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "parent"}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 4}}, Val: 279}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 4}}, Val: 3}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "op", TypeSize: 4}}}, + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "alg_op_op", FldName: "op", TypeSize: 4}}, Vals: []uint64{0, 1}}, }, AlignAttr: 4}}, {Key: StructKey{Name: "cmsghdr_sctp"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "cmsghdr_sctp", TypeSize: 44}, Fields: []Type{ &StructType{Key: StructKey{Name: "cmsghdr_sctp_init"}, FldName: "init"}, @@ -13824,6 +13824,8 @@ var consts_386 = []ConstValue{ {Name: "AH_ESP_V6_FLOW", Value: 8}, {Name: "AH_V4_FLOW", Value: 9}, {Name: "AH_V6_FLOW", Value: 11}, + {Name: "ALG_OP_DECRYPT"}, + {Name: "ALG_OP_ENCRYPT", Value: 1}, {Name: "ALG_SET_AEAD_ASSOCLEN", Value: 4}, {Name: "ALG_SET_AEAD_AUTHSIZE", Value: 5}, {Name: "ALG_SET_IV", Value: 2}, @@ -16796,4 +16798,4 @@ var consts_386 = []ConstValue{ {Name: "__WNOTHREAD", Value: 536870912}, } -const revision_386 = "bcbb2cfb0201255ca22ecc77ebc8e22d4880e9a5" +const revision_386 = "a3916a0db735129455fbd809eed379b8568f7c35" diff --git a/sys/linux/alg.go b/sys/linux/alg.go new file mode 100644 index 000000000..581b3b364 --- /dev/null +++ b/sys/linux/alg.go @@ -0,0 +1,506 @@ +// 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. + +package linux + +import ( + "math/rand" + + "github.com/google/syzkaller/prog" +) + +func (arch *arch) generateSockaddrAlg(g *prog.Gen, typ *prog.StructType, old *prog.GroupArg) ( + arg prog.Arg, calls []*prog.Call) { + family := g.GenerateArg(typ.Fields[0], &calls) + // There is very little point in generating feat/mask, + // because that can only fail otherwise correct bind. + feat := prog.MakeConstArg(typ.Fields[2], 0) + mask := prog.MakeConstArg(typ.Fields[3], 0) + if g.NOutOf(1, 1000) { + feat = g.GenerateArg(typ.Fields[2], &calls) + mask = g.GenerateArg(typ.Fields[3], &calls) + } + algType, algName := generateAlgName(g.Rand()) + // Extend/truncate type/name to their fixed sizes. + typeSize := typ.Fields[1].Size() + algTypeData := append([]byte(algType), make([]byte, typeSize)...)[:typeSize] + nameSize := typ.Fields[4].Size() + algNameData := append([]byte(algName), make([]byte, nameSize)...)[:nameSize] + arg = prog.MakeGroupArg(typ, []prog.Arg{ + family, + prog.MakeDataArg(typ.Fields[1], algTypeData), + feat, + mask, + prog.MakeDataArg(typ.Fields[4], algNameData), + }) + return +} + +func generateAlgName(rnd *rand.Rand) (string, string) { + typ := allTypes[rnd.Intn(len(allTypes))] + name := generateAlg(rnd, typ.typ) + return typ.name, name +} + +func generateAlg(rnd *rand.Rand, typ int) string { + algs := allAlgs[typ] + alg := algs[rnd.Intn(len(algs))] + return generateAlgImpl(rnd, alg) +} + +func generateAlgImpl(rnd *rand.Rand, alg algDesc) string { + args := "" + if len(alg.args) != 0 { + args += "(" + for i, a := range alg.args { + if i != 0 { + args += "," + } + args += generateAlg(rnd, a) + } + args += ")" + } + return alg.name + args +} + +type algType struct { + name string + typ int +} + +type algDesc struct { + name string + args []int +} + +const ( + ALG_CIPHER = iota + ALG_BLKCIPHER + ALG_AEAD + ALG_HASH + ALG_RNG +) + +var allTypes = []algType{ + {"aead", ALG_AEAD}, + {"skcipher", ALG_BLKCIPHER}, + {"hash", ALG_HASH}, + {"rng", ALG_RNG}, +} + +var allAlgs = map[int][]algDesc{ + ALG_AEAD: []algDesc{ + // templates: + {"authencesn", []int{ALG_HASH, ALG_BLKCIPHER}}, + {"authenc", []int{ALG_HASH, ALG_BLKCIPHER}}, + {"rfc7539esp", []int{ALG_BLKCIPHER, ALG_HASH}}, + {"rfc7539", []int{ALG_BLKCIPHER, ALG_HASH}}, + {"rfc4543", []int{ALG_AEAD}}, + {"rfc4106", []int{ALG_AEAD}}, + {"pcrypt", []int{ALG_AEAD}}, + {"rfc4309", []int{ALG_AEAD}}, + {"gcm", []int{ALG_CIPHER}}, + {"gcm_base", []int{ALG_BLKCIPHER, ALG_HASH}}, + {"ccm", []int{ALG_CIPHER}}, + {"ccm_base", []int{ALG_BLKCIPHER, ALG_HASH}}, + {"echainiv", []int{ALG_AEAD}}, + {"seqiv", []int{ALG_AEAD}}, + + // algorithms: + {"gcm(aes)", nil}, + {"gcm_base(ctr(aes-aesni),ghash-generic)", nil}, + {"generic-gcm-aesni", nil}, + {"rfc4106(gcm(aes))", nil}, + {"rfc4106-gcm-aesni", nil}, + {"__gcm-aes-aesni", nil}, + {"__driver-gcm-aes-aesni", nil}, + }, + ALG_BLKCIPHER: []algDesc{ + // templates: + {"pcbc", []int{ALG_CIPHER}}, + {"cbc", []int{ALG_CIPHER}}, + {"xts", []int{ALG_CIPHER}}, + {"ctr", []int{ALG_CIPHER}}, + {"lrw", []int{ALG_CIPHER}}, + {"ecb", []int{ALG_CIPHER}}, + {"kw", []int{ALG_CIPHER}}, + {"cts", []int{ALG_BLKCIPHER}}, + {"fpu", []int{ALG_BLKCIPHER}}, + {"xts", []int{ALG_BLKCIPHER}}, + {"lrw", []int{ALG_BLKCIPHER}}, + {"rfc3686", []int{ALG_BLKCIPHER}}, + {"cryptd", []int{ALG_BLKCIPHER}}, + + // algorithms: + {"cbc(aes)", nil}, + {"cbc(aes-aesni)", nil}, + {"chacha20", nil}, + {"chacha20-simd", nil}, + {"pcbc(aes)", nil}, + {"pcbc-aes-aesni", nil}, + {"fpu(pcbc(__aes))", nil}, + {"fpu(pcbc(__aes-aesni))", nil}, + {"pcbc(__aes)", nil}, + {"pcbc(__aes-aesni)", nil}, + {"xts(aes)", nil}, + {"xts-aes-aesni", nil}, + {"ctr(aes)", nil}, + {"ctr-aes-aesni", nil}, + {"cbc-aes-aesni", nil}, + {"ecb(aes)", nil}, + {"ecb-aes-aesni", nil}, + {"__xts(aes)", nil}, + {"__xts-aes-aesni", nil}, + {"__ctr(aes)", nil}, + {"__ctr-aes-aesni", nil}, + {"__cbc(aes)", nil}, + {"__cbc-aes-aesni", nil}, + {"__ecb(aes)", nil}, + {"__ecb-aes-aesni", nil}, + {"chacha20-generic", nil}, + {"xts(serpent)", nil}, + {"xts-serpent-avx2", nil}, + {"lrw(serpent)", nil}, + {"lrw-serpent-avx2", nil}, + {"ctr(serpent)", nil}, + {"ctr-serpent-avx2", nil}, + {"cbc(serpent)", nil}, + {"cbc-serpent-avx2", nil}, + {"ecb(serpent)", nil}, + {"ecb-serpent-avx2", nil}, + {"xts(camellia)", nil}, + {"xts-camellia-aesni-avx2", nil}, + {"lrw(camellia)", nil}, + {"lrw-camellia-aesni-avx2", nil}, + {"ctr(camellia)", nil}, + {"ctr-camellia-aesni-avx2", nil}, + {"cbc(camellia)", nil}, + {"cbc-camellia-aesni-avx2", nil}, + {"ecb(camellia)", nil}, + {"ecb-camellia-aesni-avx2", nil}, + {"xts-serpent-avx", nil}, + {"lrw-serpent-avx", nil}, + {"ctr-serpent-avx", nil}, + {"cbc-serpent-avx", nil}, + {"ecb-serpent-avx", nil}, + {"xts(twofish)", nil}, + {"xts-twofish-avx", nil}, + {"lrw(twofish)", nil}, + {"lrw-twofish-avx", nil}, + {"ctr(twofish)", nil}, + {"ctr-twofish-avx", nil}, + {"cbc(twofish)", nil}, + {"cbc-twofish-avx", nil}, + {"ecb(twofish)", nil}, + {"ecb-twofish-avx", nil}, + {"xts(cast6)", nil}, + {"xts-cast6-avx", nil}, + {"lrw(cast6)", nil}, + {"lrw-cast6-avx", nil}, + {"ctr(cast6)", nil}, + {"ctr-cast6-avx", nil}, + {"cbc(cast6)", nil}, + {"cbc-cast6-avx", nil}, + {"ecb(cast6)", nil}, + {"ecb-cast6-avx", nil}, + {"ctr(cast5)", nil}, + {"ctr-cast5-avx", nil}, + {"cbc(cast5)", nil}, + {"cbc-cast5-avx", nil}, + {"ecb(cast5)", nil}, + {"ecb-cast5-avx", nil}, + {"xts-camellia-aesni", nil}, + {"lrw-camellia-aesni", nil}, + {"ctr-camellia-aesni", nil}, + {"cbc-camellia-aesni", nil}, + {"ecb-camellia-aesni", nil}, + {"xts-serpent-sse2", nil}, + {"lrw-serpent-sse2", nil}, + {"ctr-serpent-sse2", nil}, + {"cbc-serpent-sse2", nil}, + {"ecb-serpent-sse2", nil}, + {"ctr(aes-aesni)", nil}, + {"salsa20", nil}, + {"salsa20-generic", nil}, + {"ecb(arc4)", nil}, + {"ecb(arc4)-generic", nil}, + {"ecb(cipher_null)", nil}, + {"ecb-cipher_null", nil}, + {"__xts-serpent-avx2", nil}, + {"__driver-xts-serpent-avx2", nil}, + {"__lrw-serpent-avx2", nil}, + {"__driver-lrw-serpent-avx2", nil}, + {"__ctr-serpent-avx2", nil}, + {"__driver-ctr-serpent-avx2", nil}, + {"__cbc-serpent-avx2", nil}, + {"__driver-cbc-serpent-avx2", nil}, + {"__ecb-serpent-avx2", nil}, + {"__driver-ecb-serpent-avx2", nil}, + {"__xts-camellia-aesni-avx2", nil}, + {"__driver-xts-camellia-aesni-avx2", nil}, + {"__lrw-camellia-aesni-avx2", nil}, + {"__driver-lrw-camellia-aesni-avx2", nil}, + {"__ctr-camellia-aesni-avx2", nil}, + {"__driver-ctr-camellia-aesni-avx2", nil}, + {"__cbc-camellia-aesni-avx2", nil}, + {"__driver-cbc-camellia-aesni-avx2", nil}, + {"__ecb-camellia-aesni-avx2", nil}, + {"__driver-ecb-camellia-aesni-avx2", nil}, + {"__xts-serpent-avx", nil}, + {"__driver-xts-serpent-avx", nil}, + {"__lrw-serpent-avx", nil}, + {"__driver-lrw-serpent-avx", nil}, + {"__ctr-serpent-avx", nil}, + {"__driver-ctr-serpent-avx", nil}, + {"__cbc-serpent-avx", nil}, + {"__driver-cbc-serpent-avx", nil}, + {"__ecb-serpent-avx", nil}, + {"__driver-ecb-serpent-avx", nil}, + {"__xts-twofish-avx", nil}, + {"__driver-xts-twofish-avx", nil}, + {"__lrw-twofish-avx", nil}, + {"__driver-lrw-twofish-avx", nil}, + {"__ctr-twofish-avx", nil}, + {"__driver-ctr-twofish-avx", nil}, + {"__cbc-twofish-avx", nil}, + {"__driver-cbc-twofish-avx", nil}, + {"__ecb-twofish-avx", nil}, + {"__driver-ecb-twofish-avx", nil}, + {"__xts-cast6-avx", nil}, + {"__driver-xts-cast6-avx", nil}, + {"__lrw-cast6-avx", nil}, + {"__driver-lrw-cast6-avx", nil}, + {"__ctr-cast6-avx", nil}, + {"__driver-ctr-cast6-avx", nil}, + {"__cbc-cast6-avx", nil}, + {"__driver-cbc-cast6-avx", nil}, + {"__ecb-cast6-avx", nil}, + {"__driver-ecb-cast6-avx", nil}, + {"__ctr-cast5-avx", nil}, + {"__driver-ctr-cast5-avx", nil}, + {"__cbc-cast5-avx", nil}, + {"__driver-cbc-cast5-avx", nil}, + {"__ecb-cast5-avx", nil}, + {"__driver-ecb-cast5-avx", nil}, + {"__xts-camellia-aesni", nil}, + {"__driver-xts-camellia-aesni", nil}, + {"__lrw-camellia-aesni", nil}, + {"__driver-lrw-camellia-aesni", nil}, + {"__ctr-camellia-aesni", nil}, + {"__driver-ctr-camellia-aesni", nil}, + {"__cbc-camellia-aesni", nil}, + {"__driver-cbc-camellia-aesni", nil}, + {"__ecb-camellia-aesni", nil}, + {"__driver-ecb-camellia-aesni", nil}, + {"__xts-serpent-sse2", nil}, + {"__driver-xts-serpent-sse2", nil}, + {"__lrw-serpent-sse2", nil}, + {"__driver-lrw-serpent-sse2", nil}, + {"__ctr-serpent-sse2", nil}, + {"__driver-ctr-serpent-sse2", nil}, + {"__cbc-serpent-sse2", nil}, + {"__driver-cbc-serpent-sse2", nil}, + {"__ecb-serpent-sse2", nil}, + {"__driver-ecb-serpent-sse2", nil}, + {"salsa20-asm", nil}, + {"xts-twofish-3way", nil}, + {"lrw-twofish-3way", nil}, + {"ctr-twofish-3way", nil}, + {"cbc-twofish-3way", nil}, + {"ecb-twofish-3way", nil}, + {"ctr(blowfish)", nil}, + {"ctr-blowfish-asm", nil}, + {"cbc(blowfish)", nil}, + {"cbc-blowfish-asm", nil}, + {"ecb(blowfish)", nil}, + {"ecb-blowfish-asm", nil}, + {"xts-camellia-asm", nil}, + {"lrw-camellia-asm", nil}, + {"ctr-camellia-asm", nil}, + {"cbc-camellia-asm", nil}, + {"ecb-camellia-asm", nil}, + {"ctr(des3_ede)", nil}, + {"ctr-des3_ede-asm", nil}, + {"cbc(des3_ede)", nil}, + {"cbc-des3_ede-asm", nil}, + {"ecb(des3_ede)", nil}, + {"ecb-des3_ede-asm", nil}, + }, + ALG_CIPHER: []algDesc{ + {"aes", nil}, + {"__aes", nil}, + {"__aes-aesni", nil}, + {"aes-aesni", nil}, + {"seed", nil}, + {"seed-generic", nil}, + {"anubis", nil}, + {"anubis-generic", nil}, + {"khazad", nil}, + {"khazad-generic", nil}, + {"xeta", nil}, + {"xeta-generic", nil}, + {"xtea", nil}, + {"xtea-generic", nil}, + {"tea", nil}, + {"tea-generic", nil}, + {"arc4", nil}, + {"arc4-generic", nil}, + {"cast6", nil}, + {"cast6-generic", nil}, + {"cast5", nil}, + {"cast5-generic", nil}, + {"camellia", nil}, + {"camellia-generic", nil}, + {"camellia-asm", nil}, + {"tnepres", nil}, + {"aes-fixed-time", nil}, + {"aes-generic", nil}, + {"tnepres-generic", nil}, + {"serpent", nil}, + {"serpent-generic", nil}, + {"twofish", nil}, + {"twofish-generic", nil}, + {"twofish-asm", nil}, + {"blowfish", nil}, + {"blowfish-generic", nil}, + {"blowfish-asm", nil}, + {"fcrypt", nil}, + {"fcrypt-generic", nil}, + {"des3_ede", nil}, + {"des3_ede-generic", nil}, + {"des3_ede-asm", nil}, + {"des", nil}, + {"des-generic", nil}, + {"cipher_null", nil}, + {"cipher_null-generic", nil}, + {"aes-asm", nil}, + }, + ALG_HASH: []algDesc{ + // templates: + {"cmac", []int{ALG_CIPHER}}, + {"cbcmac", []int{ALG_CIPHER}}, + {"xcbc", []int{ALG_CIPHER}}, + {"vmac", []int{ALG_CIPHER}}, + {"hmac", []int{ALG_HASH}}, + {"mcryptd", []int{ALG_HASH}}, + {"cryptd", []int{ALG_HASH}}, + + // algorithms: + {"sha512", nil}, + {"sha512_mb", nil}, + {"__sha512-mb", nil}, + {"__intel_sha512-mb", nil}, + {"sha256", nil}, + {"sha256_mb", nil}, + {"__sha256-mb", nil}, + {"__intel_sha256-mb", nil}, + {"sha1", nil}, + {"sha1_mb", nil}, + {"__sha1-mb", nil}, + {"__intel_sha1-mb", nil}, + {"ghash", nil}, + {"ghash-clmulni", nil}, + {"md4", nil}, + {"md4-generic", nil}, + {"md5", nil}, + {"md5-generic", nil}, + {"ghash-generic", nil}, + {"crct10dif", nil}, + {"crct10dif-generic", nil}, + {"crct10dif-pclmul", nil}, + {"crc32", nil}, + {"crc32-generic", nil}, + {"crc32c", nil}, + {"crc32c-generic", nil}, + {"michael_mic", nil}, + {"michael_mic-generic", nil}, + {"poly1305", nil}, + {"poly1305-generic", nil}, + {"tgr128", nil}, + {"tgr128-generic", nil}, + {"tgr160", nil}, + {"tgr160-generic", nil}, + {"tgr192", nil}, + {"tgr192-generic", nil}, + {"wp256", nil}, + {"wp256-generic", nil}, + {"wp384", nil}, + {"wp384-generic", nil}, + {"wp512", nil}, + {"wp512-generic", nil}, + {"sm3", nil}, + {"sm3-generic", nil}, + {"sha3-512", nil}, + {"sha3-512-generic", nil}, + {"sha3-384", nil}, + {"sha3-384-generic", nil}, + {"sha3-256", nil}, + {"sha3-256-generic", nil}, + {"sha3-224", nil}, + {"sha3-224-generic", nil}, + {"sha384", nil}, + {"sha384-generic", nil}, + {"sha512-generic", nil}, + {"sha224", nil}, + {"sha224-generic", nil}, + {"sha256-generic", nil}, + {"sha1-generic", nil}, + {"rmd320", nil}, + {"rmd320-generic", nil}, + {"rmd256", nil}, + {"rmd256-generic", nil}, + {"rmd160", nil}, + {"rmd160-generic", nil}, + {"rmd128", nil}, + {"rmd128-generic", nil}, + {"digest_null", nil}, + {"digest_null-generic", nil}, + {"poly1305-simd", nil}, + {"sha384-avx2", nil}, + {"sha512-avx2", nil}, + {"sha384-avx", nil}, + {"sha512-avx", nil}, + {"sha384-ssse3", nil}, + {"sha512-ssse3", nil}, + {"sha224-avx2", nil}, + {"sha256-avx2", nil}, + {"sha224-avx", nil}, + {"sha256-avx", nil}, + {"sha224-ssse3", nil}, + {"sha256-ssse3", nil}, + {"crc32-pclmul", nil}, + {"sha1-avx2", nil}, + {"sha1-avx", nil}, + {"sha1-ssse3", nil}, + {"crc32c-intel", nil}, + {"__ghash", nil}, + {"__ghash-pclmulqdqni", nil}, + }, + ALG_RNG: []algDesc{ + {"stdrng", nil}, + {"ansi_cprng", nil}, + {"jitterentropy_rng", nil}, + {"drbg_nopr_hmac_sha256", nil}, + {"drbg_nopr_hmac_sha512", nil}, + {"drbg_nopr_hmac_sha384", nil}, + {"drbg_nopr_hmac_sha1", nil}, + {"drbg_nopr_sha256", nil}, + {"drbg_nopr_sha512", nil}, + {"drbg_nopr_sha384", nil}, + {"drbg_nopr_sha1", nil}, + {"drbg_nopr_ctr_aes256", nil}, + {"drbg_nopr_ctr_aes192", nil}, + {"drbg_nopr_ctr_aes128", nil}, + {"drbg_pr_hmac_sha256", nil}, + {"drbg_pr_hmac_sha512", nil}, + {"drbg_pr_hmac_sha384", nil}, + {"drbg_pr_hmac_sha1", nil}, + {"drbg_pr_sha256", nil}, + {"drbg_pr_sha512", nil}, + {"drbg_pr_sha384", nil}, + {"drbg_pr_sha1", nil}, + {"drbg_pr_ctr_aes256", nil}, + {"drbg_pr_ctr_aes192", nil}, + {"drbg_pr_ctr_aes128", nil}, + }, +} diff --git a/sys/linux/alg_test.go b/sys/linux/alg_test.go new file mode 100644 index 000000000..b3622a6c9 --- /dev/null +++ b/sys/linux/alg_test.go @@ -0,0 +1,215 @@ +// 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. + +// +build linux + +package linux + +import ( + "flag" + "fmt" + "math/rand" + "strings" + "syscall" + "testing" + "unsafe" +) + +// AF_ALG tests won't generally pass and intended for manual testing. +// First, they require fresh kernel with _all_ crypto algorithms enabled. +// Second, they require the newest hardware with all of SSE/AVX. +// Finally, they still won't pass because some algorithms are arch-dependent. +var flagRunAlgTests = flag.Bool("algtests", false, "run AF_ALG tests") + +func algTest(t *testing.T) { + if !*flagRunAlgTests { + t.Skip() + } + t.Parallel() +} + +// TestAlgDescriptions checks that there are no duplicate names and that +// templates mentioned in complete algorithms are also present as standalone templates. +func TestAlgDescriptions(t *testing.T) { + algTest(t) + allall := make(map[string]bool) + for typ, algList := range allAlgs { + algs := make(map[string]bool) + templates := make(map[string]bool) + for _, alg := range algList { + allall[alg.name] = true + if algs[alg.name] { + t.Errorf("duplicate: %v", alg.name) + } + algs[alg.name] = true + if len(alg.args) > 0 { + templates[alg.name] = true + } + } + for _, alg := range algList { + if len(alg.args) > 0 || strings.HasPrefix(alg.name, "__") { + continue + } + brace := strings.IndexByte(alg.name, '(') + if brace == -1 { + continue + } + templ := alg.name[:brace] + if !templates[templ] { + t.Errorf("template %v is missing for type %v", templ, typ) + } + templates[templ] = true + } + } +} + +// TestSingleAlg tests creation of all algorithms (not templates). +func TestSingleAlg(t *testing.T) { + algTest(t) + for _, typ := range allTypes { + for _, alg := range allAlgs[typ.typ] { + if len(alg.args) != 0 { + continue + } + ok, skip := testAlg(t, typ.name, alg.name) + if skip { + t.Errorf("SKIP\t%10v\t%v", typ.name, alg.name) + continue + } + if !ok { + t.Errorf("FAIL\t%10v\t%v", typ.name, alg.name) + continue + } + } + } +} + +// TestTemplateAlg1 tests creation of all templates with 1 argument. +func TestTemplateAlg1(t *testing.T) { + algTest(t) + for _, typ := range allTypes { + for _, alg := range allAlgs[typ.typ] { + if len(alg.args) != 1 { + continue + } + var works []int + nextType: + for typ1, algs1 := range allAlgs { + var selection []algDesc + for _, x := range rand.Perm(len(algs1)) { + if len(algs1[x].args) != 0 { + continue + } + selection = append(selection, algs1[x]) + if len(selection) == 10 { + break + } + } + for _, alg1 := range selection { + name := fmt.Sprintf("%v(%v)", alg.name, alg1.name) + ok, _ := testAlg(t, typ.name, name) + if ok { + works = append(works, typ1) + continue nextType + } + } + } + if len(works) == 1 && works[0] == alg.args[0] { + continue + } + t.Errorf("FAIL\t%10v\t%v\tclaimed %v works with %v", + typ.name, alg.name, alg.args[0], works) + } + } +} + +// TestTemplateAlg2 tests creation of all templates with 2 argument. +func TestTemplateAlg2(t *testing.T) { + algTest(t) + // Can't affort to test all permutations of 2 algorithms, + // 20 algorithm pairs for each type pair and use them. + selections := make(map[int][]int) + for typ1, algs1 := range allAlgs { + for typ2, algs2 := range allAlgs { + var pairs []int + for i1, alg1 := range algs1 { + if len(alg1.args) != 0 { + continue + } + for i2, alg2 := range algs2 { + if len(alg2.args) != 0 { + continue + } + pairs = append(pairs, i1*1000+i2) + } + } + var selection []int + for _, x := range rand.Perm(len(pairs)) { + selection = append(selection, pairs[x]) + if len(selection) > 20 { + break + } + } + selections[typ1*1000+typ2] = selection + } + } + for _, typ := range allTypes { + for _, alg := range allAlgs[typ.typ] { + if len(alg.args) != 2 { + continue + } + for typ1, algs1 := range allAlgs { + for typ2, algs2 := range allAlgs { + selection := selections[typ1*1000+typ2] + for _, x := range selection { + alg1 := algs1[x/1000] + alg2 := algs2[x%1000] + name := fmt.Sprintf("%v(%v,%v)", + alg.name, alg1.name, alg2.name) + if ok, _ := testAlg(t, typ.name, name); ok { + t.Logf("%10v\t%v\tclaimed %v works with %v/%v (%v)", + typ.name, alg.name, alg.args, typ1, typ2, name) + break + } + } + } + } + } + } +} + +type sockaddrAlg struct { + family uint16 + typ [14]byte + feat uint32 + mask uint32 + name [64]byte +} + +func testAlg(t *testing.T, typ, name string) (ok, skip bool) { + const AF_ALG = 0x26 + addr := &sockaddrAlg{ + family: AF_ALG, + } + if len(typ) >= int(unsafe.Sizeof(addr.typ)) || + len(name) >= int(unsafe.Sizeof(addr.name)) { + return false, true + } + for i := 0; i < len(typ); i++ { + addr.typ[i] = typ[i] + } + for i := 0; i < len(name); i++ { + addr.name[i] = name[i] + } + sock, err := syscall.Socket(AF_ALG, syscall.SOCK_SEQPACKET, 0) + if err != nil { + t.Fatalf("failed to create AF_ALG socket: %v", err) + } + defer syscall.Close(sock) + _, _, errno := syscall.Syscall(syscall.SYS_BIND, uintptr(sock), + uintptr(unsafe.Pointer(addr)), unsafe.Sizeof(*addr)) + if errno != 0 { + return false, false + } + return true, false +} diff --git a/sys/linux/amd64.go b/sys/linux/amd64.go index e53cea7ed..d1e061c83 100644 --- a/sys/linux/amd64.go +++ b/sys/linux/amd64.go @@ -420,7 +420,7 @@ var structDescs_amd64 = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "parent"}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 4}}, Val: 279}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 4}}, Val: 3}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "op", TypeSize: 4}}}, + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "alg_op_op", FldName: "op", TypeSize: 4}}, Vals: []uint64{0, 1}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, }, AlignAttr: 8}}, {Key: StructKey{Name: "cmsghdr_sctp"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "cmsghdr_sctp", TypeSize: 48}, Fields: []Type{ @@ -5974,8 +5974,8 @@ var syscalls_amd64 = []*Syscall{ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "sock", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {ID: 1, NR: 43, Name: "accept$alg", CallName: "accept", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_alg", FldName: "fd", TypeSize: 4}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peer", TypeSize: 8, IsOptional: true}, Type: &StructType{Key: StructKey{Name: "sockaddr_alg", Dir: 1}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peerlen", TypeSize: 8}, Type: &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", TypeSize: 4, ArgDir: 2}}, Buf: "peer"}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "peer", TypeSize: 8}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "peerlen", TypeSize: 8}}}, }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_algconn", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {ID: 2, NR: 43, Name: "accept$ax25", CallName: "accept", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_ax25", FldName: "fd", TypeSize: 4}}, @@ -14322,6 +14322,8 @@ var consts_amd64 = []ConstValue{ {Name: "AH_ESP_V6_FLOW", Value: 8}, {Name: "AH_V4_FLOW", Value: 9}, {Name: "AH_V6_FLOW", Value: 11}, + {Name: "ALG_OP_DECRYPT"}, + {Name: "ALG_OP_ENCRYPT", Value: 1}, {Name: "ALG_SET_AEAD_ASSOCLEN", Value: 4}, {Name: "ALG_SET_AEAD_AUTHSIZE", Value: 5}, {Name: "ALG_SET_IV", Value: 2}, @@ -17327,4 +17329,4 @@ var consts_amd64 = []ConstValue{ {Name: "__WNOTHREAD", Value: 536870912}, } -const revision_amd64 = "7a950be35f2798eefd0ac374561c8e547930bab1" +const revision_amd64 = "6db640031dfbd383d097fd924b9852fbd9e33616" diff --git a/sys/linux/arm.go b/sys/linux/arm.go index 13b4f40db..4ddf4e33c 100644 --- a/sys/linux/arm.go +++ b/sys/linux/arm.go @@ -417,7 +417,7 @@ var structDescs_arm = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "parent"}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 4}}, Val: 279}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 4}}, Val: 3}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "op", TypeSize: 4}}}, + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "alg_op_op", FldName: "op", TypeSize: 4}}, Vals: []uint64{0, 1}}, }, AlignAttr: 4}}, {Key: StructKey{Name: "cmsghdr_sctp"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "cmsghdr_sctp", TypeSize: 44}, Fields: []Type{ &StructType{Key: StructKey{Name: "cmsghdr_sctp_init"}, FldName: "init"}, @@ -5640,8 +5640,8 @@ var syscalls_arm = []*Syscall{ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "sock", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {ID: 1, NR: 285, Name: "accept$alg", CallName: "accept", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_alg", FldName: "fd", TypeSize: 4}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peer", TypeSize: 4, IsOptional: true}, Type: &StructType{Key: StructKey{Name: "sockaddr_alg", Dir: 1}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peerlen", TypeSize: 4}, Type: &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", TypeSize: 4, ArgDir: 2}}, Buf: "peer"}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "peer", TypeSize: 4}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "peerlen", TypeSize: 4}}}, }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_algconn", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {ID: 2, NR: 285, Name: "accept$ax25", CallName: "accept", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_ax25", FldName: "fd", TypeSize: 4}}, @@ -13741,6 +13741,8 @@ var consts_arm = []ConstValue{ {Name: "AH_ESP_V6_FLOW", Value: 8}, {Name: "AH_V4_FLOW", Value: 9}, {Name: "AH_V6_FLOW", Value: 11}, + {Name: "ALG_OP_DECRYPT"}, + {Name: "ALG_OP_ENCRYPT", Value: 1}, {Name: "ALG_SET_AEAD_ASSOCLEN", Value: 4}, {Name: "ALG_SET_AEAD_AUTHSIZE", Value: 5}, {Name: "ALG_SET_IV", Value: 2}, @@ -16664,4 +16666,4 @@ var consts_arm = []ConstValue{ {Name: "__WNOTHREAD", Value: 536870912}, } -const revision_arm = "535d8ff089248a1f2cb7f41725f543f14767dd1e" +const revision_arm = "266440e04c2aa2386a0083e579bfd6a68ad75c2f" diff --git a/sys/linux/arm64.go b/sys/linux/arm64.go index 65faa5b0a..5f8c59d28 100644 --- a/sys/linux/arm64.go +++ b/sys/linux/arm64.go @@ -420,7 +420,7 @@ var structDescs_arm64 = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "parent"}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 4}}, Val: 279}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 4}}, Val: 3}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "op", TypeSize: 4}}}, + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "alg_op_op", FldName: "op", TypeSize: 4}}, Vals: []uint64{0, 1}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, }, AlignAttr: 8}}, {Key: StructKey{Name: "cmsghdr_sctp"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "cmsghdr_sctp", TypeSize: 48}, Fields: []Type{ @@ -5750,8 +5750,8 @@ var syscalls_arm64 = []*Syscall{ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "sock", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {ID: 1, NR: 202, Name: "accept$alg", CallName: "accept", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_alg", FldName: "fd", TypeSize: 4}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peer", TypeSize: 8, IsOptional: true}, Type: &StructType{Key: StructKey{Name: "sockaddr_alg", Dir: 1}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peerlen", TypeSize: 8}, Type: &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", TypeSize: 4, ArgDir: 2}}, Buf: "peer"}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "peer", TypeSize: 8}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "peerlen", TypeSize: 8}}}, }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_algconn", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {ID: 2, NR: 202, Name: "accept$ax25", CallName: "accept", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_ax25", FldName: "fd", TypeSize: 4}}, @@ -13788,6 +13788,8 @@ var consts_arm64 = []ConstValue{ {Name: "AH_ESP_V6_FLOW", Value: 8}, {Name: "AH_V4_FLOW", Value: 9}, {Name: "AH_V6_FLOW", Value: 11}, + {Name: "ALG_OP_DECRYPT"}, + {Name: "ALG_OP_ENCRYPT", Value: 1}, {Name: "ALG_SET_AEAD_ASSOCLEN", Value: 4}, {Name: "ALG_SET_AEAD_AUTHSIZE", Value: 5}, {Name: "ALG_SET_IV", Value: 2}, @@ -16709,4 +16711,4 @@ var consts_arm64 = []ConstValue{ {Name: "__WNOTHREAD", Value: 536870912}, } -const revision_arm64 = "043368a9e3f6b8146d46fa8d192bc033b66c707b" +const revision_arm64 = "491bd0b7116800f63d75074b802c7c58820b119f" diff --git a/sys/linux/init.go b/sys/linux/init.go index c727cb5b2..539801c65 100644 --- a/sys/linux/init.go +++ b/sys/linux/init.go @@ -40,9 +40,11 @@ func initTarget(target *prog.Target) { target.MakeMmap = arch.makeMmap target.AnalyzeMmap = arch.analyzeMmap target.SanitizeCall = arch.sanitizeCall - target.SpecialStructs = map[string]func(g *prog.Gen, typ *prog.StructType, old *prog.GroupArg) (prog.Arg, []*prog.Call){ - "timespec": arch.generateTimespec, - "timeval": arch.generateTimespec, + target.SpecialStructs = map[string]func(g *prog.Gen, typ *prog.StructType, old *prog.GroupArg) ( + prog.Arg, []*prog.Call){ + "timespec": arch.generateTimespec, + "timeval": arch.generateTimespec, + "sockaddr_alg": arch.generateSockaddrAlg, } target.StringDictionary = stringDictionary diff --git a/sys/linux/ppc64le.go b/sys/linux/ppc64le.go index b07c7051e..a232b5440 100644 --- a/sys/linux/ppc64le.go +++ b/sys/linux/ppc64le.go @@ -411,7 +411,7 @@ var structDescs_ppc64le = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "parent"}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 4}}, Val: 279}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 4}}, Val: 3}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "op", TypeSize: 4}}}, + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "alg_op_op", FldName: "op", TypeSize: 4}}, Vals: []uint64{0, 1}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, }, AlignAttr: 8}}, {Key: StructKey{Name: "cmsghdr_sctp"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "cmsghdr_sctp", TypeSize: 48}, Fields: []Type{ @@ -5595,8 +5595,8 @@ var syscalls_ppc64le = []*Syscall{ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "sock", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {ID: 1, NR: 330, Name: "accept$alg", CallName: "accept", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_alg", FldName: "fd", TypeSize: 4}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peer", TypeSize: 8, IsOptional: true}, Type: &StructType{Key: StructKey{Name: "sockaddr_alg", Dir: 1}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peerlen", TypeSize: 8}, Type: &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", TypeSize: 4, ArgDir: 2}}, Buf: "peer"}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "peer", TypeSize: 8}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "peerlen", TypeSize: 8}}}, }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_algconn", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {ID: 2, NR: 330, Name: "accept$ax25", CallName: "accept", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "sock_ax25", FldName: "fd", TypeSize: 4}}, @@ -13484,6 +13484,8 @@ var consts_ppc64le = []ConstValue{ {Name: "AH_ESP_V6_FLOW", Value: 8}, {Name: "AH_V4_FLOW", Value: 9}, {Name: "AH_V6_FLOW", Value: 11}, + {Name: "ALG_OP_DECRYPT"}, + {Name: "ALG_OP_ENCRYPT", Value: 1}, {Name: "ALG_SET_AEAD_ASSOCLEN", Value: 4}, {Name: "ALG_SET_AEAD_AUTHSIZE", Value: 5}, {Name: "ALG_SET_IV", Value: 2}, @@ -16394,4 +16396,4 @@ var consts_ppc64le = []ConstValue{ {Name: "__WNOTHREAD", Value: 536870912}, } -const revision_ppc64le = "c893d2cc4874589a0e71bd3f9dad5facd0f5f502" +const revision_ppc64le = "5491142031cb62ebd424be9ddfdc17427d1d64f4" diff --git a/sys/linux/socket_alg.txt b/sys/linux/socket_alg.txt index 5e3c0caea..b07a2b5ca 100644 --- a/sys/linux/socket_alg.txt +++ b/sys/linux/socket_alg.txt @@ -15,10 +15,11 @@ socket$alg(domain const[AF_ALG], type const[SOCK_SEQPACKET], proto const[0]) soc 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 ptr[out, sockaddr_alg, opt], peerlen ptr[inout, len[peer, int32]]) sock_algconn +accept$alg(fd sock_alg, peer const[0], peerlen const[0]) 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[salg_type, 14] @@ -55,7 +56,7 @@ cmsghdr_alg_op { len len[parent, intptr] level const[SOL_ALG, int32] type const[ALG_SET_OP, int32] - op int32 + op flags[alg_op_op, int32] } [align_ptr] cmsghdr_alg_assoc { @@ -67,7 +68,10 @@ cmsghdr_alg_assoc { 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 + salg_type = "aead", "hash", "rng", "skcipher" + salg_name = "cmac(aes)", "ecb(aes)", "cbc(aes)", "hmac(sha1)", "pcbc(fcrypt)", "ghash", "jitterentropy_rng", "stdrng", "stdrng", "stdrng", "stdrng", "hmac(sha256)", "stdrng", "stdrng", "stdrng", "stdrng", "stdrng", "842", "lz4hc", "lz4", "lzo", "crct10dif", "crc32", "crc32c", "michael_mic", "zlib", "deflate", "poly1305", "chacha20", "salsa20", "seed", "anubis", "khazad", "xeta", "xtea", "tea", "ecb(arc4)", "arc4", "cast6", "cast5", "camellia", "aes", "tnepres", "serpent", "twofish", "blowfish", "fcrypt", "des3_ede", "des", "tgr128", "tgr160", "tgr192", "wp256", "wp384", "wp512", "sha384", "sha512", "sha224", "sha256", "sha1", "rmd320", "rmd256", "rmd160", "rmd128", "md5", "md4", "digest_null", "compress_null", "ecb(cipher_null)", "cipher_null", "rsa", "poly1305", "xts(serpent)", "lrw(serpent)", "ctr(serpent)", "cbc(serpent)", "__ecb-serpent-sse2", "ecb(serpent)", "__xts-serpent-sse2", "__lrw-serpent-sse2", "__ctr-serpent-sse2", "__cbc-serpent-sse2", "__ecb-serpent-sse2", "salsa20", "xts(twofish)", "lrw(twofish)", "ctr(twofish)", "cbc(twofish)", "ecb(twofish)", "twofish", "ctr(blowfish)", "cbc(blowfish)", "ecb(blowfish)", "blowfish", "xts(camellia)", "lrw(camellia)", "ctr(camellia)", "cbc(camellia)", "ecb(camellia)", "camellia", "ctr(des3_ede)", "cbc(des3_ede)", "ecb(des3_ede)", "des3_ede", "aes" # Removed in next-20160210 (commit 11049218) diff --git a/sys/linux/socket_alg_386.const b/sys/linux/socket_alg_386.const index 2a2508ade..7affe8a9f 100644 --- a/sys/linux/socket_alg_386.const +++ b/sys/linux/socket_alg_386.const @@ -1,5 +1,7 @@ # AUTOGENERATED FILE AF_ALG = 38 +ALG_OP_DECRYPT = 0 +ALG_OP_ENCRYPT = 1 ALG_SET_AEAD_ASSOCLEN = 4 ALG_SET_AEAD_AUTHSIZE = 5 ALG_SET_IV = 2 diff --git a/sys/linux/socket_alg_amd64.const b/sys/linux/socket_alg_amd64.const index 8bdb46c24..c4e2b5237 100644 --- a/sys/linux/socket_alg_amd64.const +++ b/sys/linux/socket_alg_amd64.const @@ -1,5 +1,7 @@ # AUTOGENERATED FILE AF_ALG = 38 +ALG_OP_DECRYPT = 0 +ALG_OP_ENCRYPT = 1 ALG_SET_AEAD_ASSOCLEN = 4 ALG_SET_AEAD_AUTHSIZE = 5 ALG_SET_IV = 2 diff --git a/sys/linux/socket_alg_arm.const b/sys/linux/socket_alg_arm.const index 89258159c..85de90a49 100644 --- a/sys/linux/socket_alg_arm.const +++ b/sys/linux/socket_alg_arm.const @@ -1,5 +1,7 @@ # AUTOGENERATED FILE AF_ALG = 38 +ALG_OP_DECRYPT = 0 +ALG_OP_ENCRYPT = 1 ALG_SET_AEAD_ASSOCLEN = 4 ALG_SET_AEAD_AUTHSIZE = 5 ALG_SET_IV = 2 diff --git a/sys/linux/socket_alg_arm64.const b/sys/linux/socket_alg_arm64.const index 0da690d0a..bdd7a7cc4 100644 --- a/sys/linux/socket_alg_arm64.const +++ b/sys/linux/socket_alg_arm64.const @@ -1,5 +1,7 @@ # AUTOGENERATED FILE AF_ALG = 38 +ALG_OP_DECRYPT = 0 +ALG_OP_ENCRYPT = 1 ALG_SET_AEAD_ASSOCLEN = 4 ALG_SET_AEAD_AUTHSIZE = 5 ALG_SET_IV = 2 diff --git a/sys/linux/socket_alg_ppc64le.const b/sys/linux/socket_alg_ppc64le.const index 43eca7c92..e98479e3b 100644 --- a/sys/linux/socket_alg_ppc64le.const +++ b/sys/linux/socket_alg_ppc64le.const @@ -1,5 +1,7 @@ # AUTOGENERATED FILE AF_ALG = 38 +ALG_OP_DECRYPT = 0 +ALG_OP_ENCRYPT = 1 ALG_SET_AEAD_ASSOCLEN = 4 ALG_SET_AEAD_AUTHSIZE = 5 ALG_SET_IV = 2 |
