allow CMS CompressedData to be disabled with NO_PKCS7_COMPRESSED_DATA

This commit is contained in:
Chris Conlon 2018-09-19 10:37:11 -06:00 committed by David Garske
parent 75349bbba5
commit a4da14f4b0
3 changed files with 10 additions and 10 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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" */