Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/opencrypto Fix usage of MD5Final/SHA1Final
details: https://anonhg.NetBSD.org/src/rev/1c7bd94f0afa
branches: trunk
changeset: 823112:1c7bd94f0afa
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Apr 13 01:24:34 2017 +0000
description:
Fix usage of MD5Final/SHA1Final
Passing NULL as the digest parameter is wrong.
diffstat:
sys/opencrypto/cryptosoft.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r 0917100c9da5 -r 1c7bd94f0afa sys/opencrypto/cryptosoft.c
--- a/sys/opencrypto/cryptosoft.c Thu Apr 13 01:19:17 2017 +0000
+++ b/sys/opencrypto/cryptosoft.c Thu Apr 13 01:24:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cryptosoft.c,v 1.47 2015/08/20 14:40:19 christos Exp $ */
+/* $NetBSD: cryptosoft.c,v 1.48 2017/04/13 01:24:34 ozaki-r Exp $ */
/* $FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $ */
/* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.47 2015/08/20 14:40:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.48 2017/04/13 01:24:34 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -948,7 +948,9 @@
axf = &swcr_auth_hash_key_md5;
goto auth2common;
- case CRYPTO_SHA1_KPDK:
+ case CRYPTO_SHA1_KPDK: {
+ unsigned char digest[SHA1_DIGEST_LENGTH];
+ CTASSERT(SHA1_DIGEST_LENGTH >= MD5_DIGEST_LENGTH);
axf = &swcr_auth_hash_key_sha1;
auth2common:
(*swd)->sw_ictx = malloc(axf->ctxsize,
@@ -971,9 +973,10 @@
axf->Init((*swd)->sw_ictx);
axf->Update((*swd)->sw_ictx, cri->cri_key,
cri->cri_klen / 8);
- axf->Final(NULL, (*swd)->sw_ictx);
+ axf->Final(digest, (*swd)->sw_ictx);
(*swd)->sw_axf = axf;
break;
+ }
case CRYPTO_MD5:
axf = &swcr_auth_hash_md5;
Home |
Main Index |
Thread Index |
Old Index