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->devId = devId;
arc4->magic = WOLFSSL_ARC4_CAVIUM_MAGIC; arc4->magic = WOLFSSL_ARC4_CAVIUM_MAGIC;
return 0; return 0;
} }

View File

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

View File

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

View File

@@ -2,14 +2,14 @@
* *
* Copyright (C) 2006-2014 wolfSSL Inc. * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (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 * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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; out[i++] = b3;
else else
break; break;
inLen -= 4; inLen -= 4;
if (inLen && (in[j] == ' ' || in[j] == '\r' || in[j] == '\n')) { if (inLen && (in[j] == ' ' || in[j] == '\r' || in[j] == '\n')) {
byte endLine = in[j++]; byte endLine = in[j++];

View File

@@ -2,14 +2,14 @@
* *
* Copyright (C) 2006-2014 wolfSSL Inc. * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (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 * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
@@ -41,18 +41,18 @@
#endif #endif
#ifdef DEBUG_CYASSL #ifdef DEBUG_WOLFSSL
/* Set these to default values initially. */ /* Set these to default values initially. */
static wolfSSL_Logging_cb log_function = 0; static wolfSSL_Logging_cb log_function = 0;
static int loggingEnabled = 0; static int loggingEnabled = 0;
#endif /* DEBUG_CYASSL */ #endif /* DEBUG_WOLFSSL */
int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb f) int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb f)
{ {
#ifdef DEBUG_CYASSL #ifdef DEBUG_WOLFSSL
int res = 0; int res = 0;
if (f) if (f)
@@ -70,7 +70,7 @@ int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb f)
int wolfSSL_Debugging_ON(void) int wolfSSL_Debugging_ON(void)
{ {
#ifdef DEBUG_CYASSL #ifdef DEBUG_WOLFSSL
loggingEnabled = 1; loggingEnabled = 1;
return 0; return 0;
#else #else
@@ -81,13 +81,13 @@ int wolfSSL_Debugging_ON(void)
void wolfSSL_Debugging_OFF(void) void wolfSSL_Debugging_OFF(void)
{ {
#ifdef DEBUG_CYASSL #ifdef DEBUG_WOLFSSL
loggingEnabled = 0; loggingEnabled = 0;
#endif #endif
} }
#ifdef DEBUG_CYASSL #ifdef DEBUG_WOLFSSL
#ifdef FREESCALE_MQX #ifdef FREESCALE_MQX
#include <fio.h> #include <fio.h>
@@ -99,7 +99,7 @@ void wolfSSL_Debugging_OFF(void)
int dc_log_printf(char*, ...); int dc_log_printf(char*, ...);
#endif #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) if (log_function)
log_function(logLevel, logMessage); 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) #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
NetSecure_TraceOut((CPU_CHAR *)logMessage); NetSecure_TraceOut((CPU_CHAR *)logMessage);
#endif #endif
#elif defined(CYASSL_MDK_ARM) #elif defined(WOLFSSL_MDK_ARM)
fflush(stdout) ; fflush(stdout) ;
printf("%s\n", logMessage); printf("%s\n", logMessage);
fflush(stdout) ; fflush(stdout) ;
@@ -126,7 +126,7 @@ static void cyassl_log(const int logLevel, const char *const logMessage)
void WOLFSSL_MSG(const char* msg) void WOLFSSL_MSG(const char* msg)
{ {
if (loggingEnabled) if (loggingEnabled)
cyassl_log(INFO_LOG , msg); wolfssl_log(INFO_LOG , msg);
} }
@@ -135,7 +135,7 @@ void WOLFSSL_ENTER(const char* msg)
if (loggingEnabled) { if (loggingEnabled) {
char buffer[80]; char buffer[80];
sprintf(buffer, "wolfSSL Entering %s", msg); 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) { if (loggingEnabled) {
char buffer[80]; char buffer[80];
sprintf(buffer, "wolfSSL Leaving %s, return %d", msg, ret); 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) { if (loggingEnabled) {
char buffer[80]; char buffer[80];
sprintf(buffer, "wolfSSL error occured, error = %d", error); 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. * Copyright (C) 2006-2014 wolfSSL Inc.
* *

View File

@@ -37,12 +37,8 @@ typedef struct ChaCha {
word32 X[16]; /* state of cipher */ word32 X[16]; /* state of cipher */
} ChaCha; } 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 * 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); 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); word32 msglen);
WOLFSSL_API int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz); 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 #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif