Commit 9a3791c53b5c48516af5825302a5145397cb65e5

Authored by Dean Scarff
Committed by Jay Berkenbilt
1 parent a99ad2b9

Properly detect OPENSSL_IS_BORINGSSL

OPENSSL_IS_BORINGSSL is not actually set by configure, so it will be
undefined until a BoringSSL header is included.  Hence the #ifdef logic
in QPDFCrypto_openssl.h would usually never apply.

This still worked because evp.h transitively included BoringSSL's
cipher.h and digest.h, but the latter are the correct (documented)
headers.

By re-ordering the includes, we can ensure the macro is defined when we
use it.

Also: fix case in the header guards.
libqpdf/qpdf/QPDFCrypto_openssl.hh
1   -#ifndef QPDFCRYPTO_openssl_HH
2   -#define QPDFCRYPTO_openssl_HH
  1 +#ifndef QPDFCRYPTO_OPENSSL_HH
  2 +#define QPDFCRYPTO_OPENSSL_HH
3 3  
4 4 #include <qpdf/QPDFCryptoImpl.hh>
5 5 #include <string>
  6 +#include <openssl/rand.h>
6 7 #ifdef OPENSSL_IS_BORINGSSL
7 8 #include <openssl/cipher.h>
8 9 #include <openssl/digest.h>
9 10 #else
10 11 #include <openssl/evp.h>
11 12 #endif
12   -#include <openssl/rand.h>
13 13  
14 14 class QPDFCrypto_openssl: public QPDFCryptoImpl
15 15 {
... ... @@ -50,4 +50,4 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl
50 50 size_t sha2_bits;
51 51 };
52 52  
53   -#endif // QPDFCRYPTO_openssl_HH
  53 +#endif // QPDFCRYPTO_OPENSSL_HH
... ...