diff options
author | Jason King <jason.king@joyent.com> | 2018-05-30 17:19:18 -0500 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2018-08-07 19:46:09 +0000 |
commit | 0e986b9d87352cd82909c748e7f684afe0ed579f (patch) | |
tree | f22905e81904ef4d744b43e89d9d86c25b0c75d0 | |
parent | d8873b3136f0985c9e33ff8801644e1b4253b36c (diff) | |
download | illumos-joyent-0e986b9d87352cd82909c748e7f684afe0ed579f.tar.gz |
9698 pkcs11 C_Digest() is too restrictive in input
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r-- | usr/src/lib/pkcs11/libpkcs11/common/metaDigest.c | 5 | ||||
-rw-r--r-- | usr/src/lib/pkcs11/pkcs11_kernel/common/kernelDigest.c | 3 | ||||
-rw-r--r-- | usr/src/lib/pkcs11/pkcs11_softtoken/common/softDigest.c | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/usr/src/lib/pkcs11/libpkcs11/common/metaDigest.c b/usr/src/lib/pkcs11/libpkcs11/common/metaDigest.c index 673b83cbfd..aecf391807 100644 --- a/usr/src/lib/pkcs11/libpkcs11/common/metaDigest.c +++ b/usr/src/lib/pkcs11/libpkcs11/common/metaDigest.c @@ -21,10 +21,9 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2018, Joyent, Inc. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Message Digesting Functions * (as defined in PKCS#11 spec section 11.10) @@ -70,7 +69,7 @@ meta_Digest(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, meta_session_t *session; - if (pData == NULL || pulDigestLen == NULL) + if ((pData == NULL && ulDataLen != 0) || pulDigestLen == NULL) return (CKR_ARGUMENTS_BAD); rv = meta_handle2session(hSession, &session); diff --git a/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelDigest.c b/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelDigest.c index ec65a97caf..9b9ad981d5 100644 --- a/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelDigest.c +++ b/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelDigest.c @@ -22,6 +22,7 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2018, Joyent, Inc. */ #include <pthread.h> @@ -158,7 +159,7 @@ C_Digest(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, if (rv != CKR_OK) return (rv); - if (pData == NULL || pulDigestLen == NULL) { + if ((pData == NULL && ulDataLen != 0) || pulDigestLen == NULL) { rv = CKR_ARGUMENTS_BAD; goto clean_exit; } diff --git a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softDigest.c b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softDigest.c index 56d43ba5c9..32b7d24254 100644 --- a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softDigest.c +++ b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softDigest.c @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2018, Joyent, Inc. */ #include <pthread.h> @@ -120,7 +121,7 @@ C_Digest(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, if (rv != CKR_OK) return (rv); - if (pData == NULL || pulDigestLen == NULL) { + if ((pData == NULL && ulDataLen != 0) || pulDigestLen == NULL) { rv = CKR_ARGUMENTS_BAD; goto clean_exit; } |