fix github issue #20, allow user to use settings.h at app level as well for building wolfssl. verified types.h (which includes settings.h) or settings.h is included b4 definition checks at wolfssl and wolcrypt header levels

This commit is contained in:
toddouska
2015-02-26 12:29:15 -08:00
parent 67e81f534a
commit 9913edd7a5
28 changed files with 95 additions and 121 deletions

View File

@@ -23,7 +23,7 @@
#ifndef WOLFSSL_ERROR_H
#define WOLFSSL_ERROR_H
#include <wolfssl/wolfcrypt/error-crypt.h> /* pull in CTaoCrypt errors */
#include <wolfssl/wolfcrypt/error-crypt.h> /* pull in wolfCrypt errors */
#ifdef __cplusplus
extern "C" {

View File

@@ -19,15 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_AES
#ifndef WOLF_CRYPT_AES_H
#define WOLF_CRYPT_AES_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_AES
/* included for fips @wc_fips */
#ifdef HAVE_FIPS
#include <cyassl/ctaocrypt/aes.h>
@@ -182,6 +180,6 @@ typedef struct Gmac {
#endif
#endif /* WOLF_CRYPT_AES_H */
#endif /* NO_AES */
#endif /* WOLF_CRYPT_AES_H */

View File

@@ -23,15 +23,12 @@
#ifndef WOLF_CRYPT_ARC4_H
#define WOLF_CRYPT_ARC4_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define WOLFSSL_ARC4_CAVIUM_MAGIC 0xBEEF0001
enum {

View File

@@ -19,12 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_ASN
#ifndef WOLF_CRYPT_ASN_H
#define WOLF_CRYPT_ASN_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_ASN
#include <wolfssl/wolfcrypt/integer.h>
#ifndef NO_RSA
#include <wolfssl/wolfcrypt/rsa.h>
@@ -730,6 +731,6 @@ WOLFSSL_LOCAL void FreeDecodedCRL(DecodedCRL*);
} /* extern "C" */
#endif
#endif /* CTAO_CRYPT_ASN_H */
#endif /* !NO_ASN */
#endif /* WOLF_CRYPT_ASN_H */

View File

@@ -20,11 +20,14 @@
*/
#ifdef HAVE_BLAKE2
#ifndef WOLF_CRYPT_BLAKE2_H
#define WOLF_CRYPT_BLAKE2_H
#include <wolfssl/wolfcrypt/settings.h>
#ifdef HAVE_BLAKE2
#include <wolfssl/wolfcrypt/blake2-int.h>
/* call old functions if using fips for the sake of hmac @wc_fips */
@@ -63,6 +66,6 @@ WOLFSSL_API int wc_Blake2bFinal(Blake2b*, byte*, word32);
}
#endif
#endif /* WOLF_CRYPT_BLAKE2_H */
#endif /* HAVE_BLAKE2 */
#endif /* WOLF_CRYPT_BLAKE2_H */

View File

@@ -46,19 +46,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef HAVE_CAMELLIA
#ifndef WOLF_CRYPT_CAMELLIA_H
#define WOLF_CRYPT_CAMELLIA_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef HAVE_CAMELLIA
#ifdef __cplusplus
extern "C" {
#endif
enum {
CAMELLIA_BLOCK_SIZE = 16
};
@@ -93,6 +91,6 @@ WOLFSSL_API void wc_CamelliaCbcDecrypt(Camellia* cam,
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_CAMELLIA_H */
#endif /* HAVE_CAMELLIA */
#endif /* WOLF_CRYPT_CAMELLIA_H */

View File

@@ -19,18 +19,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef HAVE_CHACHA
#ifndef WOLF_CRYPT_CHACHA_H
#define WOLF_CRYPT_CHACHA_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef HAVE_CHACHA
#ifdef __cplusplus
extern "C" {
#endif
enum {
CHACHA_ENC_TYPE = 7 /* cipher unique type */
};
@@ -53,6 +52,6 @@ WOLFSSL_API int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz);
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_CHACHA_H */
#endif /* HAVE_CHACHA */
#endif /* WOLF_CRYPT_CHACHA_H */

View File

@@ -24,13 +24,13 @@
* https://tools.ietf.org/html/draft-irtf-cfrg-chacha20-poly1305-10
*/
#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
#ifndef WOLF_CRYPT_CHACHA20_POLY1305_H
#define WOLF_CRYPT_CHACHA20_POLY1305_H
#include <wolfssl/wolfcrypt/types.h>
#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
#ifdef __cplusplus
extern "C" {
#endif
@@ -75,5 +75,5 @@ int wc_ChaCha20Poly1305_Decrypt(
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_CHACHA20_POLY1305_H */
#endif /* HAVE_CHACHA && HAVE_POLY1305 */
#endif /* WOLF_CRYPT_CHACHA20_POLY1305_H */

View File

@@ -19,15 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef HAVE_LIBZ
#ifndef WOLF_CRYPT_COMPRESS_H
#define WOLF_CRYPT_COMPRESS_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef HAVE_LIBZ
#ifdef __cplusplus
extern "C" {
@@ -46,7 +43,6 @@ WOLFSSL_API int wc_DeCompress(byte*, word32, const byte*, word32);
#endif
#endif /* HAVE_LIBZ */
#endif /* WOLF_CRYPT_COMPRESS_H */
#endif /* HAVE_LIBZ */

View File

@@ -19,15 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_DES3
#ifndef WOLF_CRYPT_DES3_H
#define WOLF_CRYPT_DES3_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_DES3
#ifdef HAVE_FIPS
/* included for fips @wc_fips */
#include <cyassl/ctaocrypt/des3.h>
@@ -111,5 +109,5 @@ WOLFSSL_API int wc_Des3_CbcDecryptWithKey(byte* out, const byte* in, word32 sz,
#endif
#endif /* NO_DES3 */
#endif /* CTAO_CRYPT_DES3_H */
#endif /* WOLF_CRYPT_DES3_H */

View File

@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_DH
#ifndef WOLF_CRYPT_DH_H
#define WOLF_CRYPT_DH_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_DH
#include <wolfssl/wolfcrypt/integer.h>
#include <wolfssl/wolfcrypt/random.h>
@@ -61,7 +61,6 @@ WOLFSSL_API int wc_DhParamsLoad(const byte* input, word32 inSz, byte* p,
} /* extern "C" */
#endif
#endif /* NO_DH */
#endif /* WOLF_CRYPT_DH_H */
#endif /* NO_DH */

View File

@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_DSA
#ifndef WOLF_CRYPT_DSA_H
#define WOLF_CRYPT_DSA_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_DSA
#include <wolfssl/wolfcrypt/integer.h>
#include <wolfssl/wolfcrypt/random.h>
@@ -70,6 +70,6 @@ WOLFSSL_API int wc_DsaPrivateKeyDecode(const byte* input, word32* inOutIdx, DsaK
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_DSA_H */
#endif /* NO_DSA */
#endif /* WOLF_CRYPT_DSA_H */

View File

@@ -19,12 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef HAVE_ECC
#ifndef WOLF_CRYPT_ECC_H
#define WOLF_CRYPT_ECC_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef HAVE_ECC
#include <wolfssl/wolfcrypt/integer.h>
#include <wolfssl/wolfcrypt/random.h>
@@ -32,7 +33,6 @@
extern "C" {
#endif
enum {
ECC_PUBLICKEY = 1,
ECC_PRIVATEKEY = 2,
@@ -239,5 +239,5 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_ECC_H */
#endif /* HAVE_ECC */
#endif /* WOLF_CRYPT_ECC_H */

View File

@@ -19,14 +19,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef HAVE_ECC25519
#ifndef WOLF_CRYPT_ECC25519_H
#define WOLF_CRYPT_ECC25519_H
#include <wolfssl/wolfcrypt/ecc25519_fe.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfssl/wolfcrypt/settings.h>
#ifdef HAVE_ECC25519
#include <wolfssl/wolfcrypt/ecc25519_fe.h>
#include <wolfssl/wolfcrypt/random.h>
#ifdef __cplusplus
@@ -96,6 +96,6 @@ int wc_ecc25519_size(ecc25519_key* key);
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_ECC25519_H */
#endif /* HAVE_ECC25519 */
#endif /* WOLF_CRYPT_ECC25519_H */

View File

@@ -20,8 +20,8 @@
*/
#ifndef CTAO_CRYPT_FIPS_TEST_H
#define CTAO_CRYPT_FIPS_TEST_H
#ifndef WOLF_CRYPT_FIPS_TEST_H
#define WOLF_CRYPT_FIPS_TEST_H
#include <cyassl/ctaocrypt/types.h>
@@ -54,5 +54,5 @@ CYASSL_API const char* wolfCrypt_GetCoreHash_fips(void);
} /* extern "C" */
#endif
#endif /* CTAO_CRYPT_FIPS_TEST_H */
#endif /* WOLF_CRYPT_FIPS_TEST_H */

View File

@@ -19,19 +19,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_HC128
#ifndef WOLF_CRYPT_HC128_H
#define WOLF_CRYPT_HC128_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_HC128
#ifdef __cplusplus
extern "C" {
#endif
enum {
HC128_ENC_TYPE = 6 /* cipher unique type */
};
@@ -55,6 +53,6 @@ WOLFSSL_API int wc_Hc128_SetKey(HC128*, const byte* key, const byte* iv);
} /* extern "C" */
#endif
#endif /* HAVE_HC128 */
#endif /* WOLF_CRYPT_HC128_H */
#endif /* HAVE_HC128 */

View File

@@ -19,18 +19,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef WOLFSSL_MD2
#ifndef WOLF_CRYPT_MD2_H
#define WOLF_CRYPT_MD2_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef WOLFSSL_MD2
#ifdef __cplusplus
extern "C" {
#endif
/* in bytes */
enum {
MD2 = 6, /* hash type unique */
@@ -60,6 +59,6 @@ WOLFSSL_API int wc_Md2Hash(const byte*, word32, byte*);
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_MD2_H */
#endif /* WOLFSSL_MD2 */
#endif /* WOLF_CRYPT_MD2_H */

View File

@@ -19,19 +19,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_MD4
#ifndef WOLF_CRYPT_MD4_H
#define WOLF_CRYPT_MD4_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_MD4
#ifdef __cplusplus
extern "C" {
#endif
/* in bytes */
enum {
MD4_BLOCK_SIZE = 64,
@@ -59,7 +57,6 @@ WOLFSSL_API void wc_Md4Final(Md4*, byte*);
} /* extern "C" */
#endif
#endif /* NO_MD4 */
#endif /* WOLF_CRYPT_MD4_H */
#endif /* NO_MD4 */

View File

@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_MD5
#ifndef WOLF_CRYPT_MD5_H
#define WOLF_CRYPT_MD5_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_MD5
#ifdef HAVE_FIPS
#define wc_InitMd5 InitMd5
#define wc_Md5Update Md5Update
@@ -77,5 +77,5 @@ WOLFSSL_API int wc_Md5Hash(const byte*, word32, byte*);
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_MD5_H */
#endif /* NO_MD5 */
#endif /* WOLF_CRYPT_MD5_H */

View File

@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef HAVE_PKCS7
#ifndef WOLF_CRYPT_PKCS7_H
#define WOLF_CRYPT_PKCS7_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef HAVE_PKCS7
#ifndef NO_ASN
#include <wolfssl/wolfcrypt/asn.h>
#endif
@@ -121,7 +121,6 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
} /* extern "C" */
#endif
#endif /* HAVE_PKCS7 */
#endif /* WOLF_CRYPT_PKCS7_H */
#endif /* HAVE_PKCS7 */

View File

@@ -19,14 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef HAVE_POLY1305
#ifndef WOLF_CRYPT_POLY1305_H
#define WOLF_CRYPT_POLY1305_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef HAVE_POLY1305
#ifdef __cplusplus
extern "C" {
#endif
@@ -77,7 +76,6 @@ WOLFSSL_API int wc_Poly1305Final(Poly1305* poly1305, byte* tag);
} /* extern "C" */
#endif
#endif /* HAVE_POLY1305 */
#endif /* WOLF_CRYPT_POLY1305_H */
#endif /* HAVE_POLY1305 */

View File

@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_PWDBASED
#ifndef WOLF_CRYPT_PWDBASED_H
#define WOLF_CRYPT_PWDBASED_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_PWDBASED
#include <wolfssl/wolfcrypt/md5.h> /* for hash type */
#include <wolfssl/wolfcrypt/sha.h>
@@ -52,5 +52,5 @@ WOLFSSL_API int wc_PKCS12_PBKDF(byte* output, const byte* passwd, int pLen,
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_PWDBASED_H */
#endif /* NO_PWDBASED */
#endif /* WOLF_CRYPT_PWDBASED_H */

View File

@@ -19,14 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_RABBIT
#ifndef WOLF_CRYPT_RABBIT_H
#define WOLF_CRYPT_RABBIT_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_RABBIT
#ifdef __cplusplus
extern "C" {
#endif
@@ -60,6 +59,6 @@ WOLFSSL_API int wc_RabbitSetKey(Rabbit*, const byte* key, const byte* iv);
} /* extern "C" */
#endif
#endif /* NO_RABBIT */
#endif /* WOLF_CRYPT_RABBIT_H */
#endif /* NO_RABBIT */

View File

@@ -19,14 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef WOLFSSL_RIPEMD
#ifndef WOLF_CRYPT_RIPEMD_H
#define WOLF_CRYPT_RIPEME_H
#define WOLF_CRYPT_RIPEMD_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef WOLFSSL_RIPEMD
#ifdef __cplusplus
extern "C" {
#endif
@@ -60,5 +59,5 @@ WOLFSSL_API void wc_RipeMdFinal(RipeMd*, byte*);
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_RIPEMD_H */
#endif /* WOLFSSL_RIPEMD */
#endif /* WOLF_CRYPT_RIPEMD_H */

View File

@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_RSA
#ifndef WOLF_CRYPT_RSA_H
#define WOLF_CRYPT_RSA_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_RSA
#ifdef HAVE_FIPS
/* for fips @wc_fips */
#include <cyassl/ctaocrypt/rsa.h>
@@ -114,7 +114,6 @@ WOLFSSL_API int wc_RsaFlattenPublicKey(RsaKey*, byte*, word32*, byte*,
} /* extern "C" */
#endif
#endif /* NO_RSA */
#endif /* WOLF_CRYPT_RSA_H */
#endif /* NO_RSA */

View File

@@ -19,15 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NO_SHA
#ifndef WOLF_CRYPT_SHA_H
#define WOLF_CRYPT_SHA_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_SHA
#ifdef HAVE_FIPS
/* for fips @wc_fips */
#include <cyassl/ctaocrypt/sha.h>
@@ -77,6 +75,6 @@ WOLFSSL_API int wc_ShaHash(const byte*, word32, byte*);
} /* extern "C" */
#endif
#endif /* CTAO_CRYPT_SHA_H */
#endif /* NO_SHA */
#endif /* WOLF_CRYPT_SHA_H */

View File

@@ -17,21 +17,20 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* code submitted by raphael.huck@efixo.com */
#ifndef NO_SHA256
#ifndef WOLF_CRYPT_SHA256_H
#define WOLF_CRYPT_SHA256_H
#include <wolfssl/wolfcrypt/types.h>
#ifndef NO_SHA256
#ifdef HAVE_FIPS
/* for fips @wc_fips */
#include <cyassl/ctaocrypt/sha256.h>
/* for fips @wc_fips */
#include <cyassl/ctaocrypt/sha256.h>
#endif
#include <wolfssl/wolfcrypt/types.h>
#ifdef __cplusplus
extern "C" {
@@ -39,7 +38,7 @@
#ifndef HAVE_FIPS /* avoid redefinition of structs */
#ifdef WOLFSSL_PIC32MZ_HASH
#include "port/pic32/pic32mz-crypt.h"
#include "port/pic32/pic32mz-crypt.h"
#endif
/* in bytes */
@@ -74,6 +73,6 @@ WOLFSSL_API int wc_Sha256Hash(const byte*, word32, byte*);
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_SHA256_H */
#endif /* NO_SHA256 */
#endif /* WOLF_CRYPT_SHA256_H */

View File

@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef WOLFSSL_SHA512
#ifndef WOLF_CRYPT_SHA512_H
#define WOLF_CRYPT_SHA512_H
#include <wolfssl/wolfcrypt/types.h>
#ifdef WOLFSSL_SHA512
/* for fips @wc_fips */
#ifdef HAVE_FIPS
#define CYASSL_SHA512
@@ -99,6 +99,6 @@ WOLFSSL_API int wc_Sha384Hash(const byte*, word32, byte*);
} /* extern "C" */
#endif
#endif /* WOLF_CRYPT_SHA512_H */
#endif /* WOLFSSL_SHA512 */
#endif /* WOLF_CRYPT_SHA512_H */