From 832f18b9f292de13225cd65091cf77c8c6b55805 Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Wed, 14 Nov 2018 14:15:33 -0700 Subject: [PATCH] fix feature detection in CMS examples --- pkcs7/authEnvelopedData-pwri.c | 6 +++--- pkcs7/compressedData.c | 7 ++++--- pkcs7/envelopedData-pwri.c | 6 +++--- pkcs7/signedData-CompressedFirmwarePkgData.c | 7 ++++--- pkcs7/signedData-EncryptedCompressedFirmwarePkgData.c | 7 ++++--- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/pkcs7/authEnvelopedData-pwri.c b/pkcs7/authEnvelopedData-pwri.c index da8d0a70..b57b3871 100644 --- a/pkcs7/authEnvelopedData-pwri.c +++ b/pkcs7/authEnvelopedData-pwri.c @@ -28,6 +28,8 @@ #define encodedFilePWRI "authEnvelopedDataPWRI.der" +#if defined(HAVE_PKCS7) && !defined(NO_PWDBASED) + static const byte data[] = { /* Hello World */ 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f, 0x72,0x6c,0x64 @@ -175,8 +177,6 @@ static int authEnvelopedData_decrypt(byte* in, word32 inSz, byte* cert, return ret; } -#ifdef HAVE_PKCS7 - int main(int argc, char** argv) { int ret; @@ -233,5 +233,5 @@ int main(int argc, char** argv) return 0; } -#endif +#endif /* HAVE_PKCS7 & NO_PWDBASED */ diff --git a/pkcs7/compressedData.c b/pkcs7/compressedData.c index 2b3683fe..5d376cd2 100644 --- a/pkcs7/compressedData.c +++ b/pkcs7/compressedData.c @@ -26,6 +26,9 @@ #define compressedFile "compressedData.der" +#if defined(HAVE_PKCS7) && defined(HAVE_LIBZ) && \ + !defined(NO_PKCS7_COMPRESSED_DATA) + static const byte data[] = { /* Hello World */ 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f, 0x72,0x6c,0x64 @@ -112,8 +115,6 @@ static int compressedData_decode(byte* in, word32 inSz, byte* out, word32 outSz) return ret; } -#ifdef HAVE_PKCS7 - int main(int argc, char** argv) { int compressedSz, decodedSz; @@ -157,5 +158,5 @@ int main(int argc, char** argv) return 0; } -#endif +#endif /* HAVE_PKCS7 & HAVE_LIBZ & !NO_PKCS7_COMPRESSED_DATA */ diff --git a/pkcs7/envelopedData-pwri.c b/pkcs7/envelopedData-pwri.c index 75a0017a..9c7dacc9 100644 --- a/pkcs7/envelopedData-pwri.c +++ b/pkcs7/envelopedData-pwri.c @@ -23,6 +23,8 @@ #include #include +#if defined(HAVE_PKCS7) && !defined(NO_PWDBASED) + #define encodedFilePWRI "envelopedDataPWRI.der" static const byte data[] = { /* Hello World */ @@ -142,8 +144,6 @@ static int envelopedData_decrypt(byte* in, word32 inSz, byte* out, word32 outSz) return ret; } -#ifdef HAVE_PKCS7 - int main(int argc, char** argv) { int encryptedSz, decryptedSz; @@ -188,5 +188,5 @@ int main(int argc, char** argv) return 0; } -#endif +#endif /* HAVE_PKCS7 & !NO_PWDBASED */ diff --git a/pkcs7/signedData-CompressedFirmwarePkgData.c b/pkcs7/signedData-CompressedFirmwarePkgData.c index d9ddb86e..3f6f4199 100644 --- a/pkcs7/signedData-CompressedFirmwarePkgData.c +++ b/pkcs7/signedData-CompressedFirmwarePkgData.c @@ -41,6 +41,9 @@ #define encodedFileNoAttrs "signedCompressedFPD_noattrs.der" #define encodedFileAttrs "signedCompressedFPD_attrs.der" +#if defined(HAVE_PKCS7) && defined(HAVE_LIBZ) && \ + !defined(NO_PKCS7_COMPRESSED_DATA) + static const byte data[] = { /* Hello World */ 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f, 0x72,0x6c,0x64 @@ -251,8 +254,6 @@ static int signedData_verify(byte* in, word32 inSz, byte* cert, return ret; } -#ifdef HAVE_PKCS7 - int main(int argc, char** argv) { int ret; @@ -312,5 +313,5 @@ int main(int argc, char** argv) return 0; } -#endif +#endif /* HAVE_PKCS7 & HAVE_LIBZ & !NO_PKCS7_COMPRESSED_DATA */ diff --git a/pkcs7/signedData-EncryptedCompressedFirmwarePkgData.c b/pkcs7/signedData-EncryptedCompressedFirmwarePkgData.c index f7154069..a4594189 100644 --- a/pkcs7/signedData-EncryptedCompressedFirmwarePkgData.c +++ b/pkcs7/signedData-EncryptedCompressedFirmwarePkgData.c @@ -39,6 +39,9 @@ #include #include +#if defined(HAVE_PKCS7) && defined(HAVE_LIBZ) && \ + !defined(NO_PKCS7_ENCRYPTED_DATA) && !defined(NO_PKCS7_COMPRESSED_DATA) + #define certFile "../certs/client-cert.der" #define keyFile "../certs/client-key.der" #define encodedFileNoAttrs "signedEncryptedCompressedFPD_noattrs.der" @@ -291,8 +294,6 @@ static int signedData_verify(byte* in, word32 inSz, byte* cert, return ret; } -#ifdef HAVE_PKCS7 - int main(int argc, char** argv) { int ret; @@ -356,5 +357,5 @@ int main(int argc, char** argv) return 0; } -#endif +#endif /* HAVE_PKCS7 & HAVE_LIBZ & !NO_PKCS7_ENCRYPTED_DATA */