Cleanup for the AES GCM IV and CCM IV sizes, which are missing with some FIPS builds.

pull/3660/head
David Garske 2021-01-18 11:19:40 -08:00
parent 219cbd47eb
commit 8d1d616b39
2 changed files with 17 additions and 9 deletions

View File

@ -41,6 +41,7 @@
#ifndef NO_DES3
#include <wolfssl/wolfcrypt/des3.h>
#endif
#include <wolfssl/wolfcrypt/wc_encrypt.h>
#ifdef __cplusplus
extern "C" {
@ -157,15 +158,6 @@ enum Pkcs7_Misc {
MAX_RECIP_SZ = MAX_VERSION_SZ +
MAX_SEQ_SZ + ASN_NAME_MAX + MAX_SN_SZ +
MAX_SEQ_SZ + MAX_ALGO_SZ + 1 + MAX_ENCRYPTED_KEY_SZ,
#if (defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && \
(HAVE_FIPS_VERSION <= 2)) || (defined(HAVE_SELFTEST) && \
(!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2)))
/* In the event of fips cert 3389 or CAVP selftest v1 build, these enums are
* not in aes.h for use with pkcs7 so enumerate it here outside the fips
* boundary */
GCM_NONCE_MID_SZ = 12, /* The usual default nonce size for AES-GCM. */
CCM_NONCE_MIN_SZ = 7,
#endif
};
enum Cms_Options {

View File

@ -60,6 +60,22 @@
#endif
#if (defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && \
(HAVE_FIPS_VERSION <= 2)) || (defined(HAVE_SELFTEST) && \
(!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2)))
/* In FIPS cert 3389 and CAVP selftest v1 build, these enums are
* not in aes.h. Define them here outside the fips boundary.
*/
#ifndef GCM_NONCE_MID_SZ
/* The usual default nonce size for AES-GCM. */
#define GCM_NONCE_MID_SZ 12
#endif
#ifndef CCM_NONCE_MIN_SZ
#define CCM_NONCE_MIN_SZ 7
#endif
#endif
#if !defined(NO_AES) && defined(HAVE_AES_CBC)
WOLFSSL_API int wc_AesCbcEncryptWithKey(byte* out, const byte* in, word32 inSz,
const byte* key, word32 keySz,