Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108554004
D32112.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D32112.diff
View Options
diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c
--- a/sys/crypto/aesni/aesni.c
+++ b/sys/crypto/aesni/aesni.c
@@ -1,7 +1,7 @@
/*-
* Copyright (c) 2005-2008 Pawel Jakub Dawidek <pjd@FreeBSD.org>
* Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org>
- * Copyright (c) 2014 The FreeBSD Foundation
+ * Copyright (c) 2014-2021 The FreeBSD Foundation
* Copyright (c) 2017 Conrad Meyer <cem@FreeBSD.org>
* All rights reserved.
*
@@ -9,6 +9,9 @@
* under sponsorship of the FreeBSD Foundation and
* Rubicon Communications, LLC (Netgate).
*
+ * Portions of this software were developed by Ararat River
+ * Consulting, LLC under sponsorship of the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -319,8 +322,7 @@
if (csp->csp_auth_mlen != 0 &&
csp->csp_auth_mlen != AES_CBC_MAC_HASH_LEN)
return (EINVAL);
- if (csp->csp_ivlen != AES_CCM_IV_LEN ||
- !sc->has_aes)
+ if (!sc->has_aes)
return (EINVAL);
break;
default:
@@ -639,9 +641,12 @@
csp = crypto_get_params(crp->crp_session);
switch (csp->csp_cipher_alg) {
+ case CRYPTO_AES_CCM_16:
+ if (crp->crp_payload_length > ccm_max_payload_length(csp))
+ return (EMSGSIZE);
+ /* FALLTHROUGH */
case CRYPTO_AES_ICM:
case CRYPTO_AES_NIST_GCM_16:
- case CRYPTO_AES_CCM_16:
if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0)
return (EINVAL);
break;
diff --git a/sys/crypto/aesni/aesni_ccm.c b/sys/crypto/aesni/aesni_ccm.c
--- a/sys/crypto/aesni/aesni_ccm.c
+++ b/sys/crypto/aesni/aesni_ccm.c
@@ -1,11 +1,15 @@
/*-
- * Copyright (c) 2014 The FreeBSD Foundation
+ * Copyright (c) 2014-2021 The FreeBSD Foundation
* Copyright (c) 2018 iXsystems, Inc
* All rights reserved.
*
- * This software was developed by John-Mark Gurney under
- * the sponsorship of the FreeBSD Foundation and
+ * Portions of this software were developed by John-Mark Gurney
+ * under the sponsorship of the FreeBSD Foundation and
* Rubicon Communications, LLC (Netgate).
+ *
+ * Portions of this software were developed by Ararat River
+ * Consulting, LLC under sponsorship of the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -185,12 +189,7 @@
* however, they're always truncated from 16 bytes, and the tag
* length isn't passed in. (This could be fixed by changing the
* code in aesni.c:aesni_cipher_crypt().)
- * Similarly, although the nonce length is passed in, the
- * OpenCrypto API that calls us doesn't have a way to set the nonce
- * other than by having different crypto algorithm types. As a result,
- * this is currently always called with nlen=12; this means that we
- * also have a maximum message length of 16 megabytes. And similarly,
- * since abytes is limited to a 32 bit value here, the AAD is
+ * Since abytes is limited to a 32 bit value here, the AAD is
* limited to 4 gigabytes or less.
*/
void
@@ -222,14 +221,6 @@
*/
L = sizeof(__m128i) - 1 - nlen;
- /*
- * Now, this shouldn't happen, but let's make sure that
- * the data length isn't too big.
- */
- KASSERT(nbytes <= ((1 << (8 * L)) - 1),
- ("%s: nbytes is %u, but length field is %d bytes",
- __FUNCTION__, nbytes, L));
-
/*
* Clear out the blocks
*/
@@ -399,13 +390,6 @@
*/
L = sizeof(__m128i) - 1 - nlen;
- /*
- * Now, this shouldn't happen, but let's make sure that
- * the data length isn't too big.
- */
- if (nbytes > ((1 << (8 * L)) - 1))
- panic("%s: nbytes is %u, but length field is %d bytes",
- __FUNCTION__, nbytes, L);
/*
* Clear out the blocks
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 27, 7:12 AM (2 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16188877
Default Alt Text
D32112.diff (3 KB)
Attached To
Mode
D32112: aesni: Support multiple nonce lengths for AES-CCM.
Attached
Detach File
Event Timeline
Log In to Comment