From: "Stephan Müller" <smueller@chronox.de>
To: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-crypto@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
gilad.benyossef@arm.com, Binoy Jayan <binoy.jayan@linaro.org>,
Ofir Drang <ofir.drang@arm.com>,
Stuart Yoder <stuart.yoder@arm.com>
Subject: Re: [PATCH v2 6/9] staging: ccree: add FIPS support
Date: Thu, 20 Apr 2017 15:39:48 +0200 [thread overview]
Message-ID: <6020947.G2hzgUSCE3@positron.chronox.de> (raw)
In-Reply-To: <1492693983-8175-7-git-send-email-gilad@benyossef.com>
Am Donnerstag, 20. April 2017, 15:13:00 CEST schrieb Gilad Ben-Yossef:
Hi Gilad,
> +/* The function verifies that tdes keys are not weak.*/
> +static int ssi_fips_verify_3des_keys(const u8 *key, unsigned int keylen)
> +{
> +#ifdef CCREE_FIPS_SUPPORT
> + tdes_keys_t *tdes_key = (tdes_keys_t*)key;
> +
> + /* verify key1 != key2 and key3 != key2*/
I do not think that this check is necessary. There is no FIPS requirement or
IG that mandates this (unlike the XTS key check).
If there would be such requirement, we would need a common service function
for all TDES implementations
> + if (unlikely( (memcmp((u8*)tdes_key->key1, (u8*)tdes_key->key2,
> sizeof(tdes_key->key1)) == 0) || + (memcmp((u8*)tdes_key->key3,
> (u8*)tdes_key->key2, sizeof(tdes_key->key3)) == 0) )) { +
> return -ENOEXEC;
> + }
> +#endif /* CCREE_FIPS_SUPPORT */
> +
> + return 0;
> +}
> +
> +/* The function verifies that xts keys are not weak.*/
> +static int ssi_fips_verify_xts_keys(const u8 *key, unsigned int keylen)
> +{
> +#ifdef CCREE_FIPS_SUPPORT
> + /* Weak key is define as key that its first half (128/256 lsb)
> equals its second half (128/256 msb) */ + int singleKeySize = keylen
> >> 1;
> +
> + if (unlikely(memcmp(key, &key[singleKeySize], singleKeySize) == 0)) {
> + return -ENOEXEC;
Use xts_check_key.
> +The test vectors were taken from:
> +
> +* AES
> +NIST Special Publication 800-38A 2001 Edition
> +Recommendation for Block Cipher Modes of Operation
> +http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
> +Appendix F: Example Vectors for Modes of Operation of the AES
> +
> +* AES CTS
> +Advanced Encryption Standard (AES) Encryption for Kerberos 5
> +February 2005
> +https://tools.ietf.org/html/rfc3962#appendix-B
> +B. Sample Test Vectors
> +
> +* AES XTS
> +http://csrc.nist.gov/groups/STM/cavp/#08
> +http://csrc.nist.gov/groups/STM/cavp/documents/aes/XTSTestVectors.zip
> +
> +* AES CMAC
> +http://csrc.nist.gov/groups/STM/cavp/index.html#07
> +http://csrc.nist.gov/groups/STM/cavp/documents/mac/cmactestvectors.zip
> +
> +* AES-CCM
> +http://csrc.nist.gov/groups/STM/cavp/#07
> +http://csrc.nist.gov/groups/STM/cavp/documents/mac/ccmtestvectors.zip
> +
> +* AES-GCM
> +http://csrc.nist.gov/groups/STM/cavp/documents/mac/gcmtestvectors.zip
> +
> +* Triple-DES
> +NIST Special Publication 800-67 January 2012
> +Recommendation for the Triple Data Encryption Algorithm (TDEA) Block Cipher
> +http://csrc.nist.gov/publications/nistpubs/800-67-Rev1/SP-800-67-Rev1.pdf
> +APPENDIX B: EXAMPLE OF TDEA FORWARD AND INVERSE CIPHER OPERATIONS +and
> +http://csrc.nist.gov/groups/STM/cavp/#01
> +http://csrc.nist.gov/groups/STM/cavp/documents/des/tdesmct_intermediate.zip
> +
> +* HASH
> +http://csrc.nist.gov/groups/STM/cavp/#03
> +http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip
> +
> +* HMAC
> +http://csrc.nist.gov/groups/STM/cavp/#07
> +http://csrc.nist.gov/groups/STM/cavp/documents/mac/hmactestvectors.zip
> +
> +*/
Is this test vector business really needed? Why do you think that testmgr.c is
not sufficient? Other successful FIPS validations of the kernel crypto API
managed without such special code.
Also, your entire API seems to implement the approach that if there is a self
test error, you disable the cipher functions, but leave the rest in-tact. The
standard kernel crypto API handling logic is to simply panic the kernel. Is it
really necessary to implement a special case for your driver?
Ciao
Stephan
next prev parent reply other threads:[~2017-04-20 13:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-20 13:12 [PATCH v2 0/9] staging: ccree: add Arm TrustZone CryptoCell REE driver Gilad Ben-Yossef
2017-04-20 13:12 ` [PATCH v2 1/9] staging: ccree: introduce CryptoCell HW driver Gilad Ben-Yossef
2017-04-20 13:33 ` Greg Kroah-Hartman
2017-04-20 13:40 ` Gilad Ben-Yossef
2017-04-20 14:01 ` Greg Kroah-Hartman
2017-04-23 9:38 ` Gilad Ben-Yossef
2017-04-20 17:12 ` [PATCH] staging: ccree: fix platform_no_drv_owner.cocci warnings kbuild test robot
2017-04-20 17:12 ` [PATCH] staging: ccree: fix ifnullfree.cocci warnings kbuild test robot
2017-04-20 17:12 ` [PATCH] staging: ccree: fix array_size.cocci warnings kbuild test robot
2017-04-20 17:12 ` [PATCH] staging: ccree: fix semicolon.cocci warnings kbuild test robot
2017-04-20 17:12 ` [PATCH v2 1/9] staging: ccree: introduce CryptoCell HW driver kbuild test robot
2017-04-20 13:12 ` [PATCH v2 2/9] staging: ccree: add ahash support Gilad Ben-Yossef
2017-04-20 18:06 ` [PATCH] staging: ccree: fix ifnullfree.cocci warnings kbuild test robot
2017-04-20 18:06 ` [PATCH v2 2/9] staging: ccree: add ahash support kbuild test robot
2017-04-20 13:12 ` [PATCH v2 3/9] staging: ccree: add skcipher support Gilad Ben-Yossef
2017-04-20 13:12 ` [PATCH v2 4/9] staging: ccree: add IV generation support Gilad Ben-Yossef
2017-04-20 13:12 ` [PATCH v2 5/9] staging: ccree: add AEAD support Gilad Ben-Yossef
2017-04-20 18:57 ` kbuild test robot
2017-04-20 13:13 ` [PATCH v2 6/9] staging: ccree: add FIPS support Gilad Ben-Yossef
2017-04-20 13:39 ` Stephan Müller [this message]
2017-04-23 9:48 ` Gilad Ben-Yossef
2017-04-23 18:57 ` Stephan Müller
2017-04-24 6:06 ` Gilad Ben-Yossef
2017-04-24 6:16 ` Stephan Müller
2017-04-24 6:21 ` Stephan Müller
2017-04-24 7:07 ` Gilad Ben-Yossef
2017-04-24 7:23 ` Stephan Müller
2017-04-24 7:04 ` Gilad Ben-Yossef
2017-04-24 7:22 ` Stephan Müller
2017-04-20 13:13 ` [PATCH v2 7/9] staging: ccree: add TODO list Gilad Ben-Yossef
2017-04-20 13:13 ` [PATCH v2 8/9] staging: ccree: add DT bindings for Arm CryptoCell Gilad Ben-Yossef
2017-04-20 13:13 ` [PATCH v2 9/9] MAINTAINERS: add Gilad BY as ccree maintainer Gilad Ben-Yossef
2017-04-20 13:30 ` [PATCH v2 0/9] staging: ccree: add Arm TrustZone CryptoCell REE driver Greg Kroah-Hartman
2017-04-20 13:36 ` Gilad Ben-Yossef
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6020947.G2hzgUSCE3@positron.chronox.de \
--to=smueller@chronox.de \
--cc=binoy.jayan@linaro.org \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=devicetree@vger.kernel.org \
--cc=gilad.benyossef@arm.com \
--cc=gilad@benyossef.com \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=ofir.drang@arm.com \
--cc=robh+dt@kernel.org \
--cc=stuart.yoder@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox