clean up comments on c files and fix duplicate in chacah header

This commit is contained in:
Jacob Barthelmeh
2015-01-04 23:26:26 -07:00
parent e6ebbf4fc2
commit 966ca9c97e
7 changed files with 37 additions and 47 deletions

View File

@ -116,7 +116,7 @@ int wc_Arc4InitCavium(Arc4* arc4, int devId)
arc4->devId = devId;
arc4->magic = WOLFSSL_ARC4_CAVIUM_MAGIC;
return 0;
}

View File

@ -53,13 +53,13 @@
#include "ntru_crypto.h"
#endif
//#if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384)
// #include <wolfssl/wolfcrypt/sha512.h>
//#endif
#if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384)
#include <wolfssl/wolfcrypt/sha512.h>
#endif
//#ifndef NO_SHA256
// #include <wolfssl/wolfcrypt/sha256.h>
//#endif
#ifndef NO_SHA256
#include <wolfssl/wolfcrypt/sha256.h>
#endif
#ifdef HAVE_ECC
#include <wolfssl/wolfcrypt/ecc.h>
@ -87,7 +87,7 @@
#endif
#ifdef HAVE_RTP_SYS
#ifdef HAVE_RTP_SYS
/* uses parital <time.h> structures */
#define XTIME(tl) (0)
#define XGMTIME(c) my_gmtime((c))
@ -185,7 +185,7 @@ time_t time(time_t* timer)
GetSystemTime(&sysTime);
SystemTimeToFileTime(&sysTime, &fTime);
XMEMCPY(&intTime, &fTime, sizeof(FILETIME));
/* subtract EPOCH */
intTime.QuadPart -= 0x19db1ded53e8000;
@ -250,7 +250,7 @@ struct tm* gmtime(const time_t* timer)
#endif /* _WIN32_WCE || USER_TIME */
#ifdef HAVE_RTP_SYS
#ifdef HAVE_RTP_SYS
#define YEAR0 1900
@ -293,7 +293,7 @@ time_t pic32_time(time_t* timer)
if (timer == NULL)
timer = &localTime;
#ifdef MICROCHIP_MPLAB_HARMONY
#ifdef MICROCHIP_MPLAB_HARMONY
sec = TCPIP_SNTP_UTCSecondsGet();
#else
sec = SNTPGetUTCSeconds();

View File

@ -17,13 +17,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*
* based from
* chacha-ref.c version 20080118
* D. J. Bernstein
* Public domain.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -98,7 +98,7 @@ int wc_Chacha_SetIV(ChaCha* ctx, const byte* inIv, word32 counter)
ctx->X[13] = temp[0]; /* fixed variable from nonce */
ctx->X[14] = temp[1]; /* counter from nonce */
ctx->X[15] = temp[2]; /* counter from nonce */
return 0;
}
@ -138,7 +138,7 @@ int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz)
for (i = 0; i < keySz; i++) {
printf("%02x", key[i]);
if ((i + 1) % 8 == 0)
printf("\n");
printf("\n");
}
printf("\n\n");
#endif

View File

@ -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.
@ -106,7 +106,7 @@ int Base64_Decode(const byte* in, word32 inLen, byte* out, word32* outLen)
out[i++] = b3;
else
break;
inLen -= 4;
if (inLen && (in[j] == ' ' || in[j] == '\r' || in[j] == '\n')) {
byte endLine = in[j++];

View File

@ -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.
@ -41,18 +41,18 @@
#endif
#ifdef DEBUG_CYASSL
#ifdef DEBUG_WOLFSSL
/* Set these to default values initially. */
static wolfSSL_Logging_cb log_function = 0;
static int loggingEnabled = 0;
#endif /* DEBUG_CYASSL */
#endif /* DEBUG_WOLFSSL */
int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb f)
{
#ifdef DEBUG_CYASSL
#ifdef DEBUG_WOLFSSL
int res = 0;
if (f)
@ -70,7 +70,7 @@ int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb f)
int wolfSSL_Debugging_ON(void)
{
#ifdef DEBUG_CYASSL
#ifdef DEBUG_WOLFSSL
loggingEnabled = 1;
return 0;
#else
@ -81,13 +81,13 @@ int wolfSSL_Debugging_ON(void)
void wolfSSL_Debugging_OFF(void)
{
#ifdef DEBUG_CYASSL
#ifdef DEBUG_WOLFSSL
loggingEnabled = 0;
#endif
}
#ifdef DEBUG_CYASSL
#ifdef DEBUG_WOLFSSL
#ifdef FREESCALE_MQX
#include <fio.h>
@ -99,7 +99,7 @@ void wolfSSL_Debugging_OFF(void)
int dc_log_printf(char*, ...);
#endif
static void cyassl_log(const int logLevel, const char *const logMessage)
static void wolfssl_log(const int logLevel, const char *const logMessage)
{
if (log_function)
log_function(logLevel, logMessage);
@ -111,7 +111,7 @@ static void cyassl_log(const int logLevel, const char *const logMessage)
#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
NetSecure_TraceOut((CPU_CHAR *)logMessage);
#endif
#elif defined(CYASSL_MDK_ARM)
#elif defined(WOLFSSL_MDK_ARM)
fflush(stdout) ;
printf("%s\n", logMessage);
fflush(stdout) ;
@ -126,7 +126,7 @@ static void cyassl_log(const int logLevel, const char *const logMessage)
void WOLFSSL_MSG(const char* msg)
{
if (loggingEnabled)
cyassl_log(INFO_LOG , msg);
wolfssl_log(INFO_LOG , msg);
}
@ -135,7 +135,7 @@ void WOLFSSL_ENTER(const char* msg)
if (loggingEnabled) {
char buffer[80];
sprintf(buffer, "wolfSSL Entering %s", msg);
cyassl_log(ENTER_LOG , buffer);
wolfssl_log(ENTER_LOG , buffer);
}
}
@ -145,7 +145,7 @@ void WOLFSSL_LEAVE(const char* msg, int ret)
if (loggingEnabled) {
char buffer[80];
sprintf(buffer, "wolfSSL Leaving %s, return %d", msg, ret);
cyassl_log(LEAVE_LOG , buffer);
wolfssl_log(LEAVE_LOG , buffer);
}
}
@ -155,8 +155,8 @@ void WOLFSSL_ERROR(int error)
if (loggingEnabled) {
char buffer[80];
sprintf(buffer, "wolfSSL error occured, error = %d", error);
cyassl_log(ERROR_LOG , buffer);
wolfssl_log(ERROR_LOG , buffer);
}
}
#endif /* DEBUG_WOLFSSL */
#endif /* DEBUG_WOLFSSL */

View File

@ -1,4 +1,4 @@
/* memory.c
/* memory.c
*
* Copyright (C) 2006-2014 wolfSSL Inc.
*

View File

@ -37,12 +37,8 @@ typedef struct ChaCha {
word32 X[16]; /* state of cipher */
} ChaCha;
WOLFSSL_API int wc_Chacha_Process(ChaCha* ctx, byte* cipher, const byte* plain,
word32 msglen);
WOLFSSL_API int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz);
/**
* IV(nonce) changes with each record
* IV(nonce) changes with each record
* counter is for what value the block counter should start ... usually 0
*/
WOLFSSL_API int wc_Chacha_SetIV(ChaCha* ctx, const byte* inIv, word32 counter);
@ -51,12 +47,6 @@ WOLFSSL_API int wc_Chacha_Process(ChaCha* ctx, byte* cipher, const byte* plain,
word32 msglen);
WOLFSSL_API int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz);
/**
* IV(nonce) changes with each record
* counter is for what value the block counter should start ... usually 0
*/
WOLFSSL_API int wc_Chacha_SetIV(ChaCha* ctx, const byte* inIv, word32 counter);
#ifdef __cplusplus
} /* extern "C" */
#endif