From: mortimer Date: Thu, 8 Feb 2018 10:01:12 +0000 (+0000) Subject: Do not hardcode key length. Pointed out by jsing@ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c6ded27617ab4b7f86b22d56ed06123c141a5f9c;p=openbsd Do not hardcode key length. Pointed out by jsing@ ok deraadt@ --- diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 945d947943a..48ae1af221e 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rnd.c,v 1.196 2018/02/08 09:27:44 mortimer Exp $ */ +/* $OpenBSD: rnd.c,v 1.197 2018/02/08 10:01:12 mortimer Exp $ */ /* * Copyright (c) 2011 Theo de Raadt. @@ -661,7 +661,7 @@ arc4random_ctx_new() chacha_ctx *ctx = malloc(sizeof(chacha_ctx), M_TEMP, M_WAITOK); arc4random_buf(keybuf, KEYSZ + IVSZ); - chacha_keysetup(ctx, keybuf, 256); + chacha_keysetup(ctx, keybuf, KEYSZ * 8); chacha_ivsetup(ctx, keybuf + KEYSZ, NULL); explicit_bzero(keybuf, sizeof(keybuf)); return (struct arc4random_ctx *)ctx;