mirror of https://github.com/wolfSSL/wolfssl.git
readjust c files, autoconf, and some header files
parent
b91934f065
commit
f64d76257e
File diff suppressed because it is too large
Load Diff
|
@ -197,12 +197,13 @@ enum Key_Sum {
|
|||
|
||||
|
||||
enum Ecc_Sum {
|
||||
ECC_256R1 = 526,
|
||||
ECC_384R1 = 210,
|
||||
ECC_521R1 = 211,
|
||||
ECC_160R1 = 184,
|
||||
ECC_192R1 = 520,
|
||||
ECC_224R1 = 209
|
||||
ECC_256R1 = 526,
|
||||
ECC_384R1 = 210,
|
||||
ECC_521R1 = 211,
|
||||
ECC_160R1 = 184,
|
||||
ECC_192R1 = 520,
|
||||
ECC_224R1 = 209,
|
||||
CURVE25519_OID = 212 //TODO value to be determined
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -29,96 +29,166 @@
|
|||
#include <cyassl/ctaocrypt/rsa.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/asn_public.h>
|
||||
|
||||
#ifndef HAVE_FIPS
|
||||
#ifdef WOLFSSL_CERT_GEN
|
||||
#define InitCert wc_InitCert
|
||||
#define MakeCert wc_MakeCert
|
||||
|
||||
#ifdef WOLFSSL_CERT_REQ
|
||||
#define MakeCertReq wc_MakeCertReq
|
||||
#endif
|
||||
|
||||
#define SignCert wc_SignCert
|
||||
#define MakeSelfCert wc_MakeSelfCert
|
||||
#define SetIssuer wc_SetIssuer
|
||||
#define SetSubject wc_SetSubject
|
||||
|
||||
#ifdef WOLFSSL_ALT_NAMES
|
||||
#define SetAltNames wc_SetAltNames
|
||||
#endif
|
||||
|
||||
#define SetIssuerBuffer wc_SetIssuerBuffer
|
||||
#define SetSubjectBuffer wc_SetSubjectBuffer
|
||||
#define SetAltNamesBuffer wc_SetAltNamesBuffer
|
||||
#define SetDatesBuffer wc_SetDatesBuffer
|
||||
|
||||
#ifdef HAVE_NTRU
|
||||
#define MakeNtruCert wc_MakeNtruCert
|
||||
#endif
|
||||
|
||||
#endif /* WOLFSSL_CERT_GEN */
|
||||
|
||||
#if defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN)
|
||||
#define DerToPem wc_DerToPem
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
/* private key helpers */
|
||||
#define EccPrivateKeyDecode wc_EccPrivateKeyDecode
|
||||
#define EccKeyToDer wc_EccKeyToDer
|
||||
#endif
|
||||
|
||||
/* DER encode signature */
|
||||
#define EncodeSignature wc_EncodeSignature
|
||||
#define GetCTC_HashOID wc_GetCTC_HashOID
|
||||
#else
|
||||
#define WOLFSSL_CERT_GEN CYASSL_CERTGEN
|
||||
#define WOLFSSL_CERT_REQ CYASSL_CERT_REQ
|
||||
#define WOLFSSL_ALT_NAMES CYASSL_ALT_NAMES
|
||||
|
||||
#ifdef WOLFSSL_CERT_GEN
|
||||
#define wc_InitCert InitCert
|
||||
#define wc_MakeCert MakeCert
|
||||
|
||||
#ifdef WOLFSSL_CERT_REQ
|
||||
#define wc_MakeCertReq MakeCertReq
|
||||
#endif
|
||||
|
||||
#define wc_SignCert SignCert
|
||||
#define wc_MakeSelfCert MakeSelfCert
|
||||
#define wc_SetIssuer SetIssuer
|
||||
#define wc_SetSubject SetSubject
|
||||
|
||||
#ifdef WOLFSSL_ALT_NAMES
|
||||
#define wc_SetAltNames SetAltNames
|
||||
#endif
|
||||
|
||||
#define wc_SetIssuerBuffer SetIssuerBuffer
|
||||
#define wc_SetSubjectBuffer SetSubjectBuffer
|
||||
#define wc_SetAltNamesBuffer SetAltNamesBuffer
|
||||
#define wc_SetDatesBuffer SetDatesBuffer
|
||||
|
||||
#ifdef HAVE_NTRU
|
||||
#define wc_MakeNtruCert MakeNtruCert
|
||||
#endif
|
||||
|
||||
#endif /* WOLFSSL_CERT_GEN */
|
||||
|
||||
#if defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN)
|
||||
#define wc_DerToPem DerToPem
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
/* private key helpers */
|
||||
#define wc_EccPrivateKeyDecode EccPrivateKeyDecode
|
||||
#define wc_EccKeyToDer EccKeyToDer
|
||||
#endif
|
||||
|
||||
/* DER encode signature */
|
||||
#define wc_EncodeSignature EncodeSignature
|
||||
#define wc_GetCTC_HashOID GetCTC_HashOID
|
||||
#endif /* HAVE_FIPS */
|
||||
#endif /* CTA_CRYPT_ASN_PUBLIC_H */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Certificate file Type */
|
||||
enum CertType {
|
||||
CERT_TYPE = 0,
|
||||
PRIVATEKEY_TYPE,
|
||||
DH_PARAM_TYPE,
|
||||
CRL_TYPE,
|
||||
CA_TYPE,
|
||||
ECC_PRIVATEKEY_TYPE,
|
||||
CERTREQ_TYPE
|
||||
};
|
||||
|
||||
|
||||
/* Signature type, by OID sum */
|
||||
enum Ctc_SigType {
|
||||
CTC_SHAwDSA = 517,
|
||||
CTC_MD2wRSA = 646,
|
||||
CTC_MD5wRSA = 648,
|
||||
CTC_SHAwRSA = 649,
|
||||
CTC_SHAwECDSA = 520,
|
||||
CTC_SHA256wRSA = 655,
|
||||
CTC_SHA256wECDSA = 524,
|
||||
CTC_SHA384wRSA = 656,
|
||||
CTC_SHA384wECDSA = 525,
|
||||
CTC_SHA512wRSA = 657,
|
||||
CTC_SHA512wECDSA = 526
|
||||
};
|
||||
|
||||
enum Ctc_Encoding {
|
||||
CTC_UTF8 = 0x0c, /* utf8 */
|
||||
CTC_PRINTABLE = 0x13 /* printable */
|
||||
};
|
||||
|
||||
|
||||
#ifdef CYASSL_CERT_GEN
|
||||
|
||||
#ifndef HAVE_ECC
|
||||
typedef struct ecc_key ecc_key;
|
||||
#endif
|
||||
|
||||
enum Ctc_Misc {
|
||||
CTC_NAME_SIZE = 64,
|
||||
CTC_DATE_SIZE = 32,
|
||||
CTC_MAX_ALT_SIZE = 16384, /* may be huge */
|
||||
CTC_SERIAL_SIZE = 8
|
||||
};
|
||||
|
||||
typedef struct CertName {
|
||||
char country[CTC_NAME_SIZE];
|
||||
char countryEnc;
|
||||
char state[CTC_NAME_SIZE];
|
||||
char stateEnc;
|
||||
char locality[CTC_NAME_SIZE];
|
||||
char localityEnc;
|
||||
char sur[CTC_NAME_SIZE];
|
||||
char surEnc;
|
||||
char org[CTC_NAME_SIZE];
|
||||
char orgEnc;
|
||||
char unit[CTC_NAME_SIZE];
|
||||
char unitEnc;
|
||||
char commonName[CTC_NAME_SIZE];
|
||||
char commonNameEnc;
|
||||
char email[CTC_NAME_SIZE]; /* !!!! email has to be last !!!! */
|
||||
} CertName;
|
||||
|
||||
|
||||
/* for user to fill for certificate generation */
|
||||
typedef struct Cert {
|
||||
int version; /* x509 version */
|
||||
byte serial[CTC_SERIAL_SIZE]; /* serial number */
|
||||
int sigType; /* signature algo type */
|
||||
CertName issuer; /* issuer info */
|
||||
int daysValid; /* validity days */
|
||||
int selfSigned; /* self signed flag */
|
||||
CertName subject; /* subject info */
|
||||
int isCA; /* is this going to be a CA */
|
||||
/* internal use only */
|
||||
int bodySz; /* pre sign total size */
|
||||
int keyType; /* public key type of subject */
|
||||
#ifdef CYASSL_ALT_NAMES
|
||||
byte altNames[CTC_MAX_ALT_SIZE]; /* altNames copy */
|
||||
int altNamesSz; /* altNames size in bytes */
|
||||
byte beforeDate[CTC_DATE_SIZE]; /* before date copy */
|
||||
int beforeDateSz; /* size of copy */
|
||||
byte afterDate[CTC_DATE_SIZE]; /* after date copy */
|
||||
int afterDateSz; /* size of copy */
|
||||
#endif
|
||||
#ifdef CYASSL_CERT_REQ
|
||||
char challengePw[CTC_NAME_SIZE];
|
||||
#endif
|
||||
} Cert;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Initialize and Set Certficate defaults:
|
||||
version = 3 (0x2)
|
||||
serial = 0 (Will be randomly generated)
|
||||
sigType = SHA_WITH_RSA
|
||||
issuer = blank
|
||||
daysValid = 500
|
||||
selfSigned = 1 (true) use subject as issuer
|
||||
subject = blank
|
||||
isCA = 0 (false)
|
||||
keyType = RSA_KEY (default)
|
||||
*/
|
||||
CYASSL_API void InitCert(Cert*);
|
||||
CYASSL_API int MakeCert(Cert*, byte* derBuffer, word32 derSz, RsaKey*,
|
||||
ecc_key*, RNG*);
|
||||
#ifdef CYASSL_CERT_REQ
|
||||
CYASSL_API int MakeCertReq(Cert*, byte* derBuffer, word32 derSz, RsaKey*,
|
||||
ecc_key*);
|
||||
#endif
|
||||
CYASSL_API int SignCert(int requestSz, int sigType, byte* derBuffer,
|
||||
word32 derSz, RsaKey*, ecc_key*, RNG*);
|
||||
CYASSL_API int MakeSelfCert(Cert*, byte* derBuffer, word32 derSz, RsaKey*,
|
||||
RNG*);
|
||||
CYASSL_API int SetIssuer(Cert*, const char*);
|
||||
CYASSL_API int SetSubject(Cert*, const char*);
|
||||
#ifdef CYASSL_ALT_NAMES
|
||||
CYASSL_API int SetAltNames(Cert*, const char*);
|
||||
#endif
|
||||
CYASSL_API int SetIssuerBuffer(Cert*, const byte*, int);
|
||||
CYASSL_API int SetSubjectBuffer(Cert*, const byte*, int);
|
||||
CYASSL_API int SetAltNamesBuffer(Cert*, const byte*, int);
|
||||
CYASSL_API int SetDatesBuffer(Cert*, const byte*, int);
|
||||
|
||||
#ifdef HAVE_NTRU
|
||||
CYASSL_API int MakeNtruCert(Cert*, byte* derBuffer, word32 derSz,
|
||||
const byte* ntruKey, word16 keySz, RNG*);
|
||||
#endif
|
||||
|
||||
#endif /* CYASSL_CERT_GEN */
|
||||
|
||||
|
||||
#if defined(CYASSL_KEY_GEN) || defined(CYASSL_CERT_GEN)
|
||||
CYASSL_API int DerToPem(const byte* der, word32 derSz, byte* output,
|
||||
word32 outputSz, int type);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
/* private key helpers */
|
||||
CYASSL_API int EccPrivateKeyDecode(const byte* input,word32* inOutIdx,
|
||||
ecc_key*,word32);
|
||||
CYASSL_API int EccKeyToDer(ecc_key*, byte* output, word32 inLen);
|
||||
#endif
|
||||
|
||||
/* DER encode signature */
|
||||
CYASSL_API word32 EncodeSignature(byte* out, const byte* digest, word32 digSz,
|
||||
int hashOID);
|
||||
CYASSL_API int GetCTC_HashOID(int type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* CTAO_CRYPT_ASN_PUBLIC_H */
|
||||
|
||||
|
|
|
@ -26,10 +26,31 @@
|
|||
#ifndef CTAO_CRYPT_SETTINGS_H
|
||||
#define CTAO_CRYPT_SETTINGS_H
|
||||
|
||||
#define CYASSL_SHA512
|
||||
//WOLFSSL_SHA512
|
||||
#define CYASSL_SHA384
|
||||
//WOLFSSL_SHA384
|
||||
#define CYASSL_SHA512 WOLFSSL_SHA512
|
||||
#define CYASSL_SHA384 WOLFSSL_SHA384
|
||||
|
||||
/* These are compatibility from fips protected headers
|
||||
* When using non-fips mode and including old headers this allows for
|
||||
* using old function calls
|
||||
*/
|
||||
#ifndef HAVE_FIPS
|
||||
#ifndef NO_HMAC
|
||||
#include <wolfssl/wolfcrypt/hmac.h>
|
||||
/* does init */
|
||||
#define HmacSetKey wc_HmacSetKey
|
||||
#define HmacUpdate wc_HmacUpdate
|
||||
#define HmacFinal wc_HmacFinal
|
||||
#ifdef HAVE_CAVIUM
|
||||
#define HmacInitCavium wc_HmacInitCavium
|
||||
#define HmacFreeCavium wc_HmacFreeCavium
|
||||
#endif
|
||||
#define CyaSSL_GetHmacMaxSize wc_wolfSSL_GetHmacMaxSize
|
||||
#ifdef HAVE_HKDF
|
||||
#define HKDF wc_HKDF
|
||||
#endif /* HAVE_HKDF */
|
||||
#endif /* NO_HMAC */
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -13,7 +13,7 @@ src_libwolfssl_la_CPPFLAGS = -DBUILDING_WOLFSSL $(AM_CPPFLAGS)
|
|||
# fips first file
|
||||
if BUILD_FIPS
|
||||
src_libwolfssl_la_SOURCES += ctaocrypt/src/wolfcrypt_first.c
|
||||
endif
|
||||
#endif
|
||||
|
||||
src_libwolfssl_la_SOURCES += \
|
||||
ctaocrypt/src/hmac.c \
|
||||
|
@ -36,17 +36,18 @@ if BUILD_SHA
|
|||
src_libwolfssl_la_SOURCES += ctaocrypt/src/sha.c
|
||||
endif
|
||||
|
||||
if BUILD_SHA512
|
||||
# Issue with flag BUILD_SHA512 @TODO
|
||||
#if BUILD_SHA512
|
||||
src_libwolfssl_la_SOURCES += ctaocrypt/src/sha512.c
|
||||
endif
|
||||
#endif
|
||||
|
||||
if BUILD_FIPS
|
||||
#if BUILD_FIPS
|
||||
src_libwolfssl_la_SOURCES += ctaocrypt/src/fips.c
|
||||
src_libwolfssl_la_SOURCES += ctaocrypt/src/fips_test.c
|
||||
endif
|
||||
#endif
|
||||
|
||||
# fips last file
|
||||
if BUILD_FIPS
|
||||
#if BUILD_FIPS
|
||||
src_libwolfssl_la_SOURCES += ctaocrypt/src/wolfcrypt_last.c
|
||||
endif
|
||||
|
||||
|
@ -71,9 +72,10 @@ if BUILD_SHA
|
|||
src_libwolfssl_la_SOURCES += wolfcrypt/src/sha.c
|
||||
endif
|
||||
|
||||
if BUILD_SHA512
|
||||
# Issue with flag BUILD_SHA512 @TODO
|
||||
#if BUILD_SHA512
|
||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/sha512.c
|
||||
endif
|
||||
#endif
|
||||
|
||||
if BUILD_FIPS
|
||||
src_libwolfssl_la_SOURCES += \
|
||||
|
@ -100,8 +102,12 @@ src_libwolfssl_la_SOURCES += wolfcrypt/src/dh.c
|
|||
endif
|
||||
|
||||
if BUILD_ASN
|
||||
if BUILD_FIPS
|
||||
src_libwolfssl_la_SOURCES += ctaocrypt/src/asn.c
|
||||
else
|
||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/asn.c
|
||||
endif
|
||||
endif
|
||||
|
||||
if BUILD_CODING
|
||||
if BUILD_FIPS
|
||||
|
|
|
@ -577,8 +577,8 @@ void FreeCiphers(WOLFSSL* ssl)
|
|||
#ifdef BUILD_DES3
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (ssl->devId != NO_CAVIUM_DEVICE) {
|
||||
Des3_FreeCavium(ssl->encrypt.des3);
|
||||
Des3_FreeCavium(ssl->decrypt.des3);
|
||||
wc_Des3_FreeCavium(ssl->encrypt.des3);
|
||||
wc_Des3_FreeCavium(ssl->decrypt.des3);
|
||||
}
|
||||
#endif
|
||||
XFREE(ssl->encrypt.des3, ssl->heap, DYNAMIC_TYPE_CIPHER);
|
||||
|
@ -3218,14 +3218,14 @@ static void BuildSHA(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
|
|||
wc_ShaUpdate(&ssl->hashSha, sender, SIZEOF_SENDER);
|
||||
wc_ShaUpdate(&ssl->hashSha, ssl->arrays->masterSecret, SECRET_LEN);
|
||||
wc_ShaUpdate(&ssl->hashSha, PAD1, PAD_SHA);
|
||||
ShaFinal(&ssl->hashSha, sha_result);
|
||||
wc_ShaFinal(&ssl->hashSha, sha_result);
|
||||
|
||||
/* make sha outer */
|
||||
wc_ShaUpdate(&ssl->hashSha, ssl->arrays->masterSecret, SECRET_LEN);
|
||||
wc_ShaUpdate(&ssl->hashSha, PAD2, PAD_SHA);
|
||||
wc_ShaUpdate(&ssl->hashSha, sha_result, SHA_DIGEST_SIZE);
|
||||
|
||||
ShaFinal(&ssl->hashSha, hashes->sha);
|
||||
wc_ShaFinal(&ssl->hashSha, hashes->sha);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -5657,7 +5657,7 @@ static INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz)
|
|||
|
||||
#ifdef BUILD_DES3
|
||||
case wolfssl_triple_des:
|
||||
return Des3_CbcEncrypt(ssl->encrypt.des3, out, input, sz);
|
||||
return wc_Des3_CbcEncrypt(ssl->encrypt.des3, out, input, sz);
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_AES
|
||||
|
@ -5816,7 +5816,7 @@ static INLINE int Decrypt(WOLFSSL* ssl, byte* plain, const byte* input,
|
|||
|
||||
#ifdef BUILD_DES3
|
||||
case wolfssl_triple_des:
|
||||
return Des3_CbcDecrypt(ssl->decrypt.des3, plain, input, sz);
|
||||
return wc_Des3_CbcDecrypt(ssl->decrypt.des3, plain, input, sz);
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_AES
|
||||
|
@ -10143,7 +10143,7 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
|
|||
wc_ShaUpdate(sha, ssl->arrays->clientRandom, RAN_LEN);
|
||||
wc_ShaUpdate(sha, ssl->arrays->serverRandom, RAN_LEN);
|
||||
wc_ShaUpdate(sha, messageVerify, verifySz);
|
||||
ShaFinal(sha, hash + MD5_DIGEST_SIZE);
|
||||
wc_ShaFinal(sha, hash + MD5_DIGEST_SIZE);
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA256
|
||||
|
@ -11835,7 +11835,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
|||
wc_ShaUpdate(sha, ssl->arrays->clientRandom, RAN_LEN);
|
||||
wc_ShaUpdate(sha, ssl->arrays->serverRandom, RAN_LEN);
|
||||
wc_ShaUpdate(sha, output + preSigIdx, preSigSz);
|
||||
ShaFinal(sha, &hash[MD5_DIGEST_SIZE]);
|
||||
wc_ShaFinal(sha, &hash[MD5_DIGEST_SIZE]);
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA256
|
||||
|
@ -12290,7 +12290,7 @@ int DoSessionTicket(WOLFSSL* ssl,
|
|||
wc_ShaUpdate(sha, ssl->arrays->clientRandom, RAN_LEN);
|
||||
wc_ShaUpdate(sha, ssl->arrays->serverRandom, RAN_LEN);
|
||||
wc_ShaUpdate(sha, output + preSigIdx, preSigSz);
|
||||
ShaFinal(sha, &hash[MD5_DIGEST_SIZE]);
|
||||
wc_ShaFinal(sha, &hash[MD5_DIGEST_SIZE]);
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA256
|
||||
|
|
20
src/keys.c
20
src/keys.c
|
@ -2041,24 +2041,24 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
|||
#endif
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc) {
|
||||
desRet = Des3_SetKey(enc->des3, keys->client_write_key,
|
||||
desRet = wc_Des3_SetKey(enc->des3, keys->client_write_key,
|
||||
keys->client_write_IV, DES_ENCRYPTION);
|
||||
if (desRet != 0) return desRet;
|
||||
}
|
||||
if (dec) {
|
||||
desRet = Des3_SetKey(dec->des3, keys->server_write_key,
|
||||
desRet = wc_Des3_SetKey(dec->des3, keys->server_write_key,
|
||||
keys->server_write_IV, DES_DECRYPTION);
|
||||
if (desRet != 0) return desRet;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (enc) {
|
||||
desRet = Des3_SetKey(enc->des3, keys->server_write_key,
|
||||
desRet = wc_Des3_SetKey(enc->des3, keys->server_write_key,
|
||||
keys->server_write_IV, DES_ENCRYPTION);
|
||||
if (desRet != 0) return desRet;
|
||||
}
|
||||
if (dec) {
|
||||
desRet = Des3_SetKey(dec->des3, keys->client_write_key,
|
||||
desRet = wc_Des3_SetKey(dec->des3, keys->client_write_key,
|
||||
keys->client_write_IV, DES_DECRYPTION);
|
||||
if (desRet != 0) return desRet;
|
||||
}
|
||||
|
@ -2511,7 +2511,7 @@ int DeriveKeys(WOLFSSL* ssl)
|
|||
|
||||
wc_InitMd5(md5);
|
||||
|
||||
ret = InitSha(sha);
|
||||
ret = wc_InitSha(sha);
|
||||
|
||||
if (ret == 0) {
|
||||
XMEMCPY(md5Input, ssl->arrays->masterSecret, SECRET_LEN);
|
||||
|
@ -2531,9 +2531,9 @@ int DeriveKeys(WOLFSSL* ssl)
|
|||
idx += RAN_LEN;
|
||||
XMEMCPY(shaInput + idx, ssl->arrays->clientRandom, RAN_LEN);
|
||||
|
||||
ShaUpdate(sha, shaInput, (KEY_PREFIX + SECRET_LEN + 2 * RAN_LEN)
|
||||
wc_ShaUpdate(sha, shaInput, (KEY_PREFIX + SECRET_LEN + 2 * RAN_LEN)
|
||||
- KEY_PREFIX + j);
|
||||
ShaFinal(sha, shaOutput);
|
||||
wc_ShaFinal(sha, shaOutput);
|
||||
|
||||
XMEMCPY(md5Input + SECRET_LEN, shaOutput, SHA_DIGEST_SIZE);
|
||||
wc_Md5Update(md5, md5Input, SECRET_LEN + SHA_DIGEST_SIZE);
|
||||
|
@ -2630,7 +2630,7 @@ static int MakeSslMasterSecret(WOLFSSL* ssl)
|
|||
|
||||
wc_InitMd5(md5);
|
||||
|
||||
ret = InitSha(sha);
|
||||
ret = wc_InitSha(sha);
|
||||
|
||||
if (ret == 0) {
|
||||
XMEMCPY(md5Input, ssl->arrays->preMasterSecret, pmsSz);
|
||||
|
@ -2652,8 +2652,8 @@ static int MakeSslMasterSecret(WOLFSSL* ssl)
|
|||
idx += RAN_LEN;
|
||||
XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN);
|
||||
idx += RAN_LEN;
|
||||
ShaUpdate(sha, shaInput, idx);
|
||||
ShaFinal(sha, shaOutput);
|
||||
wc_ShaUpdate(sha, shaInput, idx);
|
||||
wc_ShaFinal(sha, shaOutput);
|
||||
|
||||
idx = pmsSz; /* preSz */
|
||||
XMEMCPY(md5Input + idx, shaOutput, SHA_DIGEST_SIZE);
|
||||
|
|
|
@ -330,7 +330,7 @@ int BuildTlsFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
|
|||
|
||||
#ifndef NO_OLD_TLS
|
||||
wc_Md5Final(&ssl->hashMd5, handshake_hash);
|
||||
ShaFinal(&ssl->hashSha, &handshake_hash[MD5_DIGEST_SIZE]);
|
||||
wc_ShaFinal(&ssl->hashSha, &handshake_hash[MD5_DIGEST_SIZE]);
|
||||
#endif
|
||||
|
||||
if (IsAtLeastTLSv1_2(ssl)) {
|
||||
|
|
64
tests/hash.c
64
tests/hash.c
|
@ -23,17 +23,17 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/settings.h>
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cyassl/ctaocrypt/md4.h>
|
||||
#include <cyassl/ctaocrypt/md5.h>
|
||||
#include <cyassl/ctaocrypt/sha.h>
|
||||
#include <cyassl/ctaocrypt/sha256.h>
|
||||
#include <cyassl/ctaocrypt/sha512.h>
|
||||
#include <cyassl/ctaocrypt/ripemd.h>
|
||||
#include <cyassl/ctaocrypt/hmac.h>
|
||||
#include <wolfssl/wolfcrypt/md4.h>
|
||||
#include <wolfssl/wolfcrypt/md5.h>
|
||||
#include <wolfssl/wolfcrypt/sha.h>
|
||||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
#include <wolfssl/wolfcrypt/sha512.h>
|
||||
#include <wolfssl/wolfcrypt/ripemd.h>
|
||||
#include <wolfssl/wolfcrypt/hmac.h>
|
||||
|
||||
#include <tests/unit.h>
|
||||
|
||||
|
@ -215,7 +215,7 @@ int md4_test(void)
|
|||
test_md4[5] = f;
|
||||
test_md4[6] = g;
|
||||
|
||||
InitMd4(&md4);
|
||||
wc_InitMd4(&md4);
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
Md4Update(&md4, (byte*)test_md4[i].input, (word32)test_md4[i].inLen);
|
||||
|
@ -279,11 +279,11 @@ int md5_test(void)
|
|||
test_md5[3] = d;
|
||||
test_md5[4] = e;
|
||||
|
||||
InitMd5(&md5);
|
||||
wc_InitMd5(&md5);
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
Md5Update(&md5, (byte*)test_md5[i].input, (word32)test_md5[i].inLen);
|
||||
Md5Final(&md5, hash);
|
||||
wc_Md5Update(&md5, (byte*)test_md5[i].input, (word32)test_md5[i].inLen);
|
||||
wc_Md5Final(&md5, hash);
|
||||
|
||||
if (memcmp(hash, test_md5[i].output, MD5_DIGEST_SIZE) != 0)
|
||||
return -5 - i;
|
||||
|
@ -337,13 +337,13 @@ int sha_test(void)
|
|||
test_sha[2] = c;
|
||||
test_sha[3] = d;
|
||||
|
||||
ret = InitSha(&sha);
|
||||
ret = wc_InitSha(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
ShaUpdate(&sha, (byte*)test_sha[i].input, (word32)test_sha[i].inLen);
|
||||
ShaFinal(&sha, hash);
|
||||
wc_ShaUpdate(&sha, (byte*)test_sha[i].input, (word32)test_sha[i].inLen);
|
||||
wc_ShaFinal(&sha, hash);
|
||||
|
||||
if (memcmp(hash, test_sha[i].output, SHA_DIGEST_SIZE) != 0)
|
||||
return -10 - i;
|
||||
|
@ -381,16 +381,16 @@ int sha256_test(void)
|
|||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
|
||||
ret = InitSha256(&sha);
|
||||
ret = wc_InitSha256(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
ret = Sha256Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
|
||||
ret = wc_Sha256Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = Sha256Final(&sha, hash);
|
||||
ret = wc_Sha256Final(&sha, hash);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
@ -435,7 +435,7 @@ int sha512_test(void)
|
|||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
|
||||
ret = InitSha512(&sha);
|
||||
ret = wc_InitSha512(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
@ -487,7 +487,7 @@ int sha384_test()
|
|||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
|
||||
ret = InitSha384(&sha);
|
||||
ret = wc_InitSha384(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
@ -612,14 +612,14 @@ int hmac_md5_test(void)
|
|||
if (i == 1)
|
||||
continue; /* fips not allowed */
|
||||
#endif
|
||||
ret = HmacSetKey(&hmac, MD5, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
ret = wc_HmacSetKey(&hmac, MD5, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
if (ret != 0)
|
||||
return -4014;
|
||||
ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
ret = wc_HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
if (ret != 0)
|
||||
return -4015;
|
||||
ret = HmacFinal(&hmac, hash);
|
||||
ret = wc_HmacFinal(&hmac, hash);
|
||||
if (ret != 0)
|
||||
return -4016;
|
||||
|
||||
|
@ -682,14 +682,14 @@ int hmac_sha_test(void)
|
|||
if (i == 1)
|
||||
continue; /* fips not allowed */
|
||||
#endif
|
||||
ret = HmacSetKey(&hmac, SHA, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
ret = wc_HmacSetKey(&hmac, SHA, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
if (ret != 0)
|
||||
return -4017;
|
||||
ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
ret = wc_HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
if (ret != 0)
|
||||
return -4018;
|
||||
ret = HmacFinal(&hmac, hash);
|
||||
ret = wc_HmacFinal(&hmac, hash);
|
||||
if (ret != 0)
|
||||
return -4019;
|
||||
|
||||
|
@ -755,14 +755,14 @@ int hmac_sha256_test(void)
|
|||
if (i == 1)
|
||||
continue; /* fips not allowed */
|
||||
#endif
|
||||
ret = HmacSetKey(&hmac,SHA256, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
ret = wc_HmacSetKey(&hmac,SHA256, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
if (ret != 0)
|
||||
return -4020;
|
||||
ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
ret = wc_HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
if (ret != 0)
|
||||
return -4021;
|
||||
ret = HmacFinal(&hmac, hash);
|
||||
ret = wc_HmacFinal(&hmac, hash);
|
||||
if (ret != 0)
|
||||
return -4022;
|
||||
|
||||
|
@ -832,14 +832,14 @@ int hmac_sha384_test(void)
|
|||
if (i == 1)
|
||||
continue; /* fips not allowed */
|
||||
#endif
|
||||
ret = HmacSetKey(&hmac,SHA384, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
ret = wc_HmacSetKey(&hmac,SHA384, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
if (ret != 0)
|
||||
return -4023;
|
||||
ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
ret = wc_HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
if (ret != 0)
|
||||
return -4024;
|
||||
ret = HmacFinal(&hmac, hash);
|
||||
ret = wc_HmacFinal(&hmac, hash);
|
||||
if (ret != 0)
|
||||
return -4025;
|
||||
|
||||
|
|
|
@ -53,6 +53,14 @@
|
|||
#include "ntru_crypto.h"
|
||||
#endif
|
||||
|
||||
//#if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384)
|
||||
// #include <wolfssl/wolfcrypt/sha512.h>
|
||||
//#endif
|
||||
|
||||
//#ifndef NO_SHA256
|
||||
// #include <wolfssl/wolfcrypt/sha256.h>
|
||||
//#endif
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
#include <wolfssl/wolfcrypt/ecc.h>
|
||||
#endif
|
||||
|
@ -724,7 +732,7 @@ static int CaviumRsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
|
|||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
int RsaPrivateKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
|
||||
int wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
|
||||
word32 inSz)
|
||||
{
|
||||
int version, length;
|
||||
|
@ -1173,7 +1181,7 @@ int ToTraditionalEnc(byte* input, word32 sz,const char* password,int passwordSz)
|
|||
|
||||
#ifndef NO_RSA
|
||||
|
||||
int RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
|
||||
int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
|
||||
word32 inSz)
|
||||
{
|
||||
int length;
|
||||
|
@ -1237,7 +1245,7 @@ int RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, const byte* e, word32 eSz,
|
||||
int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, const byte* e, word32 eSz,
|
||||
RsaKey* key)
|
||||
{
|
||||
if (n == NULL || e == NULL || key == NULL)
|
||||
|
@ -1858,14 +1866,14 @@ static int GetName(DecodedCert* cert, int nameType)
|
|||
if (GetSequence(cert->source, &cert->srcIdx, &length, cert->maxIdx) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
ret = InitSha(&sha);
|
||||
ret = wc_InitSha(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
ShaUpdate(&sha, &cert->source[idx], length + cert->srcIdx - idx);
|
||||
wc_ShaUpdate(&sha, &cert->source[idx], length + cert->srcIdx - idx);
|
||||
if (nameType == ISSUER)
|
||||
ShaFinal(&sha, cert->issuerHash);
|
||||
wc_ShaFinal(&sha, cert->issuerHash);
|
||||
else
|
||||
ShaFinal(&sha, cert->subjectHash);
|
||||
wc_ShaFinal(&sha, cert->subjectHash);
|
||||
|
||||
length += cert->srcIdx;
|
||||
idx = 0;
|
||||
|
@ -3059,16 +3067,16 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
|||
if (sigSz > MAX_ENCODED_SIG_SZ) {
|
||||
WOLFSSL_MSG("Verify Signautre is too big");
|
||||
}
|
||||
else if (InitRsaKey(pubKey, heap) != 0) {
|
||||
else if (wc_InitRsaKey(pubKey, heap) != 0) {
|
||||
WOLFSSL_MSG("InitRsaKey failed");
|
||||
}
|
||||
else if (RsaPublicKeyDecode(key, &idx, pubKey, keySz) < 0) {
|
||||
else if (wc_RsaPublicKeyDecode(key, &idx, pubKey, keySz) < 0) {
|
||||
WOLFSSL_MSG("ASN Key decode error RSA");
|
||||
}
|
||||
else {
|
||||
XMEMCPY(plain, sig, sigSz);
|
||||
|
||||
if ((verifySz = RsaSSL_VerifyInline(plain, sigSz, &out,
|
||||
if ((verifySz = wc_RsaSSL_VerifyInline(plain, sigSz, &out,
|
||||
pubKey)) < 0) {
|
||||
WOLFSSL_MSG("Rsa SSL verify error");
|
||||
}
|
||||
|
@ -3112,7 +3120,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
|||
|
||||
}
|
||||
|
||||
FreeRsaKey(pubKey);
|
||||
wc_FreeRsaKey(pubKey);
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(pubKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
@ -3751,11 +3759,11 @@ static int DecodeAuthKeyId(byte* input, int sz, DecodedCert* cert)
|
|||
}
|
||||
else {
|
||||
Sha sha;
|
||||
ret = InitSha(&sha);
|
||||
ret = wc_InitSha(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
ShaUpdate(&sha, input + idx, length);
|
||||
ShaFinal(&sha, cert->extAuthKeyId);
|
||||
wc_ShaUpdate(&sha, input + idx, length);
|
||||
wc_ShaFinal(&sha, cert->extAuthKeyId);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3789,11 +3797,11 @@ static int DecodeSubjKeyId(byte* input, int sz, DecodedCert* cert)
|
|||
}
|
||||
else {
|
||||
Sha sha;
|
||||
ret = InitSha(&sha);
|
||||
ret = wc_InitSha(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
ShaUpdate(&sha, input + idx, length);
|
||||
ShaFinal(&sha, cert->extSubjKeyId);
|
||||
wc_ShaUpdate(&sha, input + idx, length);
|
||||
wc_ShaFinal(&sha, cert->extSubjKeyId);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -5671,7 +5679,7 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
|
|||
switch (sigAlgoType) {
|
||||
#ifndef NO_MD5
|
||||
case CTC_MD5wRSA:
|
||||
if ((ret = Md5Hash(buffer, sz, digest)) == 0) {
|
||||
if ((ret = wc_Md5Hash(buffer, sz, digest)) == 0) {
|
||||
typeH = MD5h;
|
||||
digestSz = MD5_DIGEST_SIZE;
|
||||
}
|
||||
|
@ -5680,7 +5688,7 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
|
|||
#ifndef NO_SHA
|
||||
case CTC_SHAwRSA:
|
||||
case CTC_SHAwECDSA:
|
||||
if ((ret = ShaHash(buffer, sz, digest)) == 0) {
|
||||
if ((ret = wc_ShaHash(buffer, sz, digest)) == 0) {
|
||||
typeH = SHAh;
|
||||
digestSz = SHA_DIGEST_SIZE;
|
||||
}
|
||||
|
@ -5689,7 +5697,7 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
|
|||
#ifndef NO_SHA256
|
||||
case CTC_SHA256wRSA:
|
||||
case CTC_SHA256wECDSA:
|
||||
if ((ret = Sha256Hash(buffer, sz, digest)) == 0) {
|
||||
if ((ret = wc_Sha256Hash(buffer, sz, digest)) == 0) {
|
||||
typeH = SHA256h;
|
||||
digestSz = SHA256_DIGEST_SIZE;
|
||||
}
|
||||
|
@ -5716,7 +5724,7 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
|
|||
if (rsaKey) {
|
||||
/* signature */
|
||||
encSigSz = wc_EncodeSignature(encSig, digest, digestSz, typeH);
|
||||
ret = RsaSSL_Sign(encSig, encSigSz, sig, sigSz, rsaKey, rng);
|
||||
ret = wc_RsaSSL_Sign(encSig, encSigSz, sig, sigSz, rsaKey, rng);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7268,7 +7276,7 @@ int EncodeOcspRequest(OcspRequest* req)
|
|||
extSz = 0;
|
||||
if (req->useNonce) {
|
||||
RNG rng;
|
||||
if (InitRng(&rng) != 0) {
|
||||
if (wc_InitRng(&rng) != 0) {
|
||||
WOLFSSL_MSG("\tCannot initialize RNG. Skipping the OSCP Nonce.");
|
||||
} else {
|
||||
if (RNG_GenerateBlock(&rng, req->nonce, MAX_OCSP_NONCE_SZ) != 0)
|
||||
|
@ -7424,11 +7432,11 @@ WOLFSSL_LOCAL int GetNameHash(const byte* source, word32* idx, byte* hash,
|
|||
if (GetSequence(source, idx, &length, maxIdx) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
ret = InitSha(&sha);
|
||||
ret = wc_InitSha(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
ShaUpdate(&sha, source + dummy, length + *idx - dummy);
|
||||
ShaFinal(&sha, hash);
|
||||
wc_ShaUpdate(&sha, source + dummy, length + *idx - dummy);
|
||||
wc_ShaFinal(&sha, hash);
|
||||
|
||||
*idx += length;
|
||||
|
||||
|
@ -7583,9 +7591,9 @@ int ParseCRL(DecodedCRL* dcrl, const byte* buff, word32 sz, void* cm)
|
|||
/* raw crl hash */
|
||||
/* hash here if needed for optimized comparisons
|
||||
* Sha sha;
|
||||
* InitSha(&sha);
|
||||
* ShaUpdate(&sha, buff, sz);
|
||||
* ShaFinal(&sha, dcrl->crlHash); */
|
||||
* wc_InitSha(&sha);
|
||||
* wc_ShaUpdate(&sha, buff, sz);
|
||||
* wc_ShaFinal(&sha, dcrl->crlHash); */
|
||||
|
||||
if (GetSequence(buff, &idx, &len, sz) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
|
|
@ -116,14 +116,14 @@ int wc_RsaFlattenPublicKey(RsaKey* key, byte* a, word32* aSz, byte* b,
|
|||
{
|
||||
return RsaFlattenPublicKey(key, a, aSz, b, bSz);
|
||||
}
|
||||
#ifdef CYASSL_KEY_GEN
|
||||
#ifdef WOLFSSL_KEY_GEN
|
||||
int wc_MakeRsaKey(RsaKey* key, int size, long e, RNG* rng)
|
||||
{
|
||||
return MakeRsaKey(key, size, e, rng);
|
||||
}
|
||||
|
||||
|
||||
int RsaKey*ToDer(RsaKey* key, byte* output, word32 inLen)
|
||||
int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
|
||||
{
|
||||
return RsaKeyToDer(key, output, inLen);
|
||||
}
|
||||
|
@ -234,7 +234,6 @@ int wc_RsaFlattenPublicKey(RsaKey* key, byte* a, word32* aSz, byte* b,
|
|||
|
||||
#endif /* HAVE_FIPS */
|
||||
#else
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/wolfcrypt/random.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
|
|
|
@ -45,6 +45,13 @@
|
|||
|
||||
#ifndef HAVE_FIPS
|
||||
|
||||
#ifdef FREESCALE_MMCAU
|
||||
#include "cau_api.h"
|
||||
#define XTRANSFORM(S,B) cau_sha1_hash_n((B), 1, ((S))->digest)
|
||||
#else
|
||||
#define XTRANSFORM(S,B) Transform((S))
|
||||
#endif
|
||||
|
||||
#ifdef STM32F2_HASH
|
||||
/*
|
||||
* STM32F2 hardware SHA1 support through the STM32F2 standard peripheral
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
|
||||
#if !defined(NO_SHA256)
|
||||
#ifdef HAVE_FIPS
|
||||
|
||||
int wc_InitSha256(Sha256* sha)
|
||||
{
|
||||
|
@ -53,6 +54,294 @@ int wc_Sha256Hash(const byte* data, word32 len, byte* out)
|
|||
{
|
||||
return Sha256Hash(data, len, out);
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef WOLFSSL_PIC32MZ_HASH
|
||||
#define wc_InitSha256 InitSha256_sw
|
||||
#define wc_Sha256Update Sha256Update_sw
|
||||
#define wc_Sha256Final Sha256Final_sw
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
/* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
|
||||
#define FIPS_NO_WRAPPERS
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
|
||||
#ifdef NO_INLINE
|
||||
#include <wolfssl/wolfcrypt/misc.h>
|
||||
#else
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_MMCAU
|
||||
#include "cau_api.h"
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
|
||||
static INLINE word32 min(word32 a, word32 b)
|
||||
{
|
||||
return a > b ? b : a;
|
||||
}
|
||||
|
||||
#endif /* min */
|
||||
|
||||
|
||||
int wc_InitSha256(Sha256* sha256)
|
||||
{
|
||||
#ifdef FREESCALE_MMCAU
|
||||
cau_sha256_initialize_output(sha256->digest);
|
||||
#else
|
||||
sha256->digest[0] = 0x6A09E667L;
|
||||
sha256->digest[1] = 0xBB67AE85L;
|
||||
sha256->digest[2] = 0x3C6EF372L;
|
||||
sha256->digest[3] = 0xA54FF53AL;
|
||||
sha256->digest[4] = 0x510E527FL;
|
||||
sha256->digest[5] = 0x9B05688CL;
|
||||
sha256->digest[6] = 0x1F83D9ABL;
|
||||
sha256->digest[7] = 0x5BE0CD19L;
|
||||
#endif
|
||||
|
||||
sha256->buffLen = 0;
|
||||
sha256->loLen = 0;
|
||||
sha256->hiLen = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef FREESCALE_MMCAU
|
||||
#define XTRANSFORM(S,B) Transform((S), (B))
|
||||
|
||||
static int Transform(Sha256* sha256, byte* buf)
|
||||
{
|
||||
cau_sha256_hash_n(buf, 1, sha256->digest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#define XTRANSFORM(S,B) Transform((S))
|
||||
|
||||
static const word32 K[64] = {
|
||||
0x428A2F98L, 0x71374491L, 0xB5C0FBCFL, 0xE9B5DBA5L, 0x3956C25BL,
|
||||
0x59F111F1L, 0x923F82A4L, 0xAB1C5ED5L, 0xD807AA98L, 0x12835B01L,
|
||||
0x243185BEL, 0x550C7DC3L, 0x72BE5D74L, 0x80DEB1FEL, 0x9BDC06A7L,
|
||||
0xC19BF174L, 0xE49B69C1L, 0xEFBE4786L, 0x0FC19DC6L, 0x240CA1CCL,
|
||||
0x2DE92C6FL, 0x4A7484AAL, 0x5CB0A9DCL, 0x76F988DAL, 0x983E5152L,
|
||||
0xA831C66DL, 0xB00327C8L, 0xBF597FC7L, 0xC6E00BF3L, 0xD5A79147L,
|
||||
0x06CA6351L, 0x14292967L, 0x27B70A85L, 0x2E1B2138L, 0x4D2C6DFCL,
|
||||
0x53380D13L, 0x650A7354L, 0x766A0ABBL, 0x81C2C92EL, 0x92722C85L,
|
||||
0xA2BFE8A1L, 0xA81A664BL, 0xC24B8B70L, 0xC76C51A3L, 0xD192E819L,
|
||||
0xD6990624L, 0xF40E3585L, 0x106AA070L, 0x19A4C116L, 0x1E376C08L,
|
||||
0x2748774CL, 0x34B0BCB5L, 0x391C0CB3L, 0x4ED8AA4AL, 0x5B9CCA4FL,
|
||||
0x682E6FF3L, 0x748F82EEL, 0x78A5636FL, 0x84C87814L, 0x8CC70208L,
|
||||
0x90BEFFFAL, 0xA4506CEBL, 0xBEF9A3F7L, 0xC67178F2L
|
||||
};
|
||||
|
||||
#define Ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
|
||||
#define Maj(x,y,z) ((((x) | (y)) & (z)) | ((x) & (y)))
|
||||
#define S(x, n) rotrFixed(x, n)
|
||||
#define R(x, n) (((x)&0xFFFFFFFFU)>>(n))
|
||||
#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22))
|
||||
#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25))
|
||||
#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3))
|
||||
#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10))
|
||||
|
||||
#define RND(a,b,c,d,e,f,g,h,i) \
|
||||
t0 = (h) + Sigma1((e)) + Ch((e), (f), (g)) + K[(i)] + W[(i)]; \
|
||||
t1 = Sigma0((a)) + Maj((a), (b), (c)); \
|
||||
(d) += t0; \
|
||||
(h) = t0 + t1;
|
||||
|
||||
|
||||
static int Transform(Sha256* sha256)
|
||||
{
|
||||
word32 S[8], t0, t1;
|
||||
int i;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
word32* W;
|
||||
|
||||
W = (word32*) XMALLOC(sizeof(word32) * 64, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (W == NULL)
|
||||
return MEMORY_E;
|
||||
#else
|
||||
word32 W[64];
|
||||
#endif
|
||||
|
||||
/* Copy context->state[] to working vars */
|
||||
for (i = 0; i < 8; i++)
|
||||
S[i] = sha256->digest[i];
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
W[i] = sha256->buffer[i];
|
||||
|
||||
for (i = 16; i < 64; i++)
|
||||
W[i] = Gamma1(W[i-2]) + W[i-7] + Gamma0(W[i-15]) + W[i-16];
|
||||
|
||||
for (i = 0; i < 64; i += 8) {
|
||||
RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0);
|
||||
RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1);
|
||||
RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2);
|
||||
RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3);
|
||||
RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4);
|
||||
RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5);
|
||||
RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6);
|
||||
RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7);
|
||||
}
|
||||
|
||||
/* Add the working vars back into digest state[] */
|
||||
for (i = 0; i < 8; i++) {
|
||||
sha256->digest[i] += S[i];
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(W, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* FREESCALE_MMCAU */
|
||||
|
||||
|
||||
static INLINE void AddLength(Sha256* sha256, word32 len)
|
||||
{
|
||||
word32 tmp = sha256->loLen;
|
||||
if ( (sha256->loLen += len) < tmp)
|
||||
sha256->hiLen++; /* carry low to high */
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha256Update(Sha256* sha256, const byte* data, word32 len)
|
||||
{
|
||||
/* do block size increments */
|
||||
byte* local = (byte*)sha256->buffer;
|
||||
|
||||
while (len) {
|
||||
word32 add = min(len, SHA256_BLOCK_SIZE - sha256->buffLen);
|
||||
XMEMCPY(&local[sha256->buffLen], data, add);
|
||||
|
||||
sha256->buffLen += add;
|
||||
data += add;
|
||||
len -= add;
|
||||
|
||||
if (sha256->buffLen == SHA256_BLOCK_SIZE) {
|
||||
int ret;
|
||||
|
||||
#if defined(LITTLE_ENDIAN_ORDER) && !defined(FREESCALE_MMCAU)
|
||||
ByteReverseWords(sha256->buffer, sha256->buffer,
|
||||
SHA256_BLOCK_SIZE);
|
||||
#endif
|
||||
|
||||
ret = XTRANSFORM(sha256, local);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
AddLength(sha256, SHA256_BLOCK_SIZE);
|
||||
sha256->buffLen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha256Final(Sha256* sha256, byte* hash)
|
||||
{
|
||||
byte* local = (byte*)sha256->buffer;
|
||||
int ret;
|
||||
|
||||
AddLength(sha256, sha256->buffLen); /* before adding pads */
|
||||
|
||||
local[sha256->buffLen++] = 0x80; /* add 1 */
|
||||
|
||||
/* pad with zeros */
|
||||
if (sha256->buffLen > SHA256_PAD_SIZE) {
|
||||
XMEMSET(&local[sha256->buffLen], 0, SHA256_BLOCK_SIZE - sha256->buffLen);
|
||||
sha256->buffLen += SHA256_BLOCK_SIZE - sha256->buffLen;
|
||||
|
||||
#if defined(LITTLE_ENDIAN_ORDER) && !defined(FREESCALE_MMCAU)
|
||||
ByteReverseWords(sha256->buffer, sha256->buffer, SHA256_BLOCK_SIZE);
|
||||
#endif
|
||||
|
||||
ret = XTRANSFORM(sha256, local);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
sha256->buffLen = 0;
|
||||
}
|
||||
XMEMSET(&local[sha256->buffLen], 0, SHA256_PAD_SIZE - sha256->buffLen);
|
||||
|
||||
/* put lengths in bits */
|
||||
sha256->hiLen = (sha256->loLen >> (8*sizeof(sha256->loLen) - 3)) +
|
||||
(sha256->hiLen << 3);
|
||||
sha256->loLen = sha256->loLen << 3;
|
||||
|
||||
/* store lengths */
|
||||
#if defined(LITTLE_ENDIAN_ORDER) && !defined(FREESCALE_MMCAU)
|
||||
ByteReverseWords(sha256->buffer, sha256->buffer, SHA256_BLOCK_SIZE);
|
||||
#endif
|
||||
/* ! length ordering dependent on digest endian type ! */
|
||||
XMEMCPY(&local[SHA256_PAD_SIZE], &sha256->hiLen, sizeof(word32));
|
||||
XMEMCPY(&local[SHA256_PAD_SIZE + sizeof(word32)], &sha256->loLen,
|
||||
sizeof(word32));
|
||||
|
||||
#ifdef FREESCALE_MMCAU
|
||||
/* Kinetis requires only these bytes reversed */
|
||||
ByteReverseWords(&sha256->buffer[SHA256_PAD_SIZE/sizeof(word32)],
|
||||
&sha256->buffer[SHA256_PAD_SIZE/sizeof(word32)],
|
||||
2 * sizeof(word32));
|
||||
#endif
|
||||
|
||||
ret = XTRANSFORM(sha256, local);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords(sha256->digest, sha256->digest, SHA256_DIGEST_SIZE);
|
||||
#endif
|
||||
XMEMCPY(hash, sha256->digest, SHA256_DIGEST_SIZE);
|
||||
|
||||
return wc_InitSha256(sha256); /* reset state */
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha256Hash(const byte* data, word32 len, byte* hash)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
Sha256* sha256;
|
||||
#else
|
||||
Sha256 sha256[1];
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
sha256 = (Sha256*)XMALLOC(sizeof(Sha256), NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (sha256 == NULL)
|
||||
return MEMORY_E;
|
||||
#endif
|
||||
|
||||
if ((ret = wc_InitSha256(sha256)) != 0) {
|
||||
WOLFSSL_MSG("InitSha256 failed");
|
||||
}
|
||||
else if ((ret = wc_Sha256Update(sha256, data, len)) != 0) {
|
||||
WOLFSSL_MSG("Sha256Update failed");
|
||||
}
|
||||
else if ((ret = wc_Sha256Final(sha256, hash)) != 0) {
|
||||
WOLFSSL_MSG("Sha256Final failed");
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(sha256, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
#endif /* NO_SHA256 */
|
||||
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/wolfcrypt/sha512.h>
|
||||
|
||||
#if defined(WOLFSSL_SHA512) || defined(CYASSL_SHA512)
|
||||
#ifdef WOLFSSL_SHA512
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
int wc_InitSha512(Sha512* sha)
|
||||
{
|
||||
return InitSha512(sha);
|
||||
|
@ -51,7 +52,7 @@ int wc_Sha512Hash(const byte* data, word32 len, byte* out)
|
|||
return Sha512Hash(data, len, out);
|
||||
}
|
||||
|
||||
#if defined(CYASSL_SHA384) || defined(WOLFSSL_SHA384) || defined(HAVE_AESGCM)
|
||||
#if defined(WOLFSSL_SHA384) || defined(HAVE_AESGCM)
|
||||
|
||||
int wc_InitSha384(Sha384* sha)
|
||||
{
|
||||
|
@ -75,8 +76,515 @@ int wc_Sha384Hash(const byte* data, word32 len, byte* out)
|
|||
{
|
||||
return Sha384Hash(data, len, out);
|
||||
}
|
||||
#endif /* WOLFSSL_SHA384 */
|
||||
#else
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
|
||||
#ifdef NO_INLINE
|
||||
#include <wolfssl/wolfcrypt/misc.h>
|
||||
#else
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef min
|
||||
|
||||
static INLINE word32 min(word32 a, word32 b)
|
||||
{
|
||||
return a > b ? b : a;
|
||||
}
|
||||
|
||||
#endif /* min */
|
||||
|
||||
|
||||
int wc_InitSha512(Sha512* sha512)
|
||||
{
|
||||
sha512->digest[0] = W64LIT(0x6a09e667f3bcc908);
|
||||
sha512->digest[1] = W64LIT(0xbb67ae8584caa73b);
|
||||
sha512->digest[2] = W64LIT(0x3c6ef372fe94f82b);
|
||||
sha512->digest[3] = W64LIT(0xa54ff53a5f1d36f1);
|
||||
sha512->digest[4] = W64LIT(0x510e527fade682d1);
|
||||
sha512->digest[5] = W64LIT(0x9b05688c2b3e6c1f);
|
||||
sha512->digest[6] = W64LIT(0x1f83d9abfb41bd6b);
|
||||
sha512->digest[7] = W64LIT(0x5be0cd19137e2179);
|
||||
|
||||
sha512->buffLen = 0;
|
||||
sha512->loLen = 0;
|
||||
sha512->hiLen = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const word64 K512[80] = {
|
||||
W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd),
|
||||
W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc),
|
||||
W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019),
|
||||
W64LIT(0x923f82a4af194f9b), W64LIT(0xab1c5ed5da6d8118),
|
||||
W64LIT(0xd807aa98a3030242), W64LIT(0x12835b0145706fbe),
|
||||
W64LIT(0x243185be4ee4b28c), W64LIT(0x550c7dc3d5ffb4e2),
|
||||
W64LIT(0x72be5d74f27b896f), W64LIT(0x80deb1fe3b1696b1),
|
||||
W64LIT(0x9bdc06a725c71235), W64LIT(0xc19bf174cf692694),
|
||||
W64LIT(0xe49b69c19ef14ad2), W64LIT(0xefbe4786384f25e3),
|
||||
W64LIT(0x0fc19dc68b8cd5b5), W64LIT(0x240ca1cc77ac9c65),
|
||||
W64LIT(0x2de92c6f592b0275), W64LIT(0x4a7484aa6ea6e483),
|
||||
W64LIT(0x5cb0a9dcbd41fbd4), W64LIT(0x76f988da831153b5),
|
||||
W64LIT(0x983e5152ee66dfab), W64LIT(0xa831c66d2db43210),
|
||||
W64LIT(0xb00327c898fb213f), W64LIT(0xbf597fc7beef0ee4),
|
||||
W64LIT(0xc6e00bf33da88fc2), W64LIT(0xd5a79147930aa725),
|
||||
W64LIT(0x06ca6351e003826f), W64LIT(0x142929670a0e6e70),
|
||||
W64LIT(0x27b70a8546d22ffc), W64LIT(0x2e1b21385c26c926),
|
||||
W64LIT(0x4d2c6dfc5ac42aed), W64LIT(0x53380d139d95b3df),
|
||||
W64LIT(0x650a73548baf63de), W64LIT(0x766a0abb3c77b2a8),
|
||||
W64LIT(0x81c2c92e47edaee6), W64LIT(0x92722c851482353b),
|
||||
W64LIT(0xa2bfe8a14cf10364), W64LIT(0xa81a664bbc423001),
|
||||
W64LIT(0xc24b8b70d0f89791), W64LIT(0xc76c51a30654be30),
|
||||
W64LIT(0xd192e819d6ef5218), W64LIT(0xd69906245565a910),
|
||||
W64LIT(0xf40e35855771202a), W64LIT(0x106aa07032bbd1b8),
|
||||
W64LIT(0x19a4c116b8d2d0c8), W64LIT(0x1e376c085141ab53),
|
||||
W64LIT(0x2748774cdf8eeb99), W64LIT(0x34b0bcb5e19b48a8),
|
||||
W64LIT(0x391c0cb3c5c95a63), W64LIT(0x4ed8aa4ae3418acb),
|
||||
W64LIT(0x5b9cca4f7763e373), W64LIT(0x682e6ff3d6b2b8a3),
|
||||
W64LIT(0x748f82ee5defb2fc), W64LIT(0x78a5636f43172f60),
|
||||
W64LIT(0x84c87814a1f0ab72), W64LIT(0x8cc702081a6439ec),
|
||||
W64LIT(0x90befffa23631e28), W64LIT(0xa4506cebde82bde9),
|
||||
W64LIT(0xbef9a3f7b2c67915), W64LIT(0xc67178f2e372532b),
|
||||
W64LIT(0xca273eceea26619c), W64LIT(0xd186b8c721c0c207),
|
||||
W64LIT(0xeada7dd6cde0eb1e), W64LIT(0xf57d4f7fee6ed178),
|
||||
W64LIT(0x06f067aa72176fba), W64LIT(0x0a637dc5a2c898a6),
|
||||
W64LIT(0x113f9804bef90dae), W64LIT(0x1b710b35131c471b),
|
||||
W64LIT(0x28db77f523047d84), W64LIT(0x32caab7b40c72493),
|
||||
W64LIT(0x3c9ebe0a15c9bebc), W64LIT(0x431d67c49c100d4c),
|
||||
W64LIT(0x4cc5d4becb3e42b6), W64LIT(0x597f299cfc657e2a),
|
||||
W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817)
|
||||
};
|
||||
|
||||
|
||||
#define blk0(i) (W[i] = sha512->buffer[i])
|
||||
#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
|
||||
|
||||
#define Ch(x,y,z) (z^(x&(y^z)))
|
||||
#define Maj(x,y,z) ((x&y)|(z&(x|y)))
|
||||
|
||||
#define a(i) T[(0-i)&7]
|
||||
#define b(i) T[(1-i)&7]
|
||||
#define c(i) T[(2-i)&7]
|
||||
#define d(i) T[(3-i)&7]
|
||||
#define e(i) T[(4-i)&7]
|
||||
#define f(i) T[(5-i)&7]
|
||||
#define g(i) T[(6-i)&7]
|
||||
#define h(i) T[(7-i)&7]
|
||||
|
||||
#define S0(x) (rotrFixed64(x,28)^rotrFixed64(x,34)^rotrFixed64(x,39))
|
||||
#define S1(x) (rotrFixed64(x,14)^rotrFixed64(x,18)^rotrFixed64(x,41))
|
||||
#define s0(x) (rotrFixed64(x,1)^rotrFixed64(x,8)^(x>>7))
|
||||
#define s1(x) (rotrFixed64(x,19)^rotrFixed64(x,61)^(x>>6))
|
||||
|
||||
#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+K[i+j]+(j?blk2(i):blk0(i));\
|
||||
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
|
||||
|
||||
#define blk384(i) (W[i] = sha384->buffer[i])
|
||||
|
||||
#define R2(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+K[i+j]+(j?blk2(i):blk384(i));\
|
||||
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
|
||||
|
||||
|
||||
static int Transform(Sha512* sha512)
|
||||
{
|
||||
const word64* K = K512;
|
||||
|
||||
word32 j;
|
||||
word64 T[8];
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
word64* W;
|
||||
|
||||
W = (word64*) XMALLOC(sizeof(word64) * 16, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (W == NULL)
|
||||
return MEMORY_E;
|
||||
#else
|
||||
word64 W[16];
|
||||
#endif
|
||||
|
||||
/* Copy digest to working vars */
|
||||
XMEMCPY(T, sha512->digest, sizeof(T));
|
||||
|
||||
#ifdef USE_SLOW_SHA2
|
||||
/* over twice as small, but 50% slower */
|
||||
/* 80 operations, not unrolled */
|
||||
for (j = 0; j < 80; j += 16) {
|
||||
int m;
|
||||
for (m = 0; m < 16; m++) { /* braces needed here for macros {} */
|
||||
R(m);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* 80 operations, partially loop unrolled */
|
||||
for (j = 0; j < 80; j += 16) {
|
||||
R( 0); R( 1); R( 2); R( 3);
|
||||
R( 4); R( 5); R( 6); R( 7);
|
||||
R( 8); R( 9); R(10); R(11);
|
||||
R(12); R(13); R(14); R(15);
|
||||
}
|
||||
#endif /* USE_SLOW_SHA2 */
|
||||
|
||||
/* Add the working vars back into digest */
|
||||
|
||||
sha512->digest[0] += a(0);
|
||||
sha512->digest[1] += b(0);
|
||||
sha512->digest[2] += c(0);
|
||||
sha512->digest[3] += d(0);
|
||||
sha512->digest[4] += e(0);
|
||||
sha512->digest[5] += f(0);
|
||||
sha512->digest[6] += g(0);
|
||||
sha512->digest[7] += h(0);
|
||||
|
||||
/* Wipe variables */
|
||||
XMEMSET(W, 0, sizeof(word64) * 16);
|
||||
XMEMSET(T, 0, sizeof(T));
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(W, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static INLINE void AddLength(Sha512* sha512, word32 len)
|
||||
{
|
||||
word32 tmp = sha512->loLen;
|
||||
if ( (sha512->loLen += len) < tmp)
|
||||
sha512->hiLen++; /* carry low to high */
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha512Update(Sha512* sha512, const byte* data, word32 len)
|
||||
{
|
||||
/* do block size increments */
|
||||
byte* local = (byte*)sha512->buffer;
|
||||
|
||||
while (len) {
|
||||
word32 add = min(len, SHA512_BLOCK_SIZE - sha512->buffLen);
|
||||
XMEMCPY(&local[sha512->buffLen], data, add);
|
||||
|
||||
sha512->buffLen += add;
|
||||
data += add;
|
||||
len -= add;
|
||||
|
||||
if (sha512->buffLen == SHA512_BLOCK_SIZE) {
|
||||
int ret;
|
||||
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords64(sha512->buffer, sha512->buffer,
|
||||
SHA512_BLOCK_SIZE);
|
||||
#endif
|
||||
ret = Transform(sha512);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
AddLength(sha512, SHA512_BLOCK_SIZE);
|
||||
sha512->buffLen = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha512Final(Sha512* sha512, byte* hash)
|
||||
{
|
||||
byte* local = (byte*)sha512->buffer;
|
||||
int ret;
|
||||
|
||||
AddLength(sha512, sha512->buffLen); /* before adding pads */
|
||||
|
||||
local[sha512->buffLen++] = 0x80; /* add 1 */
|
||||
|
||||
/* pad with zeros */
|
||||
if (sha512->buffLen > SHA512_PAD_SIZE) {
|
||||
XMEMSET(&local[sha512->buffLen], 0, SHA512_BLOCK_SIZE -sha512->buffLen);
|
||||
sha512->buffLen += SHA512_BLOCK_SIZE - sha512->buffLen;
|
||||
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords64(sha512->buffer,sha512->buffer,SHA512_BLOCK_SIZE);
|
||||
#endif
|
||||
ret = Transform(sha512);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
sha512->buffLen = 0;
|
||||
}
|
||||
XMEMSET(&local[sha512->buffLen], 0, SHA512_PAD_SIZE - sha512->buffLen);
|
||||
|
||||
/* put lengths in bits */
|
||||
sha512->hiLen = (sha512->loLen >> (8*sizeof(sha512->loLen) - 3)) +
|
||||
(sha512->hiLen << 3);
|
||||
sha512->loLen = sha512->loLen << 3;
|
||||
|
||||
/* store lengths */
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords64(sha512->buffer, sha512->buffer, SHA512_PAD_SIZE);
|
||||
#endif
|
||||
/* ! length ordering dependent on digest endian type ! */
|
||||
sha512->buffer[SHA512_BLOCK_SIZE / sizeof(word64) - 2] = sha512->hiLen;
|
||||
sha512->buffer[SHA512_BLOCK_SIZE / sizeof(word64) - 1] = sha512->loLen;
|
||||
|
||||
ret = Transform(sha512);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords64(sha512->digest, sha512->digest, SHA512_DIGEST_SIZE);
|
||||
#endif
|
||||
XMEMCPY(hash, sha512->digest, SHA512_DIGEST_SIZE);
|
||||
|
||||
return wc_InitSha512(sha512); /* reset state */
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha512Hash(const byte* data, word32 len, byte* hash)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
Sha512* sha512;
|
||||
#else
|
||||
Sha512 sha512[1];
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
sha512 = (Sha512*)XMALLOC(sizeof(Sha512), NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (sha512 == NULL)
|
||||
return MEMORY_E;
|
||||
#endif
|
||||
|
||||
if ((ret = wc_InitSha512(sha512)) != 0) {
|
||||
WOLFSSL_MSG("InitSha512 failed");
|
||||
}
|
||||
else if ((ret = wc_Sha512Update(sha512, data, len)) != 0) {
|
||||
WOLFSSL_MSG("Sha512Update failed");
|
||||
}
|
||||
else if ((ret = wc_Sha512Final(sha512, hash)) != 0) {
|
||||
WOLFSSL_MSG("Sha512Final failed");
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(sha512, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifdef WOLFSSL_SHA384
|
||||
|
||||
int wc_InitSha384(Sha384* sha384)
|
||||
{
|
||||
sha384->digest[0] = W64LIT(0xcbbb9d5dc1059ed8);
|
||||
sha384->digest[1] = W64LIT(0x629a292a367cd507);
|
||||
sha384->digest[2] = W64LIT(0x9159015a3070dd17);
|
||||
sha384->digest[3] = W64LIT(0x152fecd8f70e5939);
|
||||
sha384->digest[4] = W64LIT(0x67332667ffc00b31);
|
||||
sha384->digest[5] = W64LIT(0x8eb44a8768581511);
|
||||
sha384->digest[6] = W64LIT(0xdb0c2e0d64f98fa7);
|
||||
sha384->digest[7] = W64LIT(0x47b5481dbefa4fa4);
|
||||
|
||||
sha384->buffLen = 0;
|
||||
sha384->loLen = 0;
|
||||
sha384->hiLen = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int Transform384(Sha384* sha384)
|
||||
{
|
||||
const word64* K = K512;
|
||||
|
||||
word32 j;
|
||||
word64 T[8];
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
word64* W;
|
||||
|
||||
W = (word64*) XMALLOC(sizeof(word64) * 16, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (W == NULL)
|
||||
return MEMORY_E;
|
||||
#else
|
||||
word64 W[16];
|
||||
#endif
|
||||
|
||||
/* Copy digest to working vars */
|
||||
XMEMCPY(T, sha384->digest, sizeof(T));
|
||||
|
||||
#ifdef USE_SLOW_SHA2
|
||||
/* over twice as small, but 50% slower */
|
||||
/* 80 operations, not unrolled */
|
||||
for (j = 0; j < 80; j += 16) {
|
||||
int m;
|
||||
for (m = 0; m < 16; m++) { /* braces needed for macros {} */
|
||||
R2(m);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* 80 operations, partially loop unrolled */
|
||||
for (j = 0; j < 80; j += 16) {
|
||||
R2( 0); R2( 1); R2( 2); R2( 3);
|
||||
R2( 4); R2( 5); R2( 6); R2( 7);
|
||||
R2( 8); R2( 9); R2(10); R2(11);
|
||||
R2(12); R2(13); R2(14); R2(15);
|
||||
}
|
||||
#endif /* USE_SLOW_SHA2 */
|
||||
|
||||
/* Add the working vars back into digest */
|
||||
|
||||
sha384->digest[0] += a(0);
|
||||
sha384->digest[1] += b(0);
|
||||
sha384->digest[2] += c(0);
|
||||
sha384->digest[3] += d(0);
|
||||
sha384->digest[4] += e(0);
|
||||
sha384->digest[5] += f(0);
|
||||
sha384->digest[6] += g(0);
|
||||
sha384->digest[7] += h(0);
|
||||
|
||||
/* Wipe variables */
|
||||
XMEMSET(W, 0, sizeof(word64) * 16);
|
||||
XMEMSET(T, 0, sizeof(T));
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(W, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static INLINE void AddLength384(Sha384* sha384, word32 len)
|
||||
{
|
||||
word32 tmp = sha384->loLen;
|
||||
if ( (sha384->loLen += len) < tmp)
|
||||
sha384->hiLen++; /* carry low to high */
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha384Update(Sha384* sha384, const byte* data, word32 len)
|
||||
{
|
||||
/* do block size increments */
|
||||
byte* local = (byte*)sha384->buffer;
|
||||
|
||||
while (len) {
|
||||
word32 add = min(len, SHA384_BLOCK_SIZE - sha384->buffLen);
|
||||
XMEMCPY(&local[sha384->buffLen], data, add);
|
||||
|
||||
sha384->buffLen += add;
|
||||
data += add;
|
||||
len -= add;
|
||||
|
||||
if (sha384->buffLen == SHA384_BLOCK_SIZE) {
|
||||
int ret;
|
||||
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords64(sha384->buffer, sha384->buffer,
|
||||
SHA384_BLOCK_SIZE);
|
||||
#endif
|
||||
ret = Transform384(sha384);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
AddLength384(sha384, SHA384_BLOCK_SIZE);
|
||||
sha384->buffLen = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha384Final(Sha384* sha384, byte* hash)
|
||||
{
|
||||
byte* local = (byte*)sha384->buffer;
|
||||
int ret;
|
||||
|
||||
AddLength384(sha384, sha384->buffLen); /* before adding pads */
|
||||
|
||||
local[sha384->buffLen++] = 0x80; /* add 1 */
|
||||
|
||||
/* pad with zeros */
|
||||
if (sha384->buffLen > SHA384_PAD_SIZE) {
|
||||
XMEMSET(&local[sha384->buffLen], 0, SHA384_BLOCK_SIZE -sha384->buffLen);
|
||||
sha384->buffLen += SHA384_BLOCK_SIZE - sha384->buffLen;
|
||||
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords64(sha384->buffer,sha384->buffer,SHA384_BLOCK_SIZE);
|
||||
#endif
|
||||
ret = Transform384(sha384);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
sha384->buffLen = 0;
|
||||
}
|
||||
XMEMSET(&local[sha384->buffLen], 0, SHA384_PAD_SIZE - sha384->buffLen);
|
||||
|
||||
/* put lengths in bits */
|
||||
sha384->hiLen = (sha384->loLen >> (8*sizeof(sha384->loLen) - 3)) +
|
||||
(sha384->hiLen << 3);
|
||||
sha384->loLen = sha384->loLen << 3;
|
||||
|
||||
/* store lengths */
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords64(sha384->buffer, sha384->buffer, SHA384_PAD_SIZE);
|
||||
#endif
|
||||
/* ! length ordering dependent on digest endian type ! */
|
||||
sha384->buffer[SHA384_BLOCK_SIZE / sizeof(word64) - 2] = sha384->hiLen;
|
||||
sha384->buffer[SHA384_BLOCK_SIZE / sizeof(word64) - 1] = sha384->loLen;
|
||||
|
||||
ret = Transform384(sha384);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords64(sha384->digest, sha384->digest, SHA384_DIGEST_SIZE);
|
||||
#endif
|
||||
XMEMCPY(hash, sha384->digest, SHA384_DIGEST_SIZE);
|
||||
|
||||
return wc_InitSha384(sha384); /* reset state */
|
||||
}
|
||||
|
||||
|
||||
int wc_Sha384Hash(const byte* data, word32 len, byte* hash)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
Sha384* sha384;
|
||||
#else
|
||||
Sha384 sha384[1];
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
sha384 = (Sha384*)XMALLOC(sizeof(Sha384), NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (sha384 == NULL)
|
||||
return MEMORY_E;
|
||||
#endif
|
||||
|
||||
if ((ret = wc_InitSha384(sha384)) != 0) {
|
||||
WOLFSSL_MSG("InitSha384 failed");
|
||||
}
|
||||
else if ((ret = wc_Sha384Update(sha384, data, len)) != 0) {
|
||||
WOLFSSL_MSG("Sha384Update failed");
|
||||
}
|
||||
else if ((ret = wc_Sha384Final(sha384, hash)) != 0) {
|
||||
WOLFSSL_MSG("Sha384Final failed");
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(sha384, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_SHA384 */
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
#endif /* WOLFSSL_SHA512 */
|
||||
|
||||
|
|
|
@ -66,12 +66,13 @@
|
|||
#if !defined (ALIGN16)
|
||||
#define ALIGN16
|
||||
#endif
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_FIPS
|
||||
#define WOLFSSL_AES_CAVIUM_MAGIC 0xBEEF0002
|
||||
|
||||
enum {
|
||||
|
|
|
@ -29,12 +29,57 @@
|
|||
#include <wolfssl/wolfcrypt/rsa.h>
|
||||
#endif
|
||||
|
||||
/* compatibility for fips @wc_fips */
|
||||
#ifdef HAVE_FIPS
|
||||
#include <cyassl/ctaocrypt/asn_public.h>
|
||||
#ifdef WOLFSSL_CERT_GEN
|
||||
#define wc_InitCert InitCert
|
||||
#define wc_MakeCert MakeCert
|
||||
|
||||
#ifdef WOLFSSL_CERT_REQ
|
||||
#define wc_MakeCertReq MakeCertReq
|
||||
#endif
|
||||
|
||||
#define wc_SignCert SignCert
|
||||
#define wc_MakeSelfCert MakeSelfCert
|
||||
#define wc_SetIssuer SetIssuer
|
||||
#define wc_SetSubject SetSubject
|
||||
|
||||
#ifdef WOLFSSL_ALT_NAMES
|
||||
#define wc_SetAltNames SetAltNames
|
||||
#endif
|
||||
|
||||
#define wc_SetIssuerBuffer SetIssuerBuffer
|
||||
#define wc_SetSubjectBuffer SetSubjectBuffer
|
||||
#define wc_SetAltNamesBuffer SetAltNamesBuffer
|
||||
#define wc_SetDatesBuffer SetDatesBuffer
|
||||
|
||||
#ifdef HAVE_NTRU
|
||||
#define wc_MakeNtruCert MakeNtruCert
|
||||
#endif
|
||||
|
||||
#endif /* WOLFSSL_CERT_GEN */
|
||||
|
||||
#if defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN)
|
||||
#define wc_DerToPem DerToPem
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
/* private key helpers */
|
||||
#define wc_EccPrivateKeyDecode EccPrivateKeyDecode
|
||||
#define wc_EccKeyToDer EccKeyToDer
|
||||
#endif
|
||||
|
||||
/* DER encode signature */
|
||||
#define wc_EncodeSignature EncodeSignature
|
||||
#define wc_GetCTC_HashOID GetCTC_HashOID
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_FIPS
|
||||
/* Certificate file Type */
|
||||
enum CertType {
|
||||
CERT_TYPE = 0,
|
||||
|
@ -125,8 +170,12 @@ typedef struct Cert {
|
|||
char challengePw[CTC_NAME_SIZE];
|
||||
#endif
|
||||
} Cert;
|
||||
#endif /* WOLFSSL_CERT_GEN */
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
|
||||
#ifdef WOLFSSL_CERT_GEN
|
||||
|
||||
|
||||
|
||||
/* Initialize and Set Certficate defaults:
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
|
||||
#ifndef NO_MD5
|
||||
#include <wolfssl/wolfcrypt/md5.h>
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef WOLF_CRYPT_RSA_H
|
||||
#define WOLF_CRYPT_RSA_H
|
||||
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
/* for fips @wc_fips */
|
||||
#include <cyassl/ctaocrypt/rsa.h>
|
||||
|
@ -31,7 +33,6 @@
|
|||
#define WOLFSSL_KEY_GEN
|
||||
#endif
|
||||
#else
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
#include <wolfssl/wolfcrypt/integer.h>
|
||||
#include <wolfssl/wolfcrypt/random.h>
|
||||
#endif
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CYASSL_SHA512
|
||||
//WOLFSSL_SHA512
|
||||
#define CYASSL_SHA384
|
||||
//WOLFSSL_SHA384
|
||||
|
||||
/* Uncomment next line if using IPHONE */
|
||||
/* #define IPHONE */
|
||||
|
||||
|
|
|
@ -28,12 +28,45 @@
|
|||
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
/* for fips */
|
||||
#include <cyassl/ctaocrypt/sha.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifndef HAVE_FIPS
|
||||
|
||||
/* in bytes */
|
||||
enum {
|
||||
#ifdef STM32F2_HASH
|
||||
SHA_REG_SIZE = 4, /* STM32 register size, bytes */
|
||||
#endif
|
||||
SHA = 1, /* hash type unique */
|
||||
SHA_BLOCK_SIZE = 64,
|
||||
SHA_DIGEST_SIZE = 20,
|
||||
SHA_PAD_SIZE = 56
|
||||
};
|
||||
|
||||
#ifdef WOLFSSL_PIC32MZ_HASH
|
||||
#include "port/pic32/pic32mz-crypt.h"
|
||||
#endif
|
||||
|
||||
/* Sha digest */
|
||||
typedef struct Sha {
|
||||
word32 buffLen; /* in bytes */
|
||||
word32 loLen; /* length in bytes */
|
||||
word32 hiLen; /* length in bytes */
|
||||
word32 buffer[SHA_BLOCK_SIZE / sizeof(word32)];
|
||||
#ifndef WOLFSSL_PIC32MZ_HASH
|
||||
word32 digest[SHA_DIGEST_SIZE / sizeof(word32)];
|
||||
#else
|
||||
word32 digest[PIC32_HASH_SIZE / sizeof(word32)];
|
||||
pic32mz_desc desc; /* Crypt Engine descripter */
|
||||
#endif
|
||||
} Sha;
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
WOLFSSL_API int wc_InitSha(Sha*);
|
||||
WOLFSSL_API int wc_ShaUpdate(Sha*, const byte*, word32);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define WOLFSSL_SHA384
|
||||
#endif
|
||||
|
||||
//#ifdef WOLFSSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
|
||||
#ifndef WOLF_CRYPT_SHA512_H
|
||||
#define WOLF_CRYPT_SHA512_H
|
||||
|
@ -77,7 +77,7 @@ WOLFSSL_API int wc_Sha512Update(Sha512*, const byte*, word32);
|
|||
WOLFSSL_API int wc_Sha512Final(Sha512*, byte*);
|
||||
WOLFSSL_API int wc_Sha512Hash(const byte*, word32, byte*);
|
||||
|
||||
//#if defined(WOLFSSL_SHA384) || defined(HAVE_AESGCM)
|
||||
#if defined(WOLFSSL_SHA384) || defined(HAVE_AESGCM)
|
||||
|
||||
#ifndef HAVE_FIPS
|
||||
/* in bytes */
|
||||
|
@ -131,12 +131,12 @@ WOLFSSL_API int wc_Sha384Hash(const byte*, word32, byte*);
|
|||
#endif /* HAVE_FIPS */
|
||||
|
||||
|
||||
//#endif /* WOLFSSL_SHA384 */
|
||||
#endif /* WOLFSSL_SHA384 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* WOLF_CRYPT_SHA512_H */
|
||||
//#endif /* WOLFSSL_SHA512 */
|
||||
#endif /* WOLFSSL_SHA512 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue