sys/linux: improve hash generation for KEYCTL_DH_COMPUTE

KEYCTL_DH_COMPUTE used the old fixed list of algorithm names.
Use the new code for algorithm generation.
+ it needs only SHASH algs, but we passed in all alg names.
Pass only SHASH algs.
This commit is contained in:
Dmitry Vyukov 2017-11-27 09:09:01 +01:00
parent d695195a6b
commit 473d90487b
10 changed files with 71 additions and 45 deletions

View File

@ -2,7 +2,7 @@
#if defined(__i386__) || 0
#define GOARCH "386"
#define SYZ_REVISION "81c235db632e82e91a6b43e185869e9296eb910f"
#define SYZ_REVISION "f9bbdaa02263a26fd7f9b2762eb8b25491b76e0b"
#define __NR_syz_emit_ethernet 1000000
#define __NR_syz_extract_tcp_res 1000001
#define __NR_syz_fuse_mount 1000002
@ -1498,7 +1498,7 @@ call_t syscalls[] = {
#if defined(__x86_64__) || 0
#define GOARCH "amd64"
#define SYZ_REVISION "ceb06a147201cb3d05ed604fca26fefde0ce9eb0"
#define SYZ_REVISION "36a58e82c36ea6b3664a8b46fff6e1d124425c58"
#define __NR_syz_emit_ethernet 1000000
#define __NR_syz_extract_tcp_res 1000001
#define __NR_syz_fuse_mount 1000002
@ -3055,7 +3055,7 @@ call_t syscalls[] = {
#if defined(__arm__) || 0
#define GOARCH "arm"
#define SYZ_REVISION "f6630e60a1e7d492159dd37f44764ec56da90a62"
#define SYZ_REVISION "138a55d450da8e1694944e8888d4073f2db0a9f5"
#define __NR_syz_emit_ethernet 1000000
#define __NR_syz_extract_tcp_res 1000001
#define __NR_syz_fuse_mount 1000002
@ -4561,7 +4561,7 @@ call_t syscalls[] = {
#if defined(__aarch64__) || 0
#define GOARCH "arm64"
#define SYZ_REVISION "1d2d5c49ca30bb2c225c6ce95ac7da41b3037694"
#define SYZ_REVISION "a7f7685d8f9761eda7eb661c373a502825fbc063"
#define __NR_syz_emit_ethernet 1000000
#define __NR_syz_extract_tcp_res 1000001
#define __NR_syz_fuse_mount 1000002
@ -6047,7 +6047,7 @@ call_t syscalls[] = {
#if defined(__ppc64__) || defined(__PPC64__) || defined(__powerpc64__) || 0
#define GOARCH "ppc64le"
#define SYZ_REVISION "b78ff86207e12923ad6b8b4d86044564f81de07a"
#define SYZ_REVISION "9c00b115a93768932c5ce5184066a522699ea726"
#define __NR_syz_emit_ethernet 1000000
#define __NR_syz_extract_tcp_res 1000001
#define __NR_syz_fuse_mount 1000002

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -42,9 +42,10 @@ func initTarget(target *prog.Target) {
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,
"sockaddr_alg": arch.generateSockaddrAlg,
"timespec": arch.generateTimespec,
"timeval": arch.generateTimespec,
"sockaddr_alg": arch.generateSockaddrAlg,
"alg_hash_name": arch.generateAlgHashName,
}
target.StringDictionary = stringDictionary

View File

@ -36,6 +36,15 @@ func (arch *arch) generateSockaddrAlg(g *prog.Gen, typ *prog.StructType, old *pr
return
}
func (arch *arch) generateAlgHashName(g *prog.Gen, typ *prog.StructType, old *prog.GroupArg) (
arg prog.Arg, calls []*prog.Call) {
algName := generateAlg(g.Rand(), ALG_HASH)
arg = prog.MakeGroupArg(typ, []prog.Arg{
prog.MakeDataArg(typ.Fields[0], []byte(algName)),
})
return
}
func generateAlgName(rnd *rand.Rand) (string, string) {
typ := allTypes[rnd.Intn(len(allTypes))]
name := generateAlg(rnd, typ.typ)

View File

@ -67,8 +67,13 @@ keyctl_dh_params {
}
keyctl_kdf_params {
hashname ptr[in, string[salg_name]]
hashname ptr[in, alg_hash_name]
otherinfo buffer[in, opt]
otherinfolen len[otherinfo, int32]
__spare array[const[0, int32], 8]
}
# Special struct generated by Go code.
alg_hash_name {
name string
}

File diff suppressed because one or more lines are too long

View File

@ -22,10 +22,10 @@ sendmmsg$alg(fd sock_algconn, mmsg ptr[in, array[msghdr_alg]], vlen len[mmsg], f
# Special struct generated by Go code.
sockaddr_alg {
family const[AF_ALG, int16]
type string[salg_type, 14]
type string["filled later", 14]
feat flags[af_alg_type, int32]
mask flags[af_alg_type, int32]
name string[salg_name, 64]
name string["filled later", 64]
}
msghdr_alg {
@ -70,9 +70,5 @@ af_alg_type = CRYPTO_ALG_TYPE_MASK, CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_COMP
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)
define CRYPTO_ALG_TYPE_PCOMPRESS 0x0000000f