mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
Spelling fixes in comments and error strings (ALGO_ID_E, ASN_TIME_E and WOLFSSL_ERROR function).
This commit is contained in:
@@ -18,7 +18,7 @@ NTRU suites available do not use ephemeral keys, WOLFSSL_STATIC_RSA needs to be
|
||||
used in order to build with NTRU suites.
|
||||
|
||||
|
||||
When compiling ssl.c wolfSSL will now issue a comipler error if no cipher suites
|
||||
When compiling ssl.c wolfSSL will now issue a compiler error if no cipher suites
|
||||
are available. You can remove this error by defining WOLFSSL_ALLOW_NO_SUITES
|
||||
in the event that you desire that, i.e., you're not using TLS cipher suites.
|
||||
```
|
||||
|
@@ -45,7 +45,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Initialze CRL members */
|
||||
/* Initialize CRL members */
|
||||
int InitCRL(WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm)
|
||||
{
|
||||
WOLFSSL_ENTER("InitCRL");
|
||||
@@ -72,7 +72,7 @@ int InitCRL(WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm)
|
||||
}
|
||||
|
||||
|
||||
/* Initialze CRL Entry */
|
||||
/* Initialize CRL Entry */
|
||||
static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl)
|
||||
{
|
||||
WOLFSSL_ENTER("InitCRL_Entry");
|
||||
|
@@ -438,7 +438,7 @@ static INLINE void ato32(const byte* c, word32* u32)
|
||||
}
|
||||
|
||||
|
||||
/* decompress in to out, returnn out size or error */
|
||||
/* decompress in to out, return out size or error */
|
||||
static int myDeCompress(WOLFSSL* ssl, byte* in,int inSz, byte* out,int outSz)
|
||||
{
|
||||
int err;
|
||||
@@ -466,7 +466,7 @@ void InitSSL_Method(WOLFSSL_METHOD* method, ProtocolVersion pv)
|
||||
}
|
||||
|
||||
|
||||
/* Initialze SSL context, return 0 on success */
|
||||
/* Initialize SSL context, return 0 on success */
|
||||
int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method)
|
||||
{
|
||||
XMEMSET(ctx, 0, sizeof(WOLFSSL_CTX));
|
||||
@@ -1849,7 +1849,7 @@ int SetSSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
|
||||
|
||||
|
||||
/* init everything to 0, NULL, default values before calling anything that may
|
||||
fail so that desctructor has a "good" state to cleanup
|
||||
fail so that destructor has a "good" state to cleanup
|
||||
0 on success */
|
||||
int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
|
||||
{
|
||||
@@ -6049,7 +6049,7 @@ static int Poly1305TagOld(WOLFSSL* ssl, byte* additional, const byte* out,
|
||||
int ret = 0;
|
||||
int msglen = (sz - ssl->specs.aead_mac_size);
|
||||
word32 keySz = 32;
|
||||
byte padding[8]; /* used to temporarly store lengths */
|
||||
byte padding[8]; /* used to temporarily store lengths */
|
||||
|
||||
#ifdef CHACHA_AEAD_TEST
|
||||
printf("Using old version of poly1305 input.\n");
|
||||
@@ -7665,7 +7665,7 @@ int SendChangeCipher(WOLFSSL* ssl)
|
||||
if ((ret = CheckAvailableSize(ssl, sendSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -8077,7 +8077,7 @@ int SendFinished(WOLFSSL* ssl)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -8234,7 +8234,7 @@ int SendCertificate(WOLFSSL* ssl)
|
||||
if ((ret = CheckAvailableSize(ssl, sendSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -8404,7 +8404,7 @@ int SendCertificateRequest(WOLFSSL* ssl)
|
||||
if ((ret = CheckAvailableSize(ssl, sendSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -8950,7 +8950,7 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
|
||||
if ((ret = CheckAvailableSize(ssl, outputSz)) != 0)
|
||||
return ssl->error = ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
out = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -9082,7 +9082,7 @@ int SendAlert(WOLFSSL* ssl, int severity, int type)
|
||||
int outputSz;
|
||||
int dtlsExtra = 0;
|
||||
|
||||
/* if sendalert is called again for nonbloking */
|
||||
/* if sendalert is called again for nonblocking */
|
||||
if (ssl->options.sendAlertState != 0) {
|
||||
ret = SendBuffered(ssl);
|
||||
if (ret == 0)
|
||||
@@ -9100,7 +9100,7 @@ int SendAlert(WOLFSSL* ssl, int severity, int type)
|
||||
if ((ret = CheckAvailableSize(ssl, outputSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -10671,7 +10671,7 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
|
||||
if ((ret = CheckAvailableSize(ssl, sendSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -10867,7 +10867,7 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
|
||||
|
||||
#ifdef HAVE_SESSION_TICKET
|
||||
/* server may send blank ticket which may not be expected to indicate
|
||||
* exisiting one ok but will also be sending a new one */
|
||||
* existing one ok but will also be sending a new one */
|
||||
ret = ret || (ssl->session.ticketLen > 0);
|
||||
#endif
|
||||
|
||||
@@ -12890,7 +12890,7 @@ static word32 QSH_KeyExchangeWrite(WOLFSSL* ssl, byte isServer)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -13037,7 +13037,7 @@ static word32 QSH_KeyExchangeWrite(WOLFSSL* ssl, byte isServer)
|
||||
if ((ret = CheckAvailableSize(ssl, sendSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -13463,7 +13463,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
||||
if ((ret = CheckAvailableSize(ssl, MAX_HELLO_SZ)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -13647,7 +13647,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -13796,7 +13796,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -14041,7 +14041,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
||||
goto done_a;
|
||||
}
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -14679,7 +14679,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -16082,7 +16082,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
||||
if ((ret = CheckAvailableSize(ssl, sendSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -16282,7 +16282,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
||||
if ((ret = CheckAvailableSize(ssl, sendSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
@@ -16324,7 +16324,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
||||
if ((ret = CheckAvailableSize(ssl, sendSz)) != 0)
|
||||
return ret;
|
||||
|
||||
/* get ouput buffer */
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
|
||||
|
@@ -76,8 +76,8 @@ enum {
|
||||
ETHER_IF_ADDR_LEN = 6, /* ethernet interface address length */
|
||||
LOCAL_IF_ADDR_LEN = 4, /* localhost interface address length, !windows */
|
||||
TCP_PROTO = 6, /* TCP_PROTOCOL */
|
||||
IP_HDR_SZ = 20, /* IP header legnth, min */
|
||||
TCP_HDR_SZ = 20, /* TCP header legnth, min */
|
||||
IP_HDR_SZ = 20, /* IP header length, min */
|
||||
TCP_HDR_SZ = 20, /* TCP header length, min */
|
||||
IPV4 = 4, /* IP version 4 */
|
||||
TCP_PROTOCOL = 6, /* TCP Protocol id */
|
||||
TRACE_MSG_SZ = 80, /* Trace Message buffer size */
|
||||
@@ -630,7 +630,7 @@ typedef struct TcpPseudoHdr {
|
||||
word32 dst; /* destination address */
|
||||
byte rsv; /* reserved, always 0 */
|
||||
byte protocol; /* IP protocol */
|
||||
word16 legnth; /* tcp header length + data length (doesn't include */
|
||||
word16 length; /* tcp header length + data length (doesn't include */
|
||||
/* pseudo header length) network order */
|
||||
} TcpPseudoHdr;
|
||||
|
||||
@@ -868,7 +868,7 @@ static void TraceAddedData(int newBytes, int existingBytes)
|
||||
{
|
||||
if (TraceOn) {
|
||||
fprintf(TraceFile,
|
||||
"\t%d bytes added to %d exisiting bytes in User Buffer\n",
|
||||
"\t%d bytes added to %d existing bytes in User Buffer\n",
|
||||
newBytes, existingBytes);
|
||||
}
|
||||
}
|
||||
@@ -2238,7 +2238,7 @@ int TcpChecksum(IpInfo* ipInfo, TcpInfo* tcpInfo, int dataLen,
|
||||
pseudo.dst = ipInfo->dst;
|
||||
pseudo.rsv = 0;
|
||||
pseudo.protocol = TCP_PROTO;
|
||||
pseudo.legnth = htons(tcpInfo->length + dataLen);
|
||||
pseudo.length = htons(tcpInfo->length + dataLen);
|
||||
|
||||
/* pseudo header sum */
|
||||
while (count >= 2) {
|
||||
@@ -2322,7 +2322,7 @@ static int CheckSession(IpInfo* ipInfo, TcpInfo* tcpInfo, int sslBytes,
|
||||
*session = CreateSession(ipInfo, tcpInfo, error);
|
||||
if (*session == NULL) {
|
||||
*session = GetSnifferSession(ipInfo, tcpInfo);
|
||||
/* already had exisiting, so OK */
|
||||
/* already had existing, so OK */
|
||||
if (*session)
|
||||
return 1;
|
||||
|
||||
@@ -2837,7 +2837,7 @@ static int CheckPreRecord(IpInfo* ipInfo, TcpInfo* tcpInfo,
|
||||
}
|
||||
|
||||
/* if current partial data, add to end of partial */
|
||||
/* if skipping, the data is alread at the end of partial */
|
||||
/* if skipping, the data is already at the end of partial */
|
||||
if ( !skipPartial &&
|
||||
(length = ssl->buffers.inputBuffer.length) ) {
|
||||
Trace(PARTIAL_ADD_STR);
|
||||
@@ -2955,7 +2955,7 @@ static int ProcessMessage(const byte* sslFrame, SnifferSession* session,
|
||||
{
|
||||
const byte* sslBegin = sslFrame;
|
||||
const byte* recordEnd; /* end of record indicator */
|
||||
const byte* inRecordEnd; /* indictor from input stream not decrypt */
|
||||
const byte* inRecordEnd; /* indicator from input stream not decrypt */
|
||||
RecordLayerHeader rh;
|
||||
int rhSize = 0;
|
||||
int ret;
|
||||
|
52
src/ssl.c
52
src/ssl.c
@@ -266,7 +266,7 @@ int wolfSSL_set_fd(WOLFSSL* ssl, int fd)
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of cipher at priotity level passed in.
|
||||
* Get the name of cipher at priority level passed in.
|
||||
*/
|
||||
char* wolfSSL_get_cipher_list(int priority)
|
||||
{
|
||||
@@ -292,7 +292,7 @@ int wolfSSL_get_ciphers(char* buf, int len)
|
||||
if (buf == NULL || len <= 0)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
/* Add each member to the buffer delimitted by a : */
|
||||
/* Add each member to the buffer delimited by a : */
|
||||
for (i = 0; i < size; i++) {
|
||||
step = (int)(XSTRLEN(ciphers[i]) + 1); /* delimiter */
|
||||
totalInc += step;
|
||||
@@ -954,7 +954,7 @@ int wolfSSL_UseSupportedQSH(WOLFSSL* ssl, word16 name)
|
||||
#endif /* HAVE_QSH */
|
||||
|
||||
|
||||
/* Application-Layer Procotol Negotiation */
|
||||
/* Application-Layer Protocol Negotiation */
|
||||
#ifdef HAVE_ALPN
|
||||
|
||||
int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
|
||||
@@ -1320,7 +1320,7 @@ int wolfSSL_shutdown(WOLFSSL* ssl)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* call wolfSSL_shutdown again for bidirectional shudown */
|
||||
/* call wolfSSL_shutdown again for bidirectional shutdown */
|
||||
if (ssl->options.sentNotify && !ssl->options.closeNotify) {
|
||||
ret = wolfSSL_read(ssl, &tmp, 0);
|
||||
if (ret < 0) {
|
||||
@@ -2800,7 +2800,7 @@ int PemToDer(const unsigned char* buff, long longSz, int type,
|
||||
}
|
||||
|
||||
|
||||
/* process the buffer buff, legnth sz, into ctx of format and type
|
||||
/* process the buffer buff, length sz, into ctx of format and type
|
||||
used tracks bytes consumed, userChain specifies a user cert chain
|
||||
to pass during the handshake */
|
||||
static int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
|
||||
@@ -3360,7 +3360,7 @@ int wolfSSL_CertManagerDisableCRL(WOLFSSL_CERT_MANAGER* cm)
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
/* Verify the ceritficate, SSL_SUCCESS for ok, < 0 for error */
|
||||
/* Verify the certificate, SSL_SUCCESS for ok, < 0 for error */
|
||||
int wolfSSL_CertManagerVerifyBuffer(WOLFSSL_CERT_MANAGER* cm, const byte* buff,
|
||||
long sz, int format)
|
||||
{
|
||||
@@ -3889,7 +3889,7 @@ int wolfSSL_CTX_load_verify_locations(WOLFSSL_CTX* ctx, const char* file,
|
||||
}
|
||||
|
||||
|
||||
/* Verify the ceritficate, SSL_SUCCESS for ok, < 0 for error */
|
||||
/* Verify the certificate, SSL_SUCCESS for ok, < 0 for error */
|
||||
int wolfSSL_CertManagerVerify(WOLFSSL_CERT_MANAGER* cm, const char* fname,
|
||||
int format)
|
||||
{
|
||||
@@ -4396,7 +4396,7 @@ long wolfSSL_CTX_get_verify_depth(WOLFSSL_CTX* ctx)
|
||||
|
||||
int wolfSSL_CTX_use_certificate_chain_file(WOLFSSL_CTX* ctx, const char* file)
|
||||
{
|
||||
/* procces up to MAX_CHAIN_DEPTH plus subject cert */
|
||||
/* process up to MAX_CHAIN_DEPTH plus subject cert */
|
||||
WOLFSSL_ENTER("wolfSSL_CTX_use_certificate_chain_file");
|
||||
if (ProcessFile(ctx, file, SSL_FILETYPE_PEM,CERT_TYPE,NULL,1, NULL)
|
||||
== SSL_SUCCESS)
|
||||
@@ -4508,7 +4508,7 @@ int wolfSSL_use_PrivateKey_file(WOLFSSL* ssl, const char* file, int format)
|
||||
|
||||
int wolfSSL_use_certificate_chain_file(WOLFSSL* ssl, const char* file)
|
||||
{
|
||||
/* procces up to MAX_CHAIN_DEPTH plus subject cert */
|
||||
/* process up to MAX_CHAIN_DEPTH plus subject cert */
|
||||
WOLFSSL_ENTER("wolfSSL_use_certificate_chain_file");
|
||||
if (ProcessFile(ssl->ctx, file, SSL_FILETYPE_PEM, CERT_TYPE,
|
||||
ssl, 1, NULL) == SSL_SUCCESS)
|
||||
@@ -4595,7 +4595,7 @@ void wolfSSL_CTX_set_verify(WOLFSSL_CTX* ctx, int mode, VerifyCallback vc)
|
||||
WOLFSSL_ENTER("wolfSSL_CTX_set_verify");
|
||||
if (mode & SSL_VERIFY_PEER) {
|
||||
ctx->verifyPeer = 1;
|
||||
ctx->verifyNone = 0; /* in case perviously set */
|
||||
ctx->verifyNone = 0; /* in case previously set */
|
||||
}
|
||||
|
||||
if (mode == SSL_VERIFY_NONE) {
|
||||
@@ -4615,7 +4615,7 @@ void wolfSSL_set_verify(WOLFSSL* ssl, int mode, VerifyCallback vc)
|
||||
WOLFSSL_ENTER("wolfSSL_set_verify");
|
||||
if (mode & SSL_VERIFY_PEER) {
|
||||
ssl->options.verifyPeer = 1;
|
||||
ssl->options.verifyNone = 0; /* in case perviously set */
|
||||
ssl->options.verifyNone = 0; /* in case previously set */
|
||||
}
|
||||
|
||||
if (mode == SSL_VERIFY_NONE) {
|
||||
@@ -4776,7 +4776,7 @@ int wolfSSL_SetServerID(WOLFSSL* ssl, const byte* id, int len, int newSession)
|
||||
|
||||
#if defined(PERSIST_SESSION_CACHE)
|
||||
|
||||
/* for persistance, if changes to layout need to increment and modify
|
||||
/* for persistence, if changes to layout need to increment and modify
|
||||
save_session_cache() and restore_session_cache and memory versions too */
|
||||
#define WOLFSSL_CACHE_VERSION 2
|
||||
|
||||
@@ -4857,7 +4857,7 @@ int wolfSSL_memsave_session_cache(void* mem, int sz)
|
||||
}
|
||||
|
||||
|
||||
/* Restore the persistant session cache from memory */
|
||||
/* Restore the persistent session cache from memory */
|
||||
int wolfSSL_memrestore_session_cache(const void* mem, int sz)
|
||||
{
|
||||
int i;
|
||||
@@ -4974,7 +4974,7 @@ int wolfSSL_save_session_cache(const char *fname)
|
||||
}
|
||||
|
||||
|
||||
/* Restore the persistant session cache from file */
|
||||
/* Restore the persistent session cache from file */
|
||||
/* doesn't use memstore because of additional memory use */
|
||||
int wolfSSL_restore_session_cache(const char *fname)
|
||||
{
|
||||
@@ -5117,7 +5117,7 @@ typedef struct {
|
||||
int signerSz; /* sizeof Signer object */
|
||||
} CertCacheHeader;
|
||||
|
||||
/* current cert persistance layout is:
|
||||
/* current cert persistence layout is:
|
||||
|
||||
1) CertCacheHeader
|
||||
2) caTable
|
||||
@@ -6331,7 +6331,7 @@ int wolfSSL_Cleanup(void)
|
||||
#ifndef NO_SESSION_CACHE
|
||||
|
||||
|
||||
/* some session IDs aren't random afterall, let's make them random */
|
||||
/* some session IDs aren't random after all, let's make them random */
|
||||
static INLINE word32 HashSession(const byte* sessionID, word32 len, int* error)
|
||||
{
|
||||
byte digest[MAX_DIGEST_SIZE];
|
||||
@@ -6352,7 +6352,7 @@ static INLINE word32 HashSession(const byte* sessionID, word32 len, int* error)
|
||||
|
||||
void wolfSSL_flush_sessions(WOLFSSL_CTX* ctx, long tm)
|
||||
{
|
||||
/* static table now, no flusing needed */
|
||||
/* static table now, no flushing needed */
|
||||
(void)ctx;
|
||||
(void)tm;
|
||||
}
|
||||
@@ -6968,7 +6968,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
||||
|
||||
typedef struct itimerval Itimerval;
|
||||
|
||||
/* don't keep calling simple functions while setting up timer and singals
|
||||
/* don't keep calling simple functions while setting up timer and signals
|
||||
if no inlining these are the next best */
|
||||
|
||||
#define AddTimes(a, b, c) \
|
||||
@@ -14060,7 +14060,7 @@ int wolfSSL_PEM_write_mem_RSAPrivateKey(RSA* rsa, const EVP_CIPHER* cipher,
|
||||
}
|
||||
}
|
||||
|
||||
/* 5 > size of n, d, p, q, d%(p-1), d(q-1), 1/q%p, e + ASN.1 additionnal
|
||||
/* 5 > size of n, d, p, q, d%(p-1), d(q-1), 1/q%p, e + ASN.1 additional
|
||||
* informations
|
||||
*/
|
||||
der_max_len = 5 * wolfSSL_RSA_size(rsa) + AES_BLOCK_SIZE;
|
||||
@@ -15443,7 +15443,7 @@ int wolfSSL_PEM_write_mem_ECPrivateKey(WOLFSSL_EC_KEY* ecc,
|
||||
}
|
||||
}
|
||||
|
||||
/* 4 > size of pub, priv + ASN.1 additionnal informations
|
||||
/* 4 > size of pub, priv + ASN.1 additional informations
|
||||
*/
|
||||
der_max_len = 4 * wc_ecc_size((ecc_key*)ecc->internal) + AES_BLOCK_SIZE;
|
||||
|
||||
@@ -15618,7 +15618,7 @@ int wolfSSL_PEM_write_mem_DSAPrivateKey(WOLFSSL_DSA* dsa,
|
||||
}
|
||||
}
|
||||
|
||||
/* 4 > size of pub, priv, p, q, g + ASN.1 additionnal informations
|
||||
/* 4 > size of pub, priv, p, q, g + ASN.1 additional informations
|
||||
*/
|
||||
der_max_len = 4 * wolfSSL_BN_num_bytes(dsa->g) + AES_BLOCK_SIZE;
|
||||
|
||||
@@ -15959,7 +15959,7 @@ int wolfSSL_get_chain_count(WOLFSSL_X509_CHAIN* chain)
|
||||
}
|
||||
|
||||
|
||||
/* Get peer's ASN.1 DER ceritifcate at index (idx) length in bytes */
|
||||
/* Get peer's ASN.1 DER certificate at index (idx) length in bytes */
|
||||
int wolfSSL_get_chain_length(WOLFSSL_X509_CHAIN* chain, int idx)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_get_chain_length");
|
||||
@@ -15970,7 +15970,7 @@ int wolfSSL_get_chain_length(WOLFSSL_X509_CHAIN* chain, int idx)
|
||||
}
|
||||
|
||||
|
||||
/* Get peer's ASN.1 DER ceritifcate at index (idx) */
|
||||
/* Get peer's ASN.1 DER certificate at index (idx) */
|
||||
byte* wolfSSL_get_chain_cert(WOLFSSL_X509_CHAIN* chain, int idx)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_get_chain_cert");
|
||||
@@ -15981,7 +15981,7 @@ byte* wolfSSL_get_chain_cert(WOLFSSL_X509_CHAIN* chain, int idx)
|
||||
}
|
||||
|
||||
|
||||
/* Get peer's wolfSSL X509 ceritifcate at index (idx) */
|
||||
/* Get peer's wolfSSL X509 certificate at index (idx) */
|
||||
WOLFSSL_X509* wolfSSL_get_chain_X509(WOLFSSL_X509_CHAIN* chain, int idx)
|
||||
{
|
||||
int ret;
|
||||
@@ -16033,7 +16033,7 @@ WOLFSSL_X509* wolfSSL_get_chain_X509(WOLFSSL_X509_CHAIN* chain, int idx)
|
||||
}
|
||||
|
||||
|
||||
/* Get peer's PEM ceritifcate at index (idx), output to buffer if inLen big
|
||||
/* Get peer's PEM certificate at index (idx), output to buffer if inLen big
|
||||
enough else return error (-1). If buffer is NULL only calculate
|
||||
outLen. Output length is in *outLen SSL_SUCCESS on ok */
|
||||
int wolfSSL_get_chain_cert_pem(WOLFSSL_X509_CHAIN* chain, int idx,
|
||||
@@ -16622,7 +16622,7 @@ long wolfSSL_CTX_set_tmp_dh(WOLFSSL_CTX* ctx, WOLFSSL_DH* dh)
|
||||
#endif /* HAVE_LIGHTY || HAVE_STUNNEL */
|
||||
|
||||
|
||||
/* stunnel compatability functions*/
|
||||
/* stunnel compatibility functions*/
|
||||
#if defined(OPENSSL_EXTRA) && defined(HAVE_STUNNEL)
|
||||
void WOLFSSL_ERR_remove_thread_state(void* pid)
|
||||
{
|
||||
|
20
src/tls.c
20
src/tls.c
@@ -870,7 +870,7 @@ static ALPN* TLSX_ALPN_New(char *protocol_name, word16 protocol_nameSz)
|
||||
}
|
||||
|
||||
alpn->next = NULL;
|
||||
alpn->negociated = 0;
|
||||
alpn->negotiated = 0;
|
||||
alpn->options = 0;
|
||||
|
||||
alpn->protocol_name = XMALLOC(protocol_nameSz + 1, 0, DYNAMIC_TYPE_TLSX);
|
||||
@@ -982,7 +982,7 @@ static int TLSX_SetALPN(TLSX** extensions, const void* data, word16 size)
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
alpn->negociated = 1;
|
||||
alpn->negotiated = 1;
|
||||
|
||||
ret = TLSX_Push(extensions, TLSX_APPLICATION_LAYER_PROTOCOL, (void*)alpn);
|
||||
if (ret != 0) {
|
||||
@@ -1080,7 +1080,7 @@ static int TLSX_ALPN_ParseAndSet(WOLFSSL *ssl, byte *input, word16 length,
|
||||
return UNKNOWN_ALPN_PROTOCOL_NAME_E;
|
||||
}
|
||||
|
||||
/* set the matching negociated protocol */
|
||||
/* set the matching negotiated protocol */
|
||||
r = TLSX_SetALPN(&ssl->extensions,
|
||||
alpn->protocol_name,
|
||||
(word16)XSTRLEN(alpn->protocol_name));
|
||||
@@ -1159,7 +1159,7 @@ int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
|
||||
return SSL_FATAL_ERROR;
|
||||
}
|
||||
|
||||
if (alpn->negociated != 1) {
|
||||
if (alpn->negotiated != 1) {
|
||||
|
||||
/* consider as an error */
|
||||
if (alpn->options & WOLFSSL_ALPN_FAILED_ON_MISMATCH) {
|
||||
@@ -1167,7 +1167,7 @@ int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
|
||||
return SSL_FATAL_ERROR;
|
||||
}
|
||||
|
||||
/* continue without negociated protocol */
|
||||
/* continue without negotiated protocol */
|
||||
WOLFSSL_MSG("No protocol match with peer -> Continue");
|
||||
return SSL_ALPN_NOT_FOUND;
|
||||
}
|
||||
@@ -2421,7 +2421,7 @@ static int TLSX_CSR2_Parse(WOLFSSL* ssl, byte* input, word16 length,
|
||||
break;
|
||||
|
||||
default:
|
||||
/* unkown status type, skipping! */
|
||||
/* unknown status type, skipping! */
|
||||
offset += request_length;
|
||||
continue;
|
||||
}
|
||||
@@ -2740,8 +2740,8 @@ int TLSX_ValidateEllipticCurves(WOLFSSL* ssl, byte first, byte second) {
|
||||
: NULL;
|
||||
EllipticCurve* curve = NULL;
|
||||
word32 oid = 0;
|
||||
word16 octets = 0; /* acording to 'ecc_set_type ecc_sets[];' */
|
||||
int sig = 0; /* valitade signature */
|
||||
word16 octets = 0; /* according to 'ecc_set_type ecc_sets[];' */
|
||||
int sig = 0; /* validate signature */
|
||||
int key = 0; /* validate key */
|
||||
|
||||
(void)oid;
|
||||
@@ -3452,7 +3452,7 @@ static int TLSX_QSH_Parse(WOLFSSL* ssl, byte* input, word16 length,
|
||||
if (isRequest) {
|
||||
ato16(input, &schemSz);
|
||||
|
||||
/* list of public keys avialable for QSH schemes */
|
||||
/* list of public keys available for QSH schemes */
|
||||
offset_len = schemSz + OPAQUE16_LEN;
|
||||
}
|
||||
|
||||
@@ -3655,7 +3655,7 @@ int TLSX_QSHCipher_Parse(WOLFSSL* ssl, const byte* input, word16 length,
|
||||
if (secret == NULL)
|
||||
continue;
|
||||
|
||||
/* find coresponding key */
|
||||
/* find corresponding key */
|
||||
key = ssl->QSH_Key;
|
||||
while (key) {
|
||||
if (key->name == name)
|
||||
|
@@ -1382,7 +1382,7 @@ void bench_rsaKeyGen(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / genTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("\n");
|
||||
printf("RSA 1024 key generation %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, genTimes);
|
||||
@@ -1398,7 +1398,7 @@ void bench_rsaKeyGen(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / genTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("RSA 2048 key generation %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, genTimes);
|
||||
}
|
||||
@@ -1655,7 +1655,7 @@ void bench_eccKeyGen(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / genTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("\n");
|
||||
printf("ECC 256 key generation %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, genTimes);
|
||||
@@ -1700,7 +1700,7 @@ void bench_eccKeyAgree(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / agreeTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("EC-DHE key agreement %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, agreeTimes);
|
||||
|
||||
@@ -1722,7 +1722,7 @@ void bench_eccKeyAgree(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / agreeTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("EC-DSA sign time %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, agreeTimes);
|
||||
|
||||
@@ -1739,7 +1739,7 @@ void bench_eccKeyAgree(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / agreeTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("EC-DSA verify time %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, agreeTimes);
|
||||
|
||||
@@ -1765,7 +1765,7 @@ void bench_curve25519KeyGen(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / genTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("\n");
|
||||
printf("CURVE25519 256 key generation %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, genTimes);
|
||||
@@ -1808,7 +1808,7 @@ void bench_curve25519KeyAgree(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / agreeTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("CURVE25519 key agreement %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, agreeTimes);
|
||||
|
||||
@@ -1835,7 +1835,7 @@ void bench_ed25519KeyGen(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / genTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("\n");
|
||||
printf("ED25519 key generation %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, genTimes);
|
||||
@@ -1876,7 +1876,7 @@ void bench_ed25519KeySign(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / agreeTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("ED25519 sign time %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, agreeTimes);
|
||||
|
||||
@@ -1894,7 +1894,7 @@ void bench_ed25519KeySign(void)
|
||||
|
||||
total = current_time(0) - start;
|
||||
each = total / agreeTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
printf("ED25519 verify time %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, agreeTimes);
|
||||
|
||||
|
@@ -139,7 +139,7 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
byte* authTag, word32 authTagSz,
|
||||
const byte* authIn, word32 authInSz)
|
||||
{
|
||||
/* sanity check on arugments */
|
||||
/* sanity check on arguments */
|
||||
if (aes == NULL || out == NULL || in == NULL || nonce == NULL
|
||||
|| authTag == NULL || nonceSz < 7 || nonceSz > 13)
|
||||
return BAD_FUNC_ARG;
|
||||
@@ -2544,7 +2544,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
out+= odd ;
|
||||
sz -= odd ;
|
||||
}
|
||||
odd = sz % AES_BLOCK_SIZE ; /* if there is tail flagment */
|
||||
odd = sz % AES_BLOCK_SIZE ; /* if there is tail fragment */
|
||||
if(sz / AES_BLOCK_SIZE) {
|
||||
even = (sz/AES_BLOCK_SIZE)*AES_BLOCK_SIZE ;
|
||||
wc_AesCrypt(aes, out, in, even, PIC32_ENCRYPTION, PIC32_ALGO_AES,
|
||||
@@ -2611,7 +2611,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
aes->left = 0;
|
||||
}
|
||||
|
||||
/* handle non block size remaining and sotre unused byte count in left */
|
||||
/* handle non block size remaining and store unused byte count in left */
|
||||
if (sz) {
|
||||
wc_AesEncrypt(aes, (byte*)aes->reg, (byte*)aes->tmp);
|
||||
IncrementAesCounter((byte*)aes->reg);
|
||||
@@ -3183,7 +3183,7 @@ static int AES_GCM_decrypt(const unsigned char *in,
|
||||
out[k*16+j]=((unsigned char*)&last_block)[j];
|
||||
}
|
||||
|
||||
return 1; /* when sucessful returns 1 */
|
||||
return 1; /* when successful returns 1 */
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_AESNI */
|
||||
@@ -3976,7 +3976,7 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
byte mask = 0xFF;
|
||||
word32 wordSz = (word32)sizeof(word32);
|
||||
|
||||
/* sanity check on arugments */
|
||||
/* sanity check on arguments */
|
||||
if (aes == NULL || out == NULL || in == NULL || nonce == NULL
|
||||
|| authTag == NULL || nonceSz < 7 || nonceSz > 13)
|
||||
return BAD_FUNC_ARG;
|
||||
@@ -4044,7 +4044,7 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
byte mask = 0xFF;
|
||||
word32 wordSz = (word32)sizeof(word32);
|
||||
|
||||
/* sanity check on arugments */
|
||||
/* sanity check on arguments */
|
||||
if (aes == NULL || out == NULL || in == NULL || nonce == NULL
|
||||
|| authTag == NULL || nonceSz < 7 || nonceSz > 13)
|
||||
return BAD_FUNC_ARG;
|
||||
@@ -4127,7 +4127,7 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze Aes for use with Nitrox device */
|
||||
/* Initialize Aes for use with Nitrox device */
|
||||
int wc_AesInitCavium(Aes* aes, int devId)
|
||||
{
|
||||
if (aes == NULL)
|
||||
|
@@ -105,7 +105,7 @@ void wc_Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length)
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze Arc4 for use with Nitrox device */
|
||||
/* Initialize Arc4 for use with Nitrox device */
|
||||
int wc_Arc4InitCavium(Arc4* arc4, int devId)
|
||||
{
|
||||
if (arc4 == NULL)
|
||||
|
@@ -570,7 +570,7 @@ WOLFSSL_LOCAL int GetSet(const byte* input, word32* inOutIdx, int* len,
|
||||
}
|
||||
|
||||
|
||||
/* winodws header clash for WinCE using GetVersion */
|
||||
/* Windows header clash for WinCE using GetVersion */
|
||||
WOLFSSL_LOCAL int GetMyVersion(const byte* input, word32* inOutIdx,
|
||||
int* version)
|
||||
{
|
||||
@@ -1392,7 +1392,7 @@ static int CheckAlgoV2(int oid, int* id)
|
||||
}
|
||||
|
||||
|
||||
/* Decrypt intput in place from parameters based on id */
|
||||
/* Decrypt input in place from parameters based on id */
|
||||
static int DecryptKey(const char* password, int passwordSz, byte* salt,
|
||||
int saltSz, int iterations, int id, byte* input,
|
||||
int length, int version, byte* cbcIv)
|
||||
@@ -1585,7 +1585,7 @@ int ToTraditionalEnc(byte* input, word32 sz,const char* password,int passwordSz)
|
||||
if (GetAlgoId(input, &inOutIdx, &oid, sigType, sz) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
first = input[inOutIdx - 2]; /* PKCS version alwyas 2nd to last byte */
|
||||
first = input[inOutIdx - 2]; /* PKCS version always 2nd to last byte */
|
||||
second = input[inOutIdx - 1]; /* version.algo, algo id last byte */
|
||||
|
||||
if (CheckAlgo(first, second, &id, &version) < 0)
|
||||
@@ -2292,7 +2292,7 @@ static int StoreRsaKey(DecodedCert* cert)
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
|
||||
/* return 0 on sucess if the ECC curve oid sum is supported */
|
||||
/* return 0 on success if the ECC curve oid sum is supported */
|
||||
static int CheckCurve(word32 oid)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -3525,7 +3525,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
WOLFSSL_MSG("Verify Signautre has unsupported type");
|
||||
WOLFSSL_MSG("Verify Signature has unsupported type");
|
||||
}
|
||||
|
||||
if (typeH == 0) {
|
||||
@@ -3575,7 +3575,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
#endif
|
||||
|
||||
if (sigSz > MAX_ENCODED_SIG_SZ) {
|
||||
WOLFSSL_MSG("Verify Signautre is too big");
|
||||
WOLFSSL_MSG("Verify Signature is too big");
|
||||
}
|
||||
else if (wc_InitRsaKey(pubKey, heap) != 0) {
|
||||
WOLFSSL_MSG("InitRsaKey failed");
|
||||
@@ -4838,7 +4838,7 @@ static int DecodeCertExtensions(DecodedCert* cert)
|
||||
default:
|
||||
/* While it is a failure to not support critical extensions,
|
||||
* still parse the certificate ignoring the unsupported
|
||||
* extention to allow caller to accept it with the verify
|
||||
* extension to allow caller to accept it with the verify
|
||||
* callback. */
|
||||
if (critical)
|
||||
criticalFail = 1;
|
||||
@@ -5678,7 +5678,7 @@ int wc_RsaKeyToPublicDer(RsaKey* key, byte* output, word32 inLen)
|
||||
#endif /* WOLFSSL_HAVE_MIN */
|
||||
|
||||
|
||||
/* Initialize and Set Certficate defaults:
|
||||
/* Initialize and Set Certificate defaults:
|
||||
version = 3 (0x2)
|
||||
serial = 0
|
||||
sigType = SHA_WITH_RSA
|
||||
@@ -5777,7 +5777,7 @@ typedef struct DerCert {
|
||||
int sizeSz; /* encoded size length */
|
||||
int versionSz; /* encoded version length */
|
||||
int serialSz; /* encoded serial length */
|
||||
int sigAlgoSz; /* enocded sig alog length */
|
||||
int sigAlgoSz; /* encoded sig alog length */
|
||||
int issuerSz; /* encoded issuer length */
|
||||
int subjectSz; /* encoded subject length */
|
||||
int validitySz; /* encoded validity length */
|
||||
@@ -6527,7 +6527,7 @@ static int SetCertificatePolicies(byte *output,
|
||||
der_oidSz[i] = (word32)ret;
|
||||
}
|
||||
|
||||
/* concatene oid, keep two byte for sequence/size of the created value */
|
||||
/* concatenate oid, keep two byte for sequence/size of the created value */
|
||||
for (i = 0, outSz = 2; i < nb_certpol; i++) {
|
||||
XMEMCPY(out+outSz, der_oid[i], der_oidSz[i]);
|
||||
outSz += der_oidSz[i];
|
||||
@@ -7815,7 +7815,7 @@ int wc_SetAuthKeyId(Cert *cert, const char* file)
|
||||
|
||||
#endif /* NO_FILESYSTEM */
|
||||
|
||||
/* Set KeyUsage from human readale string */
|
||||
/* Set KeyUsage from human readable string */
|
||||
int wc_SetKeyUsage(Cert *cert, const char *value)
|
||||
{
|
||||
char *token, *str, *ptr;
|
||||
@@ -8266,7 +8266,7 @@ int StoreECC_DSA_Sig(byte* out, word32* outLen, mp_int* r, mp_int* s)
|
||||
}
|
||||
|
||||
|
||||
/* Der Decode ECC-DSA Signautre, r & s stored as big ints */
|
||||
/* Der Decode ECC-DSA Signature, r & s stored as big ints */
|
||||
int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen, mp_int* r, mp_int* s)
|
||||
{
|
||||
word32 idx = 0;
|
||||
|
@@ -403,7 +403,7 @@ int main( int argc, char **argv )
|
||||
|
||||
/* wolfCrypt API */
|
||||
|
||||
/* Init Blake2b digest, track size incase final doesn't want to "remember" */
|
||||
/* Init Blake2b digest, track size in case final doesn't want to "remember" */
|
||||
int wc_InitBlake2b(Blake2b* b2b, word32 digestSz)
|
||||
{
|
||||
b2b->digestSz = digestSz;
|
||||
|
@@ -510,7 +510,7 @@ static int camellia_setup128(const unsigned char *key, u32 *subkey)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* k == kll || klr || krl || krr (|| is concatination)
|
||||
* k == kll || klr || krl || krr (|| is concatenation)
|
||||
*/
|
||||
kll = GETU32(key );
|
||||
klr = GETU32(key + 4);
|
||||
@@ -744,7 +744,7 @@ static int camellia_setup256(const unsigned char *key, u32 *subkey)
|
||||
|
||||
/**
|
||||
* key = (kll || klr || krl || krr || krll || krlr || krrl || krrr)
|
||||
* (|| is concatination)
|
||||
* (|| is concatenation)
|
||||
*/
|
||||
|
||||
kll = GETU32(key );
|
||||
@@ -1138,7 +1138,7 @@ static void camellia_encrypt128(const u32 *subkey, u32 *io)
|
||||
|
||||
static void camellia_decrypt128(const u32 *subkey, u32 *io)
|
||||
{
|
||||
u32 il,ir,t0,t1; /* temporary valiables */
|
||||
u32 il,ir,t0,t1; /* temporary variables */
|
||||
|
||||
/* pre whitening but absorb kw2*/
|
||||
io[0] ^= CamelliaSubkeyL(24);
|
||||
@@ -1231,7 +1231,7 @@ static void camellia_decrypt128(const u32 *subkey, u32 *io)
|
||||
*/
|
||||
static void camellia_encrypt256(const u32 *subkey, u32 *io)
|
||||
{
|
||||
u32 il,ir,t0,t1; /* temporary valiables */
|
||||
u32 il,ir,t0,t1; /* temporary variables */
|
||||
|
||||
/* pre whitening but absorb kw2*/
|
||||
io[0] ^= CamelliaSubkeyL(0);
|
||||
@@ -1345,7 +1345,7 @@ static void camellia_encrypt256(const u32 *subkey, u32 *io)
|
||||
|
||||
static void camellia_decrypt256(const u32 *subkey, u32 *io)
|
||||
{
|
||||
u32 il,ir,t0,t1; /* temporary valiables */
|
||||
u32 il,ir,t0,t1; /* temporary variables */
|
||||
|
||||
/* pre whitening but absorb kw2*/
|
||||
io[0] ^= CamelliaSubkeyL(32);
|
||||
|
@@ -332,7 +332,7 @@ int Base64_Encode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
||||
}
|
||||
|
||||
|
||||
/* Base64 Encode, with %0A esacped line endings instead of \n */
|
||||
/* Base64 Encode, with %0A escaped line endings instead of \n */
|
||||
int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out, word32* outLen)
|
||||
{
|
||||
return DoBase64_Encode(in, inLen, out, outLen, WC_ESC_NL_ENC);
|
||||
|
@@ -99,7 +99,7 @@ int wc_Des3_SetIV(Des3* des, const byte* iv)
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
/* Initiliaze Des3 for use with Nitrox device */
|
||||
/* Initialize Des3 for use with Nitrox device */
|
||||
int wc_Des3_InitCavium(Des3* des3, int devId)
|
||||
{
|
||||
return Des3_InitCavium(des3, devId);
|
||||
@@ -1511,7 +1511,7 @@ int wc_Des3_SetIV(Des3* des, const byte* iv)
|
||||
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze Des3 for use with Nitrox device */
|
||||
/* Initialize Des3 for use with Nitrox device */
|
||||
int wc_Des3_InitCavium(Des3* des3, int devId)
|
||||
{
|
||||
if (des3 == NULL)
|
||||
|
@@ -1053,7 +1053,7 @@ int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R, mp_int* modulus,
|
||||
}
|
||||
}
|
||||
|
||||
/* make a copy of G incase R==G */
|
||||
/* make a copy of G in case R==G */
|
||||
tG = wc_ecc_new_point();
|
||||
if (tG == NULL)
|
||||
err = MEMORY_E;
|
||||
@@ -1154,7 +1154,7 @@ int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R, mp_int* modulus,
|
||||
}
|
||||
if (err != MP_OKAY) break; /* out of first for(;;) */
|
||||
|
||||
/* then add, bitbuf will be 8..15 [8..2^WINSIZE] guaranted */
|
||||
/* then add, bitbuf will be 8..15 [8..2^WINSIZE] guaranteed */
|
||||
err = ecc_projective_add_point(R,M[bitbuf-8],R,modulus,&mp);
|
||||
}
|
||||
if (err != MP_OKAY) break;
|
||||
@@ -1267,7 +1267,7 @@ int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R, mp_int* modulus,
|
||||
}
|
||||
}
|
||||
|
||||
/* make a copy of G incase R==G */
|
||||
/* make a copy of G in case R==G */
|
||||
tG = wc_ecc_new_point();
|
||||
if (tG == NULL)
|
||||
err = MEMORY_E;
|
||||
@@ -1463,7 +1463,7 @@ int wc_ecc_copy_point(ecc_point* p, ecc_point *r)
|
||||
|
||||
/** Compare the value of a point with an other one
|
||||
a The point to compare
|
||||
b The othe point to compare
|
||||
b The other point to compare
|
||||
|
||||
return MP_EQ if equal, MP_LT/MP_GT if not, < 0 in case of error
|
||||
*/
|
||||
@@ -2714,7 +2714,7 @@ int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen,
|
||||
}
|
||||
|
||||
|
||||
/* is ec point on curve descriped by dp ? */
|
||||
/* is ec point on curve described by dp ? */
|
||||
static int ecc_is_point(const ecc_set_type* dp, ecc_point* ecp, mp_int* prime)
|
||||
{
|
||||
mp_int b, t1, t2;
|
||||
@@ -2885,7 +2885,7 @@ int wc_ecc_check_key(ecc_key* key)
|
||||
if (key == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
/* pubkey point cannot be at inifinity */
|
||||
/* pubkey point cannot be at infinity */
|
||||
if (wc_ecc_point_is_at_infinity(&key->pubkey))
|
||||
return ECC_INF_E;
|
||||
|
||||
@@ -4876,7 +4876,7 @@ static void ecc_ctx_init(ecEncCtx* ctx, int flags)
|
||||
}
|
||||
|
||||
|
||||
/* allow ecc context reset so user doesn't have to init/free for resue */
|
||||
/* allow ecc context reset so user doesn't have to init/free for reuse */
|
||||
int wc_ecc_ctx_reset(ecEncCtx* ctx, WC_RNG* rng)
|
||||
{
|
||||
if (ctx == NULL || rng == NULL)
|
||||
|
@@ -110,7 +110,7 @@ const char* wc_GetErrorString(int error)
|
||||
return "Buffer error, output too small or input too big";
|
||||
|
||||
case ALGO_ID_E :
|
||||
return "Setting Cert AlogID error";
|
||||
return "Setting Cert AlgoID error";
|
||||
|
||||
case PUBLIC_KEY_E :
|
||||
return "Setting Cert Public Key error";
|
||||
@@ -170,7 +170,7 @@ const char* wc_GetErrorString(int error)
|
||||
return "ASN signature error, mismatched oid";
|
||||
|
||||
case ASN_TIME_E :
|
||||
return "ASN time error, unkown time type";
|
||||
return "ASN time error, unknown time type";
|
||||
|
||||
case ASN_INPUT_E :
|
||||
return "ASN input error, not enough data";
|
||||
|
@@ -212,7 +212,7 @@ static int prime_msb(const byte *p)
|
||||
|
||||
/*
|
||||
Test for any hot bits.
|
||||
As soon as one instance is incountered set shift to 0.
|
||||
As soon as one instance is encountered set shift to 0.
|
||||
*/
|
||||
for (i = F25519_SIZE - 1; i >= 0; i--) {
|
||||
shift &= ((shift ^ ((-p[i] | p[i]) >> 7)) & 1);
|
||||
|
@@ -484,7 +484,7 @@ void ge_tobytes(unsigned char *s,const ge_p2 *h)
|
||||
|
||||
|
||||
/*
|
||||
Test if the public key can be uncommpressed and negate it (-X,Y,Z,-T)
|
||||
Test if the public key can be uncompressed and negate it (-X,Y,Z,-T)
|
||||
return 0 on success
|
||||
*/
|
||||
int ge_frombytes_negate_vartime(ge_p3 *p,const unsigned char *s)
|
||||
|
@@ -90,7 +90,7 @@ int wc_Hash(enum wc_HashType hash_type, const byte* data,
|
||||
return BUFFER_E;
|
||||
}
|
||||
|
||||
/* Supress possible unused arg if all hashing is disabled */
|
||||
/* Suppress possible unused arg if all hashing is disabled */
|
||||
(void)data;
|
||||
(void)data_len;
|
||||
(void)hash;
|
||||
|
@@ -607,7 +607,7 @@ int wc_HmacFinal(Hmac* hmac, byte* hash)
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
/* Initiliaze Hmac for use with Nitrox device */
|
||||
/* Initialize Hmac for use with Nitrox device */
|
||||
int wc_HmacInitCavium(Hmac* hmac, int devId)
|
||||
{
|
||||
if (hmac == NULL)
|
||||
|
@@ -176,7 +176,7 @@ int wc_IdeaSetKey(Idea *idea, const byte* key, word16 keySz,
|
||||
return wc_IdeaSetIV(idea, iv);
|
||||
}
|
||||
|
||||
/* set the IV in the Idea key structuve */
|
||||
/* set the IV in the Idea key structure */
|
||||
int wc_IdeaSetIV(Idea *idea, const byte* iv)
|
||||
{
|
||||
if (idea == NULL)
|
||||
|
@@ -436,7 +436,7 @@ void mp_zero (mp_int * a)
|
||||
/* trim unused digits
|
||||
*
|
||||
* This is used to ensure that leading zero digits are
|
||||
* trimed and the leading "used" digit will be non-zero
|
||||
* trimmed and the leading "used" digit will be non-zero
|
||||
* Typically very fast. Also fixes the sign if there
|
||||
* are no more leading digits
|
||||
*/
|
||||
@@ -720,7 +720,7 @@ int mp_lshd (mp_int * a, int b)
|
||||
bottom = a->dp + a->used - 1 - b;
|
||||
|
||||
/* much like mp_rshd this is implemented using a sliding window
|
||||
* except the window goes the otherway around. Copying from
|
||||
* except the window goes the other way around. Copying from
|
||||
* the bottom to the top. see bn_mp_rshd.c for more info.
|
||||
*/
|
||||
for (x = a->used - 1; x >= b; x--) {
|
||||
@@ -739,7 +739,7 @@ int mp_lshd (mp_int * a, int b)
|
||||
|
||||
/* this is a shell function that calls either the normal or Montgomery
|
||||
* exptmod functions. Originally the call to the montgomery code was
|
||||
* embedded in the normal function but that wasted alot of stack space
|
||||
* embedded in the normal function but that wasted a lot of stack space
|
||||
* for nothing (since 99% of the time the Montgomery code would be called)
|
||||
*/
|
||||
int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
||||
@@ -1184,7 +1184,7 @@ LBL_ERR:mp_clear(&x);
|
||||
}
|
||||
|
||||
|
||||
/* compare maginitude of two ints (unsigned) */
|
||||
/* compare magnitude of two ints (unsigned) */
|
||||
int mp_cmp_mag (mp_int * a, mp_int * b)
|
||||
{
|
||||
int n;
|
||||
@@ -1541,7 +1541,7 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
||||
/* add carry */
|
||||
*tmpc++ = u;
|
||||
|
||||
/* clear digits above oldused */
|
||||
/* clear digits above olduse */
|
||||
for (i = c->used; i < olduse; i++) {
|
||||
*tmpc++ = 0;
|
||||
}
|
||||
@@ -2245,7 +2245,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
*tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK));
|
||||
}
|
||||
|
||||
/* zero oldused digits, if the input a was larger than
|
||||
/* zero olduse digits, if the input a was larger than
|
||||
* m->used+1 we'll have to clear the digits
|
||||
*/
|
||||
for (; ix < olduse; ix++) {
|
||||
@@ -2526,7 +2526,7 @@ mp_set_bit (mp_int * a, int b)
|
||||
int i = b / DIGIT_BIT, res;
|
||||
|
||||
if (a->used < (int)(i + 1)) {
|
||||
/* grow a to accomodate the single bit */
|
||||
/* grow a to accommodate the single bit */
|
||||
if ((res = mp_grow (a, i + 1)) != MP_OKAY) {
|
||||
return res;
|
||||
}
|
||||
@@ -2543,7 +2543,7 @@ mp_set_bit (mp_int * a, int b)
|
||||
|
||||
/* computes a = 2**b
|
||||
*
|
||||
* Simple algorithm which zeroes the int, set the required bit
|
||||
* Simple algorithm which zeros the int, set the required bit
|
||||
*/
|
||||
int
|
||||
mp_2expt (mp_int * a, int b)
|
||||
@@ -2698,7 +2698,7 @@ int mp_mul_2(mp_int * a, mp_int * b)
|
||||
{
|
||||
int x, res, oldused;
|
||||
|
||||
/* grow to accomodate result */
|
||||
/* grow to accommodate result */
|
||||
if (b->alloc < a->used + 1) {
|
||||
if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) {
|
||||
return res;
|
||||
@@ -2898,7 +2898,7 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b)
|
||||
tmpx = a->dp + tx;
|
||||
tmpy = a->dp + ty;
|
||||
|
||||
/* this is the number of times the loop will iterrate, essentially
|
||||
/* this is the number of times the loop will iterate, essentially
|
||||
while (tx++ < a->used && ty-- >= 0) { ... }
|
||||
*/
|
||||
iy = MIN(a->used-tx, ty+1);
|
||||
@@ -3014,7 +3014,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
tmpx = a->dp + tx;
|
||||
tmpy = b->dp + ty;
|
||||
|
||||
/* this is the number of times the loop will iterrate, essentially
|
||||
/* this is the number of times the loop will iterate, essentially
|
||||
while (tx++ < a->used && ty-- >= 0) { ... }
|
||||
*/
|
||||
iy = MIN(a->used-tx, ty+1);
|
||||
@@ -3123,7 +3123,7 @@ int s_mp_sqr (mp_int * a, mp_int * b)
|
||||
}
|
||||
|
||||
|
||||
/* multiplies |a| * |b| and only computes upto digs digits of result
|
||||
/* multiplies |a| * |b| and only computes up to digs digits of result
|
||||
* HAC pp. 595, Algorithm 14.12 Modified so you can control how
|
||||
* many digits of output are created.
|
||||
*/
|
||||
@@ -3196,8 +3196,8 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
/*
|
||||
* shifts with subtractions when the result is greater than b.
|
||||
*
|
||||
* The method is slightly modified to shift B unconditionally upto just under
|
||||
* the leading bit of b. This saves alot of multiple precision shifting.
|
||||
* The method is slightly modified to shift B unconditionally up to just under
|
||||
* the leading bit of b. This saves a lot of multiple precision shifting.
|
||||
*/
|
||||
int mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
|
||||
{
|
||||
@@ -3467,7 +3467,7 @@ LBL_M:
|
||||
|
||||
|
||||
/* pre-calculate the value required for Barrett reduction
|
||||
* For a given modulus "b" it calulates the value required in "a"
|
||||
* For a given modulus "b" it calculates the value required in "a"
|
||||
*/
|
||||
int mp_reduce_setup (mp_int * a, mp_int * b)
|
||||
{
|
||||
@@ -3738,7 +3738,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
tmpx = a->dp + tx;
|
||||
tmpy = b->dp + ty;
|
||||
|
||||
/* this is the number of times the loop will iterrate, essentially its
|
||||
/* this is the number of times the loop will iterate, essentially its
|
||||
while (tx++ < a->used && ty-- >= 0) { ... }
|
||||
*/
|
||||
iy = MIN(a->used-tx, ty+1);
|
||||
@@ -4727,7 +4727,7 @@ int mp_toradix (mp_int *a, char *str, int radix)
|
||||
}
|
||||
|
||||
/* reverse the digits of the string. In this case _s points
|
||||
* to the first digit [exluding the sign] of the number]
|
||||
* to the first digit [excluding the sign] of the number]
|
||||
*/
|
||||
bn_reverse ((unsigned char *)_s, digs);
|
||||
|
||||
|
@@ -198,7 +198,7 @@ void WOLFSSL_ERROR(int error)
|
||||
{
|
||||
if (loggingEnabled) {
|
||||
char buffer[80];
|
||||
sprintf(buffer, "wolfSSL error occured, error = %d", error);
|
||||
sprintf(buffer, "wolfSSL error occurred, error = %d", error);
|
||||
wolfssl_log(ERROR_LOG , buffer);
|
||||
}
|
||||
}
|
||||
|
@@ -930,7 +930,7 @@ int wc_PKCS7_VerifySignedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz)
|
||||
}
|
||||
|
||||
|
||||
/* create ASN.1 fomatted RecipientInfo structure, returns sequence size */
|
||||
/* create ASN.1 formatted RecipientInfo structure, returns sequence size */
|
||||
WOLFSSL_LOCAL int wc_CreateRecipientInfo(const byte* cert, word32 certSz,
|
||||
int keyEncAlgo, int blockKeySz,
|
||||
WC_RNG* rng, byte* contentKeyPlain,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include <wolfssl/wolfcrypt/random.h>
|
||||
|
||||
#if defined(CUSTOM_RAND_GENERATE) && !defined(CUSTOM_RAND_TYPE)
|
||||
/* To maintain compatiblity the default return vaule from CUSTOM_RAND_GENERATE is byte */
|
||||
/* To maintain compatibility the default return value from CUSTOM_RAND_GENERATE is byte */
|
||||
#define CUSTOM_RAND_TYPE byte
|
||||
#endif
|
||||
|
||||
@@ -782,7 +782,7 @@ int wc_FreeRng(WC_RNG* rng)
|
||||
#include <wolfssl/ctaocrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze RNG for use with Nitrox device */
|
||||
/* Initialize RNG for use with Nitrox device */
|
||||
int wc_InitRngCavium(WC_RNG* rng, int devId)
|
||||
{
|
||||
if (rng == NULL)
|
||||
|
@@ -156,7 +156,7 @@ enum {
|
||||
RSA_MIN_SIZE = 512,
|
||||
RSA_MAX_SIZE = 4096,
|
||||
|
||||
RSA_MIN_PAD_SZ = 11 /* seperator + 0 + pad value + 8 pads */
|
||||
RSA_MIN_PAD_SZ = 11 /* separator + 0 + pad value + 8 pads */
|
||||
};
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ static int wc_MGF(int type, byte* seed, word32 seedSz,
|
||||
ret = BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* in case of default avoid unused warrning */
|
||||
/* in case of default avoid unused warning */
|
||||
(void)seed;
|
||||
(void)seedSz;
|
||||
(void)out;
|
||||
@@ -416,7 +416,7 @@ static int wc_RsaPad_OAEP(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* concatinate lHash || PS || 0x01 || msg */
|
||||
/* concatenate lHash || PS || 0x01 || msg */
|
||||
idx = pkcsBlockLen - 1 - inputLen;
|
||||
psLen = pkcsBlockLen - inputLen - 2 * hLen - 2;
|
||||
if (pkcsBlockLen < inputLen) { /*make sure not writing over end of buffer */
|
||||
@@ -427,7 +427,7 @@ static int wc_RsaPad_OAEP(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
return BUFFER_E;
|
||||
}
|
||||
XMEMCPY(pkcsBlock + (pkcsBlockLen - inputLen), input, inputLen);
|
||||
pkcsBlock[idx--] = 0x01; /* PS and M seperator */
|
||||
pkcsBlock[idx--] = 0x01; /* PS and M separator */
|
||||
while (psLen > 0 && idx > 0) {
|
||||
pkcsBlock[idx--] = 0x00;
|
||||
psLen--;
|
||||
@@ -566,7 +566,7 @@ static int wc_RsaPad_ex(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
ret = RSA_PAD_E;
|
||||
}
|
||||
|
||||
/* silence warrning if not used with padding scheme */
|
||||
/* silence warning if not used with padding scheme */
|
||||
(void)padType;
|
||||
(void)hType;
|
||||
(void)mgf;
|
||||
@@ -619,7 +619,7 @@ static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* get DB vaule by doing maskedDB xor dbMask */
|
||||
/* get DB value by doing maskedDB xor dbMask */
|
||||
for (idx = 0; idx < (pkcsBlockLen - hLen - 1); idx++) {
|
||||
pkcsBlock[hLen + 1 + idx] = pkcsBlock[hLen + 1 + idx] ^ tmp[idx + hLen];
|
||||
}
|
||||
@@ -627,7 +627,7 @@ static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
/* done with use of tmp buffer */
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
/* advance idx to index of PS and msg seperator */
|
||||
/* advance idx to index of PS and msg separator */
|
||||
idx = hLen + 2 + hLen;
|
||||
while (idx < pkcsBlockLen && pkcsBlock[idx] == 0) {idx++;}
|
||||
|
||||
@@ -637,14 +637,14 @@ static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
}
|
||||
|
||||
/* say no to chosen ciphertext attack.
|
||||
Comparision of lHash, Y, and seperator value needs to all happen in
|
||||
Comparison of lHash, Y, and separator value needs to all happen in
|
||||
constant time.
|
||||
Attackers should not be able to get error condition from the timing of
|
||||
these checks.
|
||||
*/
|
||||
ret = 0;
|
||||
ret |= ConstantCompare(pkcsBlock + hLen + 1, h, hLen);
|
||||
ret += pkcsBlock[idx++] ^ 0x01; /* seperator value is 0x01 */
|
||||
ret += pkcsBlock[idx++] ^ 0x01; /* separator value is 0x01 */
|
||||
ret += pkcsBlock[0] ^ 0x00; /* Y, the first value, should be 0 */
|
||||
|
||||
if (ret != 0) {
|
||||
@@ -727,7 +727,7 @@ static int wc_RsaUnPad_ex(byte* pkcsBlock, word32 pkcsBlockLen, byte** out,
|
||||
ret = RSA_PAD_E;
|
||||
}
|
||||
|
||||
/* silence warrning if not used with padding scheme */
|
||||
/* silence warning if not used with padding scheme */
|
||||
(void)padType;
|
||||
(void)hType;
|
||||
(void)mgf;
|
||||
@@ -865,12 +865,12 @@ int wc_RsaPublicEncrypt(const byte* in, word32 inLen, byte* out, word32 outLen,
|
||||
|
||||
|
||||
#ifndef WC_NO_RSA_OAEP
|
||||
/* Gives the option of chossing padding type
|
||||
/* Gives the option of choosing padding type
|
||||
in : input to be encrypted
|
||||
inLen: length of input buffer
|
||||
out: encrypted output
|
||||
outLen: length of encrypted output buffer
|
||||
key : wolfSSL initialised RSA key struct
|
||||
key : wolfSSL initialized RSA key struct
|
||||
rng : wolfSSL initialized random number struct
|
||||
type : type of padding to use ie WC_RSA_OAEP_PAD
|
||||
hash : type of hash algorithm to use found in wolfssl/wolfcrypt/hash.h
|
||||
@@ -932,11 +932,11 @@ int wc_RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out, RsaKey* key)
|
||||
|
||||
|
||||
#ifndef WC_NO_RSA_OAEP
|
||||
/* Gives the option of chossing padding type
|
||||
/* Gives the option of choosing padding type
|
||||
in : input to be decrypted
|
||||
inLen: length of input buffer
|
||||
out: pointer to place of decrypted message
|
||||
key : wolfSSL initialised RSA key struct
|
||||
key : wolfSSL initialized RSA key struct
|
||||
type : type of padding to use ie WC_RSA_OAEP_PAD
|
||||
hash : type of hash algorithm to use found in wolfssl/wolfcrypt/hash.h
|
||||
mgf : type of mask generation function to use
|
||||
@@ -1014,12 +1014,12 @@ int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out, word32 outLen,
|
||||
|
||||
|
||||
#ifndef WC_NO_RSA_OAEP
|
||||
/* Gives the option of chossing padding type
|
||||
/* Gives the option of choosing padding type
|
||||
in : input to be decrypted
|
||||
inLen: length of input buffer
|
||||
out: decrypted message
|
||||
outLen: length of decrypted message in bytes
|
||||
key : wolfSSL initialised RSA key struct
|
||||
key : wolfSSL initialized RSA key struct
|
||||
type : type of padding to use ie WC_RSA_OAEP_PAD
|
||||
hash : type of hash algorithm to use found in wolfssl/wolfcrypt/hash.h
|
||||
mgf : type of mask generation function to use
|
||||
@@ -1230,7 +1230,7 @@ int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
|
||||
|
||||
if (err == MP_OKAY)
|
||||
err = mp_gcd(&tmp1, &tmp3, &tmp2); /* tmp2 = gcd(p-1, e) */
|
||||
} while (err == MP_OKAY && mp_cmp_d(&tmp2, 1) != 0); /* e divdes p-1 */
|
||||
} while (err == MP_OKAY && mp_cmp_d(&tmp2, 1) != 0); /* e divides p-1 */
|
||||
}
|
||||
|
||||
/* make q */
|
||||
@@ -1243,7 +1243,7 @@ int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
|
||||
|
||||
if (err == MP_OKAY)
|
||||
err = mp_gcd(&tmp1, &tmp3, &tmp2); /* tmp2 = gcd(q-1, e) */
|
||||
} while (err == MP_OKAY && mp_cmp_d(&tmp2, 1) != 0); /* e divdes q-1 */
|
||||
} while (err == MP_OKAY && mp_cmp_d(&tmp2, 1) != 0); /* e divides q-1 */
|
||||
}
|
||||
|
||||
if (err == MP_OKAY)
|
||||
@@ -1315,7 +1315,7 @@ int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze RSA for use with Nitrox device */
|
||||
/* Initialize RSA for use with Nitrox device */
|
||||
int wc_RsaInitCavium(RsaKey* rsa, int devId)
|
||||
{
|
||||
if (rsa == NULL)
|
||||
|
@@ -49,7 +49,7 @@ int wc_SignatureGetSize(enum wc_SignatureType sig_type,
|
||||
{
|
||||
int sig_len = BAD_FUNC_ARG;
|
||||
|
||||
/* Supress possible unused args if all signature types are disabled */
|
||||
/* Suppress possible unused args if all signature types are disabled */
|
||||
(void)key;
|
||||
(void)key_len;
|
||||
|
||||
@@ -180,7 +180,7 @@ int wc_SignatureGenerate(
|
||||
int ret, hash_len;
|
||||
byte *hash_data = NULL;
|
||||
|
||||
/* Supress possible unused arg if all signature types are disabled */
|
||||
/* Suppress possible unused arg if all signature types are disabled */
|
||||
(void)rng;
|
||||
|
||||
/* Check arguments */
|
||||
|
@@ -605,7 +605,7 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
|
||||
return r;
|
||||
}
|
||||
|
||||
/* building u (random scrambling parameeter) */
|
||||
/* building u (random scrambling parameter) */
|
||||
|
||||
/* H(A) */
|
||||
for (i = 0; !r && i < secretSz - clientPubKeySz; i++)
|
||||
|
@@ -467,7 +467,7 @@ void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C)
|
||||
tmpx = A->dp + tx;
|
||||
tmpy = B->dp + ty;
|
||||
|
||||
/* this is the number of times the loop will iterrate, essentially its
|
||||
/* this is the number of times the loop will iterate, essentially its
|
||||
while (tx++ < a->used && ty-- >= 0) { ... }
|
||||
*/
|
||||
iy = MIN(A->used-tx, ty+1);
|
||||
@@ -1401,7 +1401,7 @@ void fp_sqr_comba(fp_int *A, fp_int *B)
|
||||
tmpx = A->dp + tx;
|
||||
tmpy = A->dp + ty;
|
||||
|
||||
/* this is the number of times the loop will iterrate,
|
||||
/* this is the number of times the loop will iterate,
|
||||
while (tx++ < a->used && ty-- >= 0) { ... }
|
||||
*/
|
||||
iy = MIN(A->used-tx, ty+1);
|
||||
@@ -2010,7 +2010,7 @@ void fp_sub_d(fp_int *a, fp_digit b, fp_int *c)
|
||||
}
|
||||
|
||||
|
||||
/* CyaSSL callers from normal lib */
|
||||
/* wolfSSL callers from normal lib */
|
||||
|
||||
/* init a new mp_int */
|
||||
int mp_init (mp_int * a)
|
||||
@@ -2860,7 +2860,7 @@ int mp_cnt_lsb(fp_int* a)
|
||||
|
||||
#if defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY)
|
||||
|
||||
/* returns size of ASCII reprensentation */
|
||||
/* returns size of ASCII representation */
|
||||
int mp_radix_size (mp_int *a, int radix, int *size)
|
||||
{
|
||||
int res, digs;
|
||||
@@ -2955,7 +2955,7 @@ int mp_toradix (mp_int *a, char *str, int radix)
|
||||
}
|
||||
|
||||
/* reverse the digits of the string. In this case _s points
|
||||
* to the first digit [exluding the sign] of the number]
|
||||
* to the first digit [excluding the sign] of the number]
|
||||
*/
|
||||
fp_reverse ((unsigned char *)_s, digs);
|
||||
|
||||
|
@@ -56,7 +56,7 @@ int wolfCrypt_Init()
|
||||
WOLFSSL_MSG("Attempting to use optimized IPP Library");
|
||||
if ((ret = ippInit()) != ippStsNoErr) {
|
||||
/* possible to get a CPU feature support status on optimized IPP
|
||||
library but still use default library and see competitve speeds */
|
||||
library but still use default library and see competitive speeds */
|
||||
WOLFSSL_MSG("Warning when trying to set up optimization");
|
||||
WOLFSSL_MSG(ippGetStatusString(ret));
|
||||
WOLFSSL_MSG("Using default fast IPP library");
|
||||
@@ -69,7 +69,7 @@ int wolfCrypt_Init()
|
||||
|
||||
|
||||
#if WOLFSSL_CRYPT_HW_MUTEX
|
||||
/* Mutex for protection of cryptograpghy hardware */
|
||||
/* Mutex for protection of cryptography hardware */
|
||||
static wolfSSL_Mutex wcCryptHwMutex;
|
||||
static int wcCryptHwMutexInit = 0;
|
||||
|
||||
|
@@ -2029,8 +2029,8 @@ int chacha_test(void)
|
||||
return -130 - i;
|
||||
}
|
||||
|
||||
/* test of starting at a diffrent counter
|
||||
encrypts all of the information and decrypts starting at 2nd chunck */
|
||||
/* test of starting at a different counter
|
||||
encrypts all of the information and decrypts starting at 2nd chunk */
|
||||
XMEMSET(plain, 0, sizeof(plain));
|
||||
XMEMSET(sliver, 1, sizeof(sliver)); /* set as 1's to not match plain */
|
||||
XMEMSET(cipher, 0, sizeof(cipher));
|
||||
@@ -4122,7 +4122,7 @@ int rsa_test(void)
|
||||
}
|
||||
|
||||
#ifndef NO_SHA
|
||||
/* check fail using missmatch hash algorithms */
|
||||
/* check fail using mismatch hash algorithms */
|
||||
XMEMSET(plain, 0, sizeof(plain));
|
||||
ret = wc_RsaPublicEncrypt_ex(in, inLen, out, sizeof(out), &key, &rng,
|
||||
WC_RSA_OAEP_PAD, WC_HASH_TYPE_SHA, WC_MGF1SHA1, in, sizeof(in));
|
||||
@@ -7123,7 +7123,7 @@ int ed25519_test(void)
|
||||
wc_FreeRng(&rng);
|
||||
#endif
|
||||
|
||||
/* hush warrnings of unused keySz and sigSz */
|
||||
/* hush warnings of unused keySz and sigSz */
|
||||
(void)keySz;
|
||||
(void)sigSz;
|
||||
|
||||
|
@@ -54,7 +54,7 @@ typedef struct timeval Timeval;
|
||||
|
||||
typedef struct packetInfo_st {
|
||||
char packetName[MAX_PACKETNAME_SZ + 1]; /* SSL packet name */
|
||||
Timeval timestamp; /* when it occured */
|
||||
Timeval timestamp; /* when it occurred */
|
||||
unsigned char value[MAX_VALUE_SZ]; /* if fits, it's here */
|
||||
unsigned char* bufferValue; /* otherwise here (non 0) */
|
||||
int valueSz; /* sz of value or buffer */
|
||||
|
@@ -1169,7 +1169,7 @@ struct WOLFSSL_METHOD {
|
||||
};
|
||||
|
||||
|
||||
/* defautls to client */
|
||||
/* defaults to client */
|
||||
WOLFSSL_LOCAL void InitSSL_Method(WOLFSSL_METHOD*, ProtocolVersion);
|
||||
|
||||
/* for sniffer */
|
||||
@@ -1228,7 +1228,7 @@ enum {
|
||||
/* user option to turn off 16K output option */
|
||||
/* if using small static buffers (default) and SSL_write tries to write data
|
||||
larger than the record we have, dynamically get it, unless user says only
|
||||
write in static buffer chuncks */
|
||||
write in static buffer chunks */
|
||||
#ifndef STATIC_CHUNKS_ONLY
|
||||
#define OUTPUT_RECORD_SIZE MAX_RECORD_SIZE
|
||||
#else
|
||||
@@ -1517,10 +1517,10 @@ typedef enum {
|
||||
TLSX_SERVER_NAME = 0x0000, /* a.k.a. SNI */
|
||||
TLSX_MAX_FRAGMENT_LENGTH = 0x0001,
|
||||
TLSX_TRUNCATED_HMAC = 0x0004,
|
||||
TLSX_STATUS_REQUEST = 0x0005, /* a.k.a. OCSP stappling */
|
||||
TLSX_STATUS_REQUEST = 0x0005, /* a.k.a. OCSP stapling */
|
||||
TLSX_SUPPORTED_GROUPS = 0x000a, /* a.k.a. Supported Curves */
|
||||
TLSX_APPLICATION_LAYER_PROTOCOL = 0x0010, /* a.k.a. ALPN */
|
||||
TLSX_STATUS_REQUEST_V2 = 0x0011, /* a.k.a. OCSP stappling v2 */
|
||||
TLSX_STATUS_REQUEST_V2 = 0x0011, /* a.k.a. OCSP stapling v2 */
|
||||
TLSX_QUANTUM_SAFE_HYBRID = 0x0018, /* a.k.a. QSH */
|
||||
TLSX_SESSION_TICKET = 0x0023,
|
||||
TLSX_RENEGOTIATION_INFO = 0xff01
|
||||
@@ -1574,7 +1574,7 @@ typedef struct SNI {
|
||||
union { char* host_name; } data; /* SNI Data */
|
||||
struct SNI* next; /* List Behavior */
|
||||
#ifndef NO_WOLFSSL_SERVER
|
||||
byte options; /* Behaviour options */
|
||||
byte options; /* Behavior options */
|
||||
byte status; /* Matching result */
|
||||
#endif
|
||||
} SNI;
|
||||
@@ -1599,8 +1599,8 @@ WOLFSSL_LOCAL int TLSX_SNI_GetFromBuffer(const byte* buffer, word32 bufferSz,
|
||||
typedef struct ALPN {
|
||||
char* protocol_name; /* ALPN protocol name */
|
||||
struct ALPN* next; /* List Behavior */
|
||||
byte options; /* Behaviour options */
|
||||
byte negociated; /* ALPN protocol negociated or not */
|
||||
byte options; /* Behavior options */
|
||||
byte negotiated; /* ALPN protocol negotiated or not */
|
||||
} ALPN;
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_ALPN_GetRequest(TLSX* extensions,
|
||||
@@ -1696,7 +1696,7 @@ enum key_cache_state {
|
||||
SCR_CACHE_COMPLETE /* complete restore to real keys */
|
||||
};
|
||||
|
||||
/* Additional Conection State according to rfc5746 section 3.1 */
|
||||
/* Additional Connection State according to rfc5746 section 3.1 */
|
||||
typedef struct SecureRenegotiation {
|
||||
byte enabled; /* secure_renegotiation flag in rfc */
|
||||
byte startScr; /* server requested client to start scr */
|
||||
@@ -2196,7 +2196,7 @@ typedef struct Options {
|
||||
word16 dtls:1; /* using datagrams ? */
|
||||
word16 connReset:1; /* has the peer reset */
|
||||
word16 isClosed:1; /* if we consider conn closed */
|
||||
word16 closeNotify:1; /* we've recieved a close notify */
|
||||
word16 closeNotify:1; /* we've received a close notify */
|
||||
word16 sentNotify:1; /* we've sent a close notify */
|
||||
word16 usingCompression:1; /* are we using compression */
|
||||
word16 haveRSA:1; /* RSA available */
|
||||
@@ -2252,7 +2252,7 @@ typedef struct Arrays {
|
||||
word32 pendingMsgSz; /* defrag buffer size */
|
||||
word32 pendingMsgOffset; /* current offset into defrag buffer */
|
||||
#ifndef NO_PSK
|
||||
word32 psk_keySz; /* acutal size */
|
||||
word32 psk_keySz; /* actual size */
|
||||
char client_identity[MAX_PSK_ID_LEN];
|
||||
char server_hint[MAX_PSK_ID_LEN];
|
||||
byte psk_key[MAX_PSK_KEY_LEN];
|
||||
@@ -2412,7 +2412,7 @@ typedef struct DtlsMsg {
|
||||
#endif
|
||||
|
||||
|
||||
/* Handshake messages recevied from peer (plus change cipher */
|
||||
/* Handshake messages received from peer (plus change cipher */
|
||||
typedef struct MsgsReceived {
|
||||
word16 got_hello_request:1;
|
||||
word16 got_client_hello:1;
|
||||
@@ -2534,7 +2534,7 @@ struct WOLFSSL {
|
||||
byte didStreamInit; /* for stream init and end */
|
||||
#endif
|
||||
#ifdef WOLFSSL_DTLS
|
||||
int dtls_timeout_init; /* starting timeout vaule */
|
||||
int dtls_timeout_init; /* starting timeout value */
|
||||
int dtls_timeout_max; /* maximum timeout value */
|
||||
int dtls_timeout; /* current timeout value, changes */
|
||||
DtlsPool* dtls_pool;
|
||||
@@ -2700,7 +2700,7 @@ typedef struct HandShakeHeader {
|
||||
typedef struct DtlsHandShakeHeader {
|
||||
byte type;
|
||||
word24 length;
|
||||
byte message_seq[2]; /* start at 0, restransmit gets same # */
|
||||
byte message_seq[2]; /* start at 0, retransmit gets same # */
|
||||
word24 fragment_offset; /* bytes in previous fragments */
|
||||
word24 fragment_length; /* length of this fragment */
|
||||
} DtlsHandShakeHeader;
|
||||
|
@@ -19,7 +19,7 @@ struct WOLFSSL_DH {
|
||||
void* internal; /* our DH */
|
||||
char inSet; /* internal set from external ? */
|
||||
char exSet; /* external set from internal ? */
|
||||
/*added for lighttpd openssl compatability, go back and add a getter in
|
||||
/*added for lighttpd openssl compatibility, go back and add a getter in
|
||||
* lighttpd src code.
|
||||
*/
|
||||
int length;
|
||||
|
@@ -151,7 +151,7 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX;
|
||||
#define SSL_set_session wolfSSL_set_session
|
||||
#define SSL_get_session wolfSSL_get_session
|
||||
#define SSL_flush_sessions wolfSSL_flush_sessions
|
||||
/* assume unlimited temporarly */
|
||||
/* assume unlimited temporarily */
|
||||
#define SSL_CTX_get_session_cache_mode(ctx) 0
|
||||
|
||||
#define SSL_CTX_set_verify wolfSSL_CTX_set_verify
|
||||
@@ -401,7 +401,7 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX;
|
||||
/* yassl had set the default to be 500 */
|
||||
#define SSL_get_default_timeout(ctx) 500
|
||||
|
||||
/* Lighthttp compatability */
|
||||
/* Lighthttp compatibility */
|
||||
|
||||
#ifdef HAVE_LIGHTY
|
||||
typedef WOLFSSL_X509_NAME_ENTRY X509_NAME_ENTRY;
|
||||
|
@@ -1327,7 +1327,7 @@ enum {
|
||||
/* Do not abort the handshake if the requested SNI didn't match. */
|
||||
WOLFSSL_SNI_CONTINUE_ON_MISMATCH = 0x01,
|
||||
|
||||
/* Behave as if the requested SNI matched in a case of missmatch. */
|
||||
/* Behave as if the requested SNI matched in a case of mismatch. */
|
||||
/* In this case, the status will be set to WOLFSSL_SNI_FAKE_MATCH. */
|
||||
WOLFSSL_SNI_ANSWER_ON_MISMATCH = 0x02,
|
||||
|
||||
@@ -1539,7 +1539,7 @@ enum {
|
||||
WOLFSSL_NTRU_EESS593 = 0x0102, /* max plaintext length of 86 */
|
||||
WOLFSSL_NTRU_EESS743 = 0x0103, /* max plaintext length of 106 */
|
||||
WOLFSSL_LWE_XXX = 0x0201, /* Learning With Error encryption scheme */
|
||||
WOLFSSL_HFE_XXX = 0x0301, /* Hidden Field Equotion scheme */
|
||||
WOLFSSL_HFE_XXX = 0x0301, /* Hidden Field Equation scheme */
|
||||
WOLFSSL_NULL_QSH = 0xFFFF /* QSHScheme is not used */
|
||||
};
|
||||
|
||||
@@ -1559,7 +1559,7 @@ WOLFSSL_API int wolfSSL_UseSupportedQSH(WOLFSSL* ssl, unsigned short name);
|
||||
#define WOLFSSL_CRL_START_MON 0x02 /* start monitoring flag */
|
||||
|
||||
|
||||
/* notify user the hanshake is done */
|
||||
/* notify user the handshake is done */
|
||||
typedef int (*HandShakeDoneCb)(WOLFSSL*, void*);
|
||||
WOLFSSL_API int wolfSSL_SetHsDoneCb(WOLFSSL*, HandShakeDoneCb, void*);
|
||||
|
||||
|
@@ -873,7 +873,7 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
||||
/* let's write port sever is listening on to ready file
|
||||
external monitor can then do ephemeral ports by passing
|
||||
-p 0 to server on supported platforms with -R ready_file
|
||||
client can then wait for exisitence of ready_file and see
|
||||
client can then wait for existence of ready_file and see
|
||||
which port the server is listening on. */
|
||||
fprintf(srf, "%d\n", (int)port);
|
||||
fclose(srf);
|
||||
@@ -900,7 +900,7 @@ static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd)
|
||||
err_sys("ioctlsocket failed");
|
||||
#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) \
|
||||
|| defined (WOLFSSL_TIRTOS)|| defined(WOLFSSL_VXWORKS)
|
||||
/* non blocking not suppported, for now */
|
||||
/* non blocking not supported, for now */
|
||||
#else
|
||||
int flags = fcntl(*sockfd, F_GETFL, 0);
|
||||
if (flags < 0)
|
||||
@@ -1200,7 +1200,7 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id)
|
||||
|
||||
|
||||
/* Wolf Root Directory Helper */
|
||||
/* KEIL-RL File System does not support relative directry */
|
||||
/* KEIL-RL File System does not support relative directory */
|
||||
#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOLFSSL_TIRTOS)
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 256
|
||||
|
@@ -108,7 +108,7 @@ typedef struct Aes {
|
||||
word64 contextHandle; /* nitrox context memory handle */
|
||||
#endif
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
word32 left; /* unsued bytes left from last call */
|
||||
word32 left; /* unused bytes left from last call */
|
||||
#endif
|
||||
#ifdef WOLFSSL_PIC32MZ_CRYPT
|
||||
word32 key_ce[AES_BLOCK_SIZE*2/sizeof(word32)] ;
|
||||
|
@@ -158,7 +158,7 @@ enum Misc_ASN {
|
||||
MAX_EXP_SZ = 5, /* enum(contextspec|con|exp) + length(4) */
|
||||
MAX_PRSTR_SZ = 5, /* enum(prstr) + length(4) */
|
||||
MAX_VERSION_SZ = 5, /* enum + id + version(byte) + (header(2))*/
|
||||
MAX_ENCODED_DIG_SZ = 73, /* sha512 + enum(bit or octet) + legnth(4) */
|
||||
MAX_ENCODED_DIG_SZ = 73, /* sha512 + enum(bit or octet) + length(4) */
|
||||
MAX_RSA_INT_SZ = 517, /* RSA raw sz 4096 for bits + tag + len(4) */
|
||||
MAX_NTRU_KEY_SZ = 610, /* NTRU 112 bit public key */
|
||||
MAX_NTRU_ENC_SZ = 628, /* NTRU 112 bit DER public encoding */
|
||||
|
@@ -156,7 +156,7 @@ typedef struct Cert {
|
||||
|
||||
|
||||
|
||||
/* Initialize and Set Certficate defaults:
|
||||
/* Initialize and Set Certificate defaults:
|
||||
version = 3 (0x2)
|
||||
serial = 0 (Will be randomly generated)
|
||||
sigType = SHA_WITH_RSA
|
||||
|
@@ -35,7 +35,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FIPS /* to avoid redifinition of macros */
|
||||
#ifndef HAVE_FIPS /* to avoid redefinition of macros */
|
||||
#define WOLFSSL_3DES_CAVIUM_MAGIC 0xBEEF0003
|
||||
|
||||
enum {
|
||||
|
@@ -139,7 +139,7 @@ enum {
|
||||
HMAC_KAT_FIPS_E = -206, /* HMAC KAT failure */
|
||||
RSA_KAT_FIPS_E = -207, /* RSA KAT failure */
|
||||
DRBG_KAT_FIPS_E = -208, /* HASH DRBG KAT failure */
|
||||
DRBG_CONT_FIPS_E = -209, /* HASH DRBG Continious test failure */
|
||||
DRBG_CONT_FIPS_E = -209, /* HASH DRBG Continuous test failure */
|
||||
AESGCM_KAT_FIPS_E = -210, /* AESGCM KAT failure */
|
||||
THREAD_STORE_KEY_E = -211, /* Thread local storage key create failure */
|
||||
THREAD_STORE_SET_E = -212, /* Thread local storage key set failure */
|
||||
|
@@ -93,7 +93,7 @@ WOLFSSL_LOCAL void fe_inv__distinct(byte *r, const byte *x);
|
||||
|
||||
/* Conditional copy. If condition == 0, then zero is copied to dst. If
|
||||
* condition == 1, then one is copied to dst. Any other value results in
|
||||
* undefined behaviour.
|
||||
* undefined behavior.
|
||||
*/
|
||||
WOLFSSL_LOCAL void fe_select(byte *dst, const byte *zero, const byte *one,
|
||||
byte condition);
|
||||
@@ -117,7 +117,7 @@ WOLFSSL_LOCAL void fe_sqrt(byte *r, const byte *x);
|
||||
|
||||
/* Conditional copy. If condition == 0, then zero is copied to dst. If
|
||||
* condition == 1, then one is copied to dst. Any other value results in
|
||||
* undefined behaviour.
|
||||
* undefined behavior.
|
||||
*/
|
||||
WOLFSSL_LOCAL void fprime_select(byte *dst, const byte *zero, const byte *one,
|
||||
byte condition);
|
||||
|
@@ -183,7 +183,7 @@ typedef struct {
|
||||
} mp_int;
|
||||
|
||||
/* callback for mp_prime_random, should fill dst with random bytes and return
|
||||
how many read [upto len] */
|
||||
how many read [up to len] */
|
||||
typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);
|
||||
|
||||
|
||||
|
@@ -64,7 +64,7 @@ typedef struct Md5 {
|
||||
word32 digest[MD5_DIGEST_SIZE / sizeof(word32)];
|
||||
#else
|
||||
word32 digest[PIC32_HASH_SIZE / sizeof(word32)];
|
||||
pic32mz_desc desc ; /* Crypt Engine descripter */
|
||||
pic32mz_desc desc ; /* Crypt Engine descriptor */
|
||||
#endif
|
||||
} Md5;
|
||||
|
||||
|
@@ -83,7 +83,7 @@
|
||||
|
||||
/* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold
|
||||
* which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines]
|
||||
* which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without
|
||||
* which means roughly speaking you can handle up to 2536-bit RSA keys with these defined without
|
||||
* trouble.
|
||||
*/
|
||||
#undef BN_S_MP_MUL_DIGS_C
|
||||
|
@@ -110,7 +110,7 @@ typedef struct bufferDescriptor {
|
||||
#define PIC32_HASH_SIZE 32
|
||||
|
||||
#define PIC32MZ_MAX_BD 2
|
||||
typedef struct { /* Crypt Engine descripter */
|
||||
typedef struct { /* Crypt Engine descriptor */
|
||||
int bdCount ;
|
||||
int err ;
|
||||
volatile bufferDescriptor
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* hashType renamed to typeH to avoid shadowing global declation here:
|
||||
* hashType renamed to typeH to avoid shadowing global declaration here:
|
||||
* wolfssl/wolfcrypt/asn.h line 173 in enum Oid_Types
|
||||
*/
|
||||
WOLFSSL_API int wc_PBKDF1(byte* output, const byte* passwd, int pLen,
|
||||
|
@@ -110,7 +110,7 @@ WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz,
|
||||
#endif
|
||||
|
||||
/*
|
||||
choice of padding added after fips, so not avialable when using fips RSA
|
||||
choice of padding added after fips, so not available when using fips RSA
|
||||
*/
|
||||
|
||||
/* Mask Generation Function Identifiers */
|
||||
|
@@ -952,7 +952,7 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
||||
#endif
|
||||
|
||||
/* if using hardware crypto and have alignment requirements, specify the
|
||||
requirement here. The record header of SSL/TLS will prvent easy alignment.
|
||||
requirement here. The record header of SSL/TLS will prevent easy alignment.
|
||||
This hint tries to help as much as possible. */
|
||||
#ifndef WOLFSSL_GENERAL_ALIGNMENT
|
||||
#ifdef WOLFSSL_AESNI
|
||||
|
@@ -63,7 +63,7 @@ typedef struct Sha {
|
||||
word32 digest[SHA_DIGEST_SIZE / sizeof(word32)];
|
||||
#else
|
||||
word32 digest[PIC32_HASH_SIZE / sizeof(word32)];
|
||||
pic32mz_desc desc; /* Crypt Engine descripter */
|
||||
pic32mz_desc desc; /* Crypt Engine descriptor */
|
||||
#endif
|
||||
} Sha;
|
||||
|
||||
|
@@ -61,7 +61,7 @@ typedef struct Sha256 {
|
||||
word32 digest[SHA256_DIGEST_SIZE / sizeof(word32)];
|
||||
word32 buffer[SHA256_BLOCK_SIZE / sizeof(word32)];
|
||||
#ifdef WOLFSSL_PIC32MZ_HASH
|
||||
pic32mz_desc desc ; /* Crypt Engine descripter */
|
||||
pic32mz_desc desc ; /* Crypt Engine descriptor */
|
||||
#endif
|
||||
} Sha256;
|
||||
|
||||
|
@@ -98,7 +98,7 @@ typedef struct Srp {
|
||||
word32 saltSz; /**< Salt length. */
|
||||
mp_int N; /**< Modulus. N = 2q+1, [q, N] are primes.*/
|
||||
mp_int g; /**< Generator. A generator modulo N. */
|
||||
byte k[SRP_MAX_DIGEST_SIZE]; /**< Multiplier parameeter. k = H(N, g) */
|
||||
byte k[SRP_MAX_DIGEST_SIZE]; /**< Multiplier parameter. k = H(N, g) */
|
||||
mp_int auth; /**< Client: x = H(salt + H(user:pswd)) */
|
||||
/**< Server: v = g ^ x % N */
|
||||
mp_int priv; /**< Private ephemeral value. */
|
||||
@@ -148,7 +148,7 @@ WOLFSSL_API int wc_SrpSetUsername(Srp* srp, const byte* username, word32 size);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the srp parameeters based on the username.
|
||||
* Sets the srp parameters based on the username.
|
||||
*
|
||||
* This function MUST be called after wc_SrpSetUsername.
|
||||
*
|
||||
|
@@ -238,7 +238,7 @@
|
||||
/* Max size of any number in bits. Basically the largest size you will be
|
||||
* multiplying should be half [or smaller] of FP_MAX_SIZE-four_digit
|
||||
*
|
||||
* It defaults to 4096-bits [allowing multiplications upto 2048x2048 bits ]
|
||||
* It defaults to 4096-bits [allowing multiplications up to 2048x2048 bits ]
|
||||
*/
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
/* do we want some overflow checks
|
||||
Not required if you make sure your numbers are within range (e.g. by default a modulus for fp_exptmod() can only be upto 2048 bits long)
|
||||
Not required if you make sure your numbers are within range (e.g. by default a modulus for fp_exptmod() can only be up to 2048 bits long)
|
||||
*/
|
||||
/* #define TFM_CHECK */
|
||||
|
||||
@@ -514,7 +514,7 @@ int fp_exptmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d);
|
||||
/*#define TFM_PRIME_2MSB_OFF 0x0004 */ /* force 2nd MSB to 0 */
|
||||
/*#define TFM_PRIME_2MSB_ON 0x0008 */ /* force 2nd MSB to 1 */
|
||||
|
||||
/* callback for fp_prime_random, should fill dst with random bytes and return how many read [upto len] */
|
||||
/* callback for fp_prime_random, should fill dst with random bytes and return how many read [up to len] */
|
||||
/*typedef int tfm_prime_callback(unsigned char *dst, int len, void *dat);*/
|
||||
|
||||
/*#define fp_prime_random(a, t, size, bbs, cb, dat) fp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?TFM_PRIME_BBS:0, cb, dat)*/
|
||||
|
@@ -309,7 +309,7 @@
|
||||
|
||||
|
||||
|
||||
/* settings detection for compile vs runtime math incombatibilities */
|
||||
/* settings detection for compile vs runtime math incompatibilities */
|
||||
enum {
|
||||
#if !defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG)
|
||||
CTC_SETTINGS = 0x0
|
||||
|
Reference in New Issue
Block a user