diff --git a/wolfcrypt/src/pkcs7.c b/wolfcrypt/src/pkcs7.c index 808e2c0b2..401985e9e 100644 --- a/wolfcrypt/src/pkcs7.c +++ b/wolfcrypt/src/pkcs7.c @@ -86,7 +86,7 @@ static int wc_SetContentType(int pkcs7TypeOID, byte* output, word32 outputSz) /* FirmwarePkgData (1.2.840.113549.1.9.16.1.16), RFC 4108 */ const byte firmwarePkgData[] = { 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x10, 0x01, 0x10 }; -#ifdef HAVE_LIBZ +#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) /* id-ct-compressedData (1.2.840.113549.1.9.16.1.9), RFC 3274 */ const byte compressedData[] = { 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x10, 0x01, 0x09 }; @@ -141,7 +141,7 @@ static int wc_SetContentType(int pkcs7TypeOID, byte* output, word32 outputSz) typeName = encryptedData; break; #endif -#ifdef HAVE_LIBZ +#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) case COMPRESSED_DATA: typeSz = sizeof(compressedData); typeName = compressedData; @@ -7321,7 +7321,7 @@ int wc_PKCS7_DecodeEncryptedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz, #endif /* NO_PKCS7_ENCRYPTED_DATA */ -#ifdef HAVE_LIBZ +#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) /* build PKCS#7 compressedData content type, return encrypted size */ int wc_PKCS7_EncodeCompressedData(PKCS7* pkcs7, byte* output, word32 outputSz) @@ -7572,7 +7572,7 @@ int wc_PKCS7_DecodeCompressedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz, return decompressedSz; } -#endif /* HAVE_LIBZ */ +#endif /* HAVE_LIBZ && !NO_PKCS7_COMPRESSED_DATA */ #else /* HAVE_PKCS7 */ diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 2fcee72d3..c232b0db0 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -326,7 +326,7 @@ int scrypt_test(void); #ifndef NO_PKCS7_ENCRYPTED_DATA int pkcs7encrypted_test(void); #endif - #ifdef HAVE_LIBZ + #if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) int pkcs7compressed_test(void); #endif #endif @@ -967,7 +967,7 @@ initDefaultName(); else printf( "PKCS7encrypted test passed!\n"); #endif - #ifdef HAVE_LIBZ + #if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) if ( (ret = pkcs7compressed_test()) != 0) return err_sys("PKCS7compressed test failed!\n", ret); else @@ -19750,7 +19750,7 @@ int pkcs7encrypted_test(void) #endif /* NO_PKCS7_ENCRYPTED_DATA */ -#ifdef HAVE_LIBZ +#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) typedef struct { const byte* content; diff --git a/wolfssl/wolfcrypt/pkcs7.h b/wolfssl/wolfcrypt/pkcs7.h index 6d1cbe472..8685565da 100644 --- a/wolfssl/wolfcrypt/pkcs7.h +++ b/wolfssl/wolfcrypt/pkcs7.h @@ -67,7 +67,7 @@ enum PKCS7_TYPES { SIGNED_AND_ENVELOPED_DATA = 654, /* 1.2.840.113549.1.7.4 */ DIGESTED_DATA = 655, /* 1.2.840.113549.1.7.5 */ ENCRYPTED_DATA = 656, /* 1.2.840.113549.1.7.6 */ -#ifdef HAVE_LIBZ +#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) COMPRESSED_DATA = 678, /* 1.2.840.113549.1.9.16.1.9, RFC 3274 */ #endif FIRMWARE_PKG_DATA = 685 /* 1.2.840.113549.1.9.16.1.16, RFC 4108 */ @@ -284,13 +284,13 @@ WOLFSSL_API int wc_PKCS7_DecodeEncryptedData(PKCS7* pkcs7, byte* pkiMsg, #endif /* NO_PKCS7_ENCRYPTED_DATA */ /* CMS/PKCS#7 CompressedData */ -#ifdef HAVE_LIBZ +#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) WOLFSSL_API int wc_PKCS7_EncodeCompressedData(PKCS7* pkcs7, byte* output, word32 outputSz); WOLFSSL_API int wc_PKCS7_DecodeCompressedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz, byte* output, word32 outputSz); -#endif /* HAVE_LIBZ */ +#endif /* HAVE_LIBZ && !NO_PKCS7_COMPRESSED_DATA */ #ifdef __cplusplus } /* extern "C" */