From accfaf17af1541699e1f0532095348584f753d23 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 5 Jan 2015 09:48:43 -0700 Subject: [PATCH] update to comment headers --- cyassl/ctaocrypt/logging.h | 8 ++++++ wolfcrypt/src/misc.c | 10 ++++---- wolfcrypt/src/sha.c | 10 ++++---- wolfssl/wolfcrypt/blake2-impl.h | 14 +++++------ wolfssl/wolfcrypt/blake2-int.h | 14 +++++------ wolfssl/wolfcrypt/coding.h | 26 ++++++++++---------- wolfssl/wolfcrypt/hmac.h | 6 ++--- wolfssl/wolfcrypt/logging.h | 39 ++++++++++++------------------ wolfssl/wolfcrypt/md2.h | 5 ---- wolfssl/wolfcrypt/md4.h | 7 ------ wolfssl/wolfcrypt/misc.h | 34 +++++++++++++------------- wolfssl/wolfcrypt/mpi_class.h | 6 ++--- wolfssl/wolfcrypt/mpi_superclass.h | 6 ++--- wolfssl/wolfcrypt/settings.h | 6 ++--- wolfssl/wolfcrypt/wc_port.h | 9 +++---- 15 files changed, 93 insertions(+), 107 deletions(-) diff --git a/cyassl/ctaocrypt/logging.h b/cyassl/ctaocrypt/logging.h index 9a3e56d0f..8b9480be5 100644 --- a/cyassl/ctaocrypt/logging.h +++ b/cyassl/ctaocrypt/logging.h @@ -28,6 +28,14 @@ /* for fips compatibility @wc_fips */ #ifndef HAVE_FIPS #include + #define CYASSL_LEAVE WOLFSSL_LEAVE + #define CYASSL_ERROR WOLFSSL_ERROR + #define CYASSL_ENTER WOLFSSL_ENTER + #define CYASSL_MSG WOLFSSL_MSG + /* check old macros possibly declared */ + #if defined(CYASSL_DEBUG) && !defined(DEBUG_WOLFSSL) + #define DEBUG_WOLFSSL + #endif #else #ifdef __cplusplus extern "C" { diff --git a/wolfcrypt/src/misc.c b/wolfcrypt/src/misc.c index 22a3eb3a5..70880df3b 100644 --- a/wolfcrypt/src/misc.c +++ b/wolfcrypt/src/misc.c @@ -30,7 +30,7 @@ /* inlining these functions is a huge speed increase and a small size decrease, because the functions are smaller than function call setup/cleanup, e.g., md5 benchmark is twice as fast with inline. If you don't want it, then - define NO_INLINE and compile this file into cyassl, otherwise it's used as + define NO_INLINE and compile this file into wolfssl, otherwise it's used as a source header */ @@ -148,7 +148,7 @@ STATIC INLINE void ByteReverseWords64(word64* out, const word64* in, #endif /* WORD64_AVAILABLE */ -STATIC INLINE void XorWords(cyassl_word* r, const cyassl_word* a, word32 n) +STATIC INLINE void XorWords(wolfssl_word* r, const wolfssl_word* a, word32 n) { word32 i; @@ -158,9 +158,9 @@ STATIC INLINE void XorWords(cyassl_word* r, const cyassl_word* a, word32 n) STATIC INLINE void xorbuf(void* buf, const void* mask, word32 count) { - if (((cyassl_word)buf | (cyassl_word)mask | count) % CYASSL_WORD_SIZE == 0) - XorWords( (cyassl_word*)buf, - (const cyassl_word*)mask, count / CYASSL_WORD_SIZE); + if (((wolfssl_word)buf | (wolfssl_word)mask | count) % WOLFSSL_WORD_SIZE == 0) + XorWords( (wolfssl_word*)buf, + (const wolfssl_word*)mask, count / WOLFSSL_WORD_SIZE); else { word32 i; byte* b = (byte*)buf; diff --git a/wolfcrypt/src/sha.c b/wolfcrypt/src/sha.c index 7819062d1..0f60a36de 100644 --- a/wolfcrypt/src/sha.c +++ b/wolfcrypt/src/sha.c @@ -398,25 +398,25 @@ int wc_ShaHash(const byte* data, word32 len, byte* hash) #else Sha sha[1]; #endif - + #ifdef WOLFSSL_SMALL_STACK sha = (Sha*)XMALLOC(sizeof(Sha), NULL, DYNAMIC_TYPE_TMP_BUFFER); if (sha == NULL) return MEMORY_E; #endif - + if ((ret = wc_InitSha(sha)) != 0) { - CYASSL_MSG("wc_InitSha failed"); + WOLFSSL_MSG("wc_InitSha failed"); } else { wc_ShaUpdate(sha, data, len); wc_ShaFinal(sha, hash); } - + #ifdef WOLFSSL_SMALL_STACK XFREE(sha, NULL, DYNAMIC_TYPE_TMP_BUFFER); #endif - + return ret; } diff --git a/wolfssl/wolfcrypt/blake2-impl.h b/wolfssl/wolfcrypt/blake2-impl.h index d82bffc64..9a1126b30 100644 --- a/wolfssl/wolfcrypt/blake2-impl.h +++ b/wolfssl/wolfcrypt/blake2-impl.h @@ -14,14 +14,14 @@ * * Copyright (C) 2006-2014 wolfSSL Inc. * - * This file is part of CyaSSL. + * This file is part of wolfSSL. (formerly known as CyaSSL) * - * CyaSSL is free software; you can redistribute it and/or modify + * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * CyaSSL is distributed in the hope that it will be useful, + * wolfSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -32,10 +32,10 @@ */ -#ifndef CTAOCRYPT_BLAKE2_IMPL_H -#define CTAOCRYPT_BLAKE2_IMPL_H +#ifndef WOLFCRYPT_BLAKE2_IMPL_H +#define WOLFCRYPT_BLAKE2_IMPL_H -#include +#include static inline word32 load32( const void *src ) { @@ -150,5 +150,5 @@ static inline void secure_zero_memory( void *v, word64 n ) while( n-- ) *p++ = 0; } -#endif /* CTAOCRYPT_BLAKE2_IMPL_H */ +#endif /* WOLFCRYPT_BLAKE2_IMPL_H */ diff --git a/wolfssl/wolfcrypt/blake2-int.h b/wolfssl/wolfcrypt/blake2-int.h index ba5cc7745..fcddfc2b9 100644 --- a/wolfssl/wolfcrypt/blake2-int.h +++ b/wolfssl/wolfcrypt/blake2-int.h @@ -14,14 +14,14 @@ * * Copyright (C) 2006-2014 wolfSSL Inc. * - * This file is part of CyaSSL. + * This file is part of wolfSSL. (formerly known as CyaSSL) * - * CyaSSL is free software; you can redistribute it and/or modify + * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * CyaSSL is distributed in the hope that it will be useful, + * wolfSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -33,10 +33,10 @@ -#ifndef CTAOCRYPT_BLAKE2_INT_H -#define CTAOCRYPT_BLAKE2_INT_H +#ifndef WOLFCRYPT_BLAKE2_INT_H +#define WOLFCRYPT_BLAKE2_INT_H -#include +#include #if defined(_MSC_VER) @@ -179,5 +179,5 @@ } #endif -#endif /* CTAOCRYPT_BLAKE2_INT_H */ +#endif /* WOLFCRYPT_BLAKE2_INT_H */ diff --git a/wolfssl/wolfcrypt/coding.h b/wolfssl/wolfcrypt/coding.h index 303565fd9..e46167670 100644 --- a/wolfssl/wolfcrypt/coding.h +++ b/wolfssl/wolfcrypt/coding.h @@ -2,14 +2,14 @@ * * Copyright (C) 2006-2014 wolfSSL Inc. * - * This file is part of CyaSSL. + * This file is part of wolfSSL. (formerly known as CyaSSL) * - * CyaSSL is free software; you can redistribute it and/or modify + * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * CyaSSL is distributed in the hope that it will be useful, + * wolfSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -20,32 +20,32 @@ */ -#ifndef CTAO_CRYPT_CODING_H -#define CTAO_CRYPT_CODING_H +#ifndef WOLF_CRYPT_CODING_H +#define WOLF_CRYPT_CODING_H -#include +#include #ifdef __cplusplus extern "C" { #endif -/* decode needed by CyaSSL */ -CYASSL_LOCAL int Base64_Decode(const byte* in, word32 inLen, byte* out, +/* decode needed by wolfSSL */ +WOLFSSL_LOCAL int Base64_Decode(const byte* in, word32 inLen, byte* out, word32* outLen); -#if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(CYASSL_KEY_GEN) || defined(CYASSL_CERT_GEN) || defined(HAVE_WEBSERVER) +#if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN) || defined(HAVE_WEBSERVER) /* encode isn't */ - CYASSL_API + WOLFSSL_API int Base64_Encode(const byte* in, word32 inLen, byte* out, word32* outLen); - CYASSL_API + WOLFSSL_API int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out, word32* outLen); #endif #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(HAVE_FIPS) - CYASSL_API + WOLFSSL_API int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen); #endif @@ -54,5 +54,5 @@ CYASSL_LOCAL int Base64_Decode(const byte* in, word32 inLen, byte* out, } /* extern "C" */ #endif -#endif /* CTAO_CRYPT_CODING_H */ +#endif /* WOLF_CRYPT_CODING_H */ diff --git a/wolfssl/wolfcrypt/hmac.h b/wolfssl/wolfcrypt/hmac.h index b37e3bcd3..d4c1b7aff 100644 --- a/wolfssl/wolfcrypt/hmac.h +++ b/wolfssl/wolfcrypt/hmac.h @@ -43,7 +43,7 @@ #include #endif -#ifdef HAVE_BLAKE2 +#ifdef HAVE_BLAKE2 #include #endif @@ -86,7 +86,7 @@ enum { #ifndef WOLFSSL_SHA384 SHA384 = 5, #endif -#ifndef HAVE_BLAKE2 +#ifndef HAVE_BLAKE2 BLAKE2B_ID = 7, #endif @@ -132,7 +132,7 @@ typedef union { #ifdef WOLFSSL_SHA512 Sha512 sha512; #endif - #ifdef HAVE_BLAKE2 + #ifdef HAVE_BLAKE2 Blake2b blake2b; #endif } Hash; diff --git a/wolfssl/wolfcrypt/logging.h b/wolfssl/wolfcrypt/logging.h index 8b7f32dd4..f95e8e7e0 100644 --- a/wolfssl/wolfcrypt/logging.h +++ b/wolfssl/wolfcrypt/logging.h @@ -28,21 +28,12 @@ /* for reverse compatibility @wc_fips */ #ifndef HAVE_FIPS #include - #define CYASSL_LEAVE WOLFSSL_LEAVE - #define CYASSL_ERROR WOLFSSL_ERROR - #define CYASSL_ENTER WOLFSSL_ENTER - #define CYASSL_MSG WOLFSSL_MSG - - /* check old macros possibly declared */ - #if defined(CYASSL_DEBUG) && !defined(DEBUG_WOLFSSL) - #define DEBUG_WOLFSSL - #endif #ifdef __cplusplus extern "C" { #endif - - + + enum CYA_Log_Levels { ERROR_LOG = 0, INFO_LOG, @@ -50,38 +41,38 @@ LEAVE_LOG, OTHER_LOG }; - + typedef void (*wolfSSL_Logging_cb)(const int logLevel, const char *const logMessage); - + WOLFSSL_API int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function); - + #ifdef DEBUG_WOLFSSL - + void WOLFSSL_ENTER(const char* msg); void WOLFSSL_LEAVE(const char* msg, int ret); - + void WOLFSSL_ERROR(int); void WOLFSSL_MSG(const char* msg); - + #else /* DEBUG_WOLFSSL */ - + #define WOLFSSL_ENTER(m) #define WOLFSSL_LEAVE(m, r) - + #define WOLFSSL_ERROR(e) #define WOLFSSL_MSG(m) - + #endif /* DEBUG_WOLFSSL */ - + #ifdef __cplusplus } #endif #else /* if using fips use old logging file */ #include - #define WOLFSSL_LEAVE CYASSL_LEAVE - #define WOLFSSL_ERROR CYASSL_ERROR - #define WOLFSSL_ENTER CYASSL_ENTER + #define WOLFSSL_LEAVE CYASSL_LEAVE + #define WOLFSSL_ERROR CYASSL_ERROR + #define WOLFSSL_ENTER CYASSL_ENTER #define WOLFSSL_MSG CYASSL_MSG #endif #endif /* WOLFSSL_LOGGING_H */ diff --git a/wolfssl/wolfcrypt/md2.h b/wolfssl/wolfcrypt/md2.h index 01f26fbd0..12d0943e6 100644 --- a/wolfssl/wolfcrypt/md2.h +++ b/wolfssl/wolfcrypt/md2.h @@ -19,11 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/* check for old macro */ -#if defined(CYASSL_MD2) && !defined(WOLFSSL_MD2) - #define WOLFSSL_MD2 -#endif - #ifdef WOLFSSL_MD2 #ifndef WOLF_CRYPT_MD2_H diff --git a/wolfssl/wolfcrypt/md4.h b/wolfssl/wolfcrypt/md4.h index 75a8976ca..8e0fc1cf7 100644 --- a/wolfssl/wolfcrypt/md4.h +++ b/wolfssl/wolfcrypt/md4.h @@ -27,13 +27,6 @@ #include -/* for md4 reverse compatibility */ -#ifndef NO_MD4 - #define InitMd4 wc_InitMd4 - #define Md4Update wc_Md4Update - #define Md4Final wc_Md4Final -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/wolfssl/wolfcrypt/misc.h b/wolfssl/wolfcrypt/misc.h index c55f50bd0..4654f1fbe 100644 --- a/wolfssl/wolfcrypt/misc.h +++ b/wolfssl/wolfcrypt/misc.h @@ -2,14 +2,14 @@ * * Copyright (C) 2006-2014 wolfSSL Inc. * - * This file is part of CyaSSL. + * This file is part of wolfSSL. (formerly known as CyaSSL) * - * CyaSSL is free software; you can redistribute it and/or modify + * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * CyaSSL is distributed in the hope that it will be useful, + * wolfSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -20,11 +20,11 @@ */ -#ifndef CTAO_CRYPT_MISC_H -#define CTAO_CRYPT_MISC_H +#ifndef WOLF_CRYPT_MISC_H +#define WOLF_CRYPT_MISC_H -#include +#include #ifdef __cplusplus @@ -33,30 +33,30 @@ #ifdef NO_INLINE -CYASSL_LOCAL +WOLFSSL_LOCAL word32 rotlFixed(word32, word32); -CYASSL_LOCAL +WOLFSSL_LOCAL word32 rotrFixed(word32, word32); -CYASSL_LOCAL +WOLFSSL_LOCAL word32 ByteReverseWord32(word32); -CYASSL_LOCAL +WOLFSSL_LOCAL void ByteReverseWords(word32*, const word32*, word32); -CYASSL_LOCAL +WOLFSSL_LOCAL void XorWords(word*, const word*, word32); -CYASSL_LOCAL +WOLFSSL_LOCAL void xorbuf(void*, const void*, word32); #ifdef WORD64_AVAILABLE -CYASSL_LOCAL +WOLFSSL_LOCAL word64 rotlFixed64(word64, word64); -CYASSL_LOCAL +WOLFSSL_LOCAL word64 rotrFixed64(word64, word64); -CYASSL_LOCAL +WOLFSSL_LOCAL word64 ByteReverseWord64(word64); -CYASSL_LOCAL +WOLFSSL_LOCAL void ByteReverseWords64(word64*, const word64*, word32); #endif /* WORD64_AVAILABLE */ @@ -68,5 +68,5 @@ void ByteReverseWords64(word64*, const word64*, word32); #endif -#endif /* CTAO_CRYPT_MISC_H */ +#endif /* WOLF_CRYPT_MISC_H */ diff --git a/wolfssl/wolfcrypt/mpi_class.h b/wolfssl/wolfcrypt/mpi_class.h index 50ad757f3..58111d8e8 100644 --- a/wolfssl/wolfcrypt/mpi_class.h +++ b/wolfssl/wolfcrypt/mpi_class.h @@ -2,14 +2,14 @@ * * Copyright (C) 2006-2014 wolfSSL Inc. * - * This file is part of CyaSSL. + * This file is part of wolfSSL. (formerly known as CyaSSL) * - * CyaSSL is free software; you can redistribute it and/or modify + * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * CyaSSL is distributed in the hope that it will be useful, + * wolfSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. diff --git a/wolfssl/wolfcrypt/mpi_superclass.h b/wolfssl/wolfcrypt/mpi_superclass.h index 06a05f542..a86eb0e2c 100644 --- a/wolfssl/wolfcrypt/mpi_superclass.h +++ b/wolfssl/wolfcrypt/mpi_superclass.h @@ -2,14 +2,14 @@ * * Copyright (C) 2006-2014 wolfSSL Inc. * - * This file is part of CyaSSL. + * This file is part of wolfSSL. (formerly known as CyaSSL) * - * CyaSSL is free software; you can redistribute it and/or modify + * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * CyaSSL is distributed in the hope that it will be useful, + * wolfSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 474a17f26..2046e6ec6 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -2,14 +2,14 @@ * * Copyright (C) 2006-2014 wolfSSL Inc. * - * This file is part of CyaSSL. + * This file is part of wolfSSL. (formerly known as CyaSSL) * - * CyaSSL is free software; you can redistribute it and/or modify + * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * CyaSSL is distributed in the hope that it will be useful, + * wolfSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 45d763c7c..1177ff034 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -2,7 +2,7 @@ * * Copyright (C) 2006-2014 wolfSSL Inc. * - * This file is part of wolfSSL. + * This file is part of wolfSSL. (formerly known as CyaSSL) * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,8 +26,7 @@ /* fips compatibility @wc_fips */ #ifdef HAVE_FIPS #include -#define wolfSSL_Mutex CyaSSL_Mutex - + #define wolfSSL_Mutex CyaSSL_Mutex #else #ifdef __cplusplus @@ -35,7 +34,7 @@ #endif -#ifdef USE_WINDOWS_API +#ifdef USE_WINDOWS_API #ifdef WOLFSSL_GAME_BUILD #include "system/xtl.h" #else @@ -67,7 +66,7 @@ #include #endif #elif defined(WOLFSSL_CMSIS_RTOS) - #include "cmsis_os.h" + #include "cmsis_os.h" #elif defined(WOLFSSL_TIRTOS) #include #include