wolf c files for des, hmac, random, and rsa
This commit is contained in:
parent
aa0d339b05
commit
50eee6afdf
@ -455,7 +455,11 @@
|
||||
|
||||
|
||||
/* for pwdbased reverse compatibility */
|
||||
|
||||
#ifndef NO_PWDBASED
|
||||
#define PBKDF1 wc_PBKDF1
|
||||
#define PBKDF2 wc_PBKDF2
|
||||
#define PKCS12_PBKDF wc_PKCS12_PBKDF
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
160
wolfcrypt/src/des3.c
Normal file
160
wolfcrypt/src/des3.c
Normal file
@ -0,0 +1,160 @@
|
||||
/* des3.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/settings.h>
|
||||
|
||||
#ifndef NO_DES3
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
/* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
|
||||
#define FIPS_NO_WRAPPERS
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/des3.h>
|
||||
#include <cyassl/ctaocrypt/error-crypt.h>
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
|
||||
#ifdef NO_INLINE
|
||||
#include <cyassl/ctaocrypt/misc.h>
|
||||
#else
|
||||
#include <ctaocrypt/src/misc.c>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
static int wc_Des3_CaviumSetKey(Des3* des3, const byte* key, const byte* iv);
|
||||
static int wc_Des3_CaviumCbcEncrypt(Des3* des3, byte* out, const byte* in,
|
||||
word32 length);
|
||||
static int wc_Des3_CaviumCbcDecrypt(Des3* des3, byte* out, const byte* in,
|
||||
word32 length);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int wc_Des_SetKey(Des* des, const byte* key, const byte* iv, int dir)
|
||||
{
|
||||
return Des_SetKey(des, key, iv, dir);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des3_SetKey(Des3* des, const byte* key, const byte* iv, int dir)
|
||||
{
|
||||
return Des3_SetKey(des, key, iv, dir);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des_CbcEncrypt(Des* des, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
return Des_CbcEncrypt(des, out, in, sz);
|
||||
}
|
||||
|
||||
|
||||
void wc_DesCrypt(word32 *key, word32 *iv, byte* out, const byte* in, word32 sz,
|
||||
int dir, int algo, int cryptoalgo)
|
||||
{
|
||||
DesCrypt(key, iv, out, in, sz, dir, algo, cryptoalgo);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des_CbcEncrypt(Des* des, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
return Des_CbcEncrypt(des, out, in, sz);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des_CbcDecrypt(Des* des, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
return Des_CbcDecrypt(des, out, in, sz);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des3_CbcEncrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
return Des3_CbcEncrypt(des, out, in, sz);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des3_CbcDecrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
return Des3_CbcDecrypt(des, out, in, sz);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CYASSL_DES_ECB
|
||||
|
||||
/* One block, compatibility only */
|
||||
int wc_Des_EcbEncrypt(Des* des, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
return Des_EcbEncrypt(des, out, in, sz);
|
||||
}
|
||||
|
||||
#endif /* CYASSL_DES_ECB */
|
||||
|
||||
|
||||
void wc_Des_SetIV(Des* des, const byte* iv)
|
||||
{
|
||||
Des_SetIV(des, iv);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des_CbcDecryptWithKey(byte* out, const byte* in, word32 sz,
|
||||
const byte* key, const byte* iv)
|
||||
{
|
||||
return Des_CbcDecryptWithKey(out, in, sz, key, iv);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des3_SetIV(Des3* des, const byte* iv)
|
||||
{
|
||||
return Des3_SetIV(des, iv);
|
||||
}
|
||||
|
||||
|
||||
int wc_Des3_CbcDecryptWithKey(byte* out, const byte* in, word32 sz,
|
||||
const byte* key, const byte* iv)
|
||||
{
|
||||
return Des3_CbcDecryptWithKey(out, in, sz, key, iv);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
/* Initiliaze Des3 for use with Nitrox device */
|
||||
int wc_Des3_InitCavium(Des3* des3, int devId)
|
||||
{
|
||||
return Des3_InitCavium(des3, devId);
|
||||
}
|
||||
|
||||
|
||||
/* Free Des3 from use with Nitrox device */
|
||||
void wc_Des3_FreeCavium(Des3* des3)
|
||||
{
|
||||
Des3_FreeCavium(des3);
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
#endif /* NO_DES3 */
|
120
wolfcrypt/src/hmac.c
Normal file
120
wolfcrypt/src/hmac.c
Normal file
@ -0,0 +1,120 @@
|
||||
/* hmac.h
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/settings.h>
|
||||
|
||||
#ifndef NO_HMAC
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* does init */
|
||||
int wc_HmacSetKey(Hmac* hmac, int type, const byte* key, word32 keySz)
|
||||
{
|
||||
return HmacSetKey(hmac, type, key, keySz);
|
||||
}
|
||||
|
||||
|
||||
int wc_HmacUpdate(Hmac* hmac, const byte* in, word32 sz)
|
||||
{
|
||||
return HmacUpdate(hmac, in, sz);
|
||||
}
|
||||
|
||||
|
||||
int wc_HmacFinal(Hmac* hmac, byte* out)
|
||||
{
|
||||
return HmacFinal(hmac, out);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
int wc_HmacInitCavium(Hmac* hmac, int i)
|
||||
{
|
||||
return HmacInitCavium(hmac, i);
|
||||
}
|
||||
|
||||
|
||||
void wc_HmacFreeCavium(Hmac* hmac)
|
||||
{
|
||||
HmacFreeCavium(hmac);
|
||||
}
|
||||
#endif
|
||||
|
||||
int wc_wolfSSL_GetHmacMaxSize(void)
|
||||
{
|
||||
return CyaSSL_GetHmacMaxSize(void);
|
||||
}
|
||||
|
||||
#ifdef HAVE_HKDF
|
||||
|
||||
int wc_HKDF(int type, const byte* inKey, word32 inKeySz,
|
||||
const byte* salt, word32 saltSz,
|
||||
const byte* info, word32 infoSz,
|
||||
byte* out, word32 outSz)
|
||||
{
|
||||
return HKDF(type, inKey, inKeySz, salt, saltSz, info, infoSz, out, outSz);
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_HKDF */
|
||||
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
/* fips wrapper calls, user can call direct */
|
||||
int wc_HmacSetKey_fips(Hmac* hmac, int type, const byte* key,
|
||||
word32 keySz)
|
||||
{
|
||||
return HmacSetKey_fips(hmac, type, key, keySz);
|
||||
}
|
||||
|
||||
int wc_HmacUpdate_fips(Hmac* hmac, const byte* in , word32 sz)
|
||||
{
|
||||
return HmacUpdate_fips(hmac, in, sz);
|
||||
}
|
||||
|
||||
|
||||
int wc_HmacFinal_fips(Hmac* hmac, byte* out)
|
||||
{
|
||||
return HmacFinal_fips(hmac, out);
|
||||
}
|
||||
#ifndef FIPS_NO_WRAPPERS
|
||||
/* if not impl or fips.c impl wrapper force fips calls if fips build */
|
||||
#define HmacSetKey HmacSetKey_fips
|
||||
#define HmacUpdate HmacUpdate_fips
|
||||
#define HmacFinal HmacFinal_fips
|
||||
#endif /* FIPS_NO_WRAPPERS */
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* NO_HMAC */
|
||||
|
@ -2,14 +2,14 @@
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* CyaSSL is distributed in the hope that it will be useful,
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
135
wolfcrypt/src/random.c
Normal file
135
wolfcrypt/src/random.c
Normal file
@ -0,0 +1,135 @@
|
||||
/* random.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/settings.h>
|
||||
|
||||
/* on HPUX 11 you may need to install /dev/random see
|
||||
http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=KRNG11I
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
/* set NO_WRAPPERS before headers, use direct internal f()s not wrappers */
|
||||
#define FIPS_NO_WRAPPERS
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/random.h>
|
||||
#include <cyassl/ctaocrypt/error-crypt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int wc_GenerateSeed(OS_Seed* os, byte* seed, word32 sz)
|
||||
{
|
||||
return GenerateSeed(os, seed, sz);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
int wc_InitRngCavium(RNG* rng, int i)
|
||||
{
|
||||
return InitRngCavium(rng, i);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int wc_InitRng(RNG* rng)
|
||||
{
|
||||
return InitRng(rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_RNG_GenerateBlock(RNG* rng, byte* b, word32 sz)
|
||||
{
|
||||
return RNG_GenerateBlock(rng, b, sz);
|
||||
}
|
||||
|
||||
|
||||
int wc_RNG_GenerateByte(RNG* rng, byte* b)
|
||||
{
|
||||
return RNG_GenerateByte(rng, b);
|
||||
}
|
||||
|
||||
#if defined(HAVE_HASHDRBG) || defined(NO_RC4)
|
||||
int wc_FreeRng(RNG* rng)
|
||||
{
|
||||
return FreeRng(rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_RNG_HealthTest(int reseed,
|
||||
const byte* entropyA, word32 entropyASz,
|
||||
const byte* entropyB, word32 entropyBSz,
|
||||
byte* output, word32 outputSz)
|
||||
{
|
||||
return RNG_HealthTest(reseed, entropyA, entropyASz,
|
||||
entropyB, entropyBSz, output, outputSz);
|
||||
}
|
||||
#endif /* HAVE_HASHDRBG || NO_RC4 */
|
||||
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
/* fips wrapper calls, user can call direct */
|
||||
int wc_InitRng_fips(RNG* rng)
|
||||
{
|
||||
return InitRng_fips(rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_FreeRng_fips(RNG* rng)
|
||||
{
|
||||
return FreeRng_fips(rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_RNG_GenerateBlock_fips(RNG* rng, byte* buf, word32 bufSz)
|
||||
{
|
||||
return RNG_GenerateBlock_fips(rng, buf, bufSz);
|
||||
}
|
||||
|
||||
int wc_RNG_HealthTest_fips(int reseed,
|
||||
const byte* entropyA, word32 entropyASz,
|
||||
const byte* entropyB, word32 entropyBSz,
|
||||
byte* output, word32 outputSz)
|
||||
{
|
||||
return RNG_HealthTest_fips(reseed, entropyA, entropyASz,
|
||||
entropyB, entropyBSz, output, outputSz);
|
||||
}
|
||||
#ifndef FIPS_NO_WRAPPERS
|
||||
/* if not impl or fips.c impl wrapper force fips calls if fips build */
|
||||
#define InitRng InitRng_fips
|
||||
#define FreeRng FreeRng_fips
|
||||
#define RNG_GenerateBlock RNG_GenerateBlock_fips
|
||||
#define RNG_HealthTest RNG_HealthTest_fips
|
||||
#endif /* FIPS_NO_WRAPPERS */
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
246
wolfcrypt/src/rsa.c
Normal file
246
wolfcrypt/src/rsa.c
Normal file
@ -0,0 +1,246 @@
|
||||
/* rsa.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/settings.h>
|
||||
|
||||
#ifndef NO_RSA
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int wc_InitRsaKey(RsaKey* key, void* ptr)
|
||||
{
|
||||
return InitRsaKey(key, ptr);
|
||||
}
|
||||
|
||||
|
||||
int wc_FreeRsaKey(RsaKey* key)
|
||||
{
|
||||
return FreeRsaKey(key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPublicEncrypt(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key, RNG* rng)
|
||||
{
|
||||
return RsaPublicEncrypt(in, inLen, out, outLen, key, rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out,
|
||||
RsaKey* key)
|
||||
{
|
||||
return RsaPrivateDecryptInline(in, inLen, out, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key)
|
||||
{
|
||||
return RsaPrivateDecrypt(in, inLen, out, outLen, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaSSL_Sign(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key, RNG* rng);
|
||||
{
|
||||
return RsaSSL_Sign(in, inLen, out, outLen, key, rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaSSL_VerifyInline(byte* in, word32 inLen, byte** out, RsaKey* key)
|
||||
{
|
||||
return RsaSSL_VerifyInline(in, inLen, out, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaSSL_Verify(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key)
|
||||
{
|
||||
return RsaSSL_Verify(in, inLen, out, outLen, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaEncryptSize(RsaKey* key)
|
||||
{
|
||||
return RsaEncryptSize(key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
|
||||
word32 sz)
|
||||
{
|
||||
return RsaPrivateKeyDecode(input, inOutIdx, key, sz);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
|
||||
word32 sz)
|
||||
{
|
||||
return RsaPublicKeyDecode(input, inOutIdx, key, sz);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, const byte* e,
|
||||
word32 eSz, RsaKey* key)
|
||||
{
|
||||
return RsaPublicKeyDecodeRaw(n, nSz, e, eSz, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaFlattenPublicKey(RsaKey* key, byte* a, word32* aSz, byte* b,
|
||||
word32* bSz)
|
||||
{
|
||||
return RsaFlattenPublicKey(key, a, aSz, b, bSz);
|
||||
}
|
||||
#ifdef CYASSL_KEY_GEN
|
||||
int wc_MakeRsaKey(RsaKey* key, int size, long e, RNG* rng)
|
||||
{
|
||||
return MakeRsaKey(key, size, e, rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
|
||||
{
|
||||
return RsaKeyToDer(key, output, inLen);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
int wc_RsaInitCavium(RsaKey* key, int i)
|
||||
{
|
||||
return RsaInitCavium(key, i);
|
||||
}
|
||||
|
||||
|
||||
void wc_RsaFreeCavium(RsaKey* key)
|
||||
{
|
||||
RsaFreeCavium(key);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
/* fips wrapper calls, user can call direct */
|
||||
int wc_InitRsaKey_fips(RsaKey* key, void* ptr)
|
||||
{
|
||||
return InitRsaKey_fips(key, ptr);
|
||||
}
|
||||
|
||||
|
||||
int wc_FreeRsaKey_fips(RsaKey* key)
|
||||
{
|
||||
return FreeRsaKey_fips(key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPublicEncrypt_fips(const byte* in,word32 inLen,byte* out,
|
||||
word32 outLen, RsaKey* key, RNG* rng)
|
||||
{
|
||||
return RsaPublicEncrypt_fips(in, inLen, out, outLen, key, rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPrivateDecryptInline_fips(byte* in, word32 inLen,
|
||||
byte** out, RsaKey* key)
|
||||
{
|
||||
return RsaPrivateDecryptInline_fips(in, inLen, out, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPrivateDecrypt_fips(const byte* in, word32 inLen,
|
||||
byte* out,word32 outLen,RsaKey* key)
|
||||
{
|
||||
return RsaPrivateDecrypt_fips(in, inLen, out, outLen, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_ RsaSSL_Sign_fips(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key, RNG* rng)
|
||||
{
|
||||
return RsaSSL_Sign_fips(in, inLen, out, outLen, key, rng);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaSSL_VerifyInline_fips(byte* in, word32 inLen, byte** out,
|
||||
RsaKey* key)
|
||||
{
|
||||
return RsaSSL_VerifyInline_fips(in, inLen, out, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaSSL_Verify_fips(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key)
|
||||
{
|
||||
return RsaSSL_Verify_fips(in, inLen, out, outLen, key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaEncryptSize_fips(RsaKey* key)
|
||||
{
|
||||
return RsaEncryptSize_fips(key);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPrivateKeyDecode_fips(const byte* input, word32* inOutIdx,
|
||||
RsaKey* key, word32 sz)
|
||||
{
|
||||
return RsaPrivateKeyDecode_fips(input, inOutIdx, key, sz);
|
||||
}
|
||||
|
||||
|
||||
int wc_RsaPublicKeyDecode_fips(const byte* input, word32* inOutIdx,
|
||||
RsaKey* key, word32 sz)
|
||||
{
|
||||
return RsaPublicKeyDecode_fips(input, inOutIdx, key, sz);
|
||||
}
|
||||
#ifndef FIPS_NO_WRAPPERS
|
||||
/* if not impl or fips.c impl wrapper force fips calls if fips build */
|
||||
#define InitRsaKey InitRsaKey_fips
|
||||
#define FreeRsaKey FreeRsaKey_fips
|
||||
#define RsaPublicEncrypt RsaPublicEncrypt_fips
|
||||
#define RsaPrivateDecryptInline RsaPrivateDecryptInline_fips
|
||||
#define RsaPrivateDecrypt RsaPrivateDecrypt_fips
|
||||
#define RsaSSL_Sign RsaSSL_Sign_fips
|
||||
#define RsaSSL_VerifyInline RsaSSL_VerifyInline_fips
|
||||
#define RsaSSL_Verify RsaSSL_Verify_fips
|
||||
#define RsaEncryptSize RsaEncryptSize_fips
|
||||
/* no implicit KeyDecodes since in asn.c (not rsa.c) */
|
||||
#endif /* FIPS_NO_WRAPPERS */
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* NO_RSA */
|
||||
|
@ -123,6 +123,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* CTAO_CRYPT_AES_H */
|
||||
#endif /* WOLF_CRYPT_AES_H */
|
||||
#endif /* NO_AES */
|
||||
|
||||
|
@ -1,30 +1,3 @@
|
||||
/* camellia.h ver 1.2.0
|
||||
*
|
||||
* Copyright (c) 2006,2007
|
||||
* NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* camellia.h
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
@ -46,51 +19,9 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CAMELLIA
|
||||
#ifndef CTAO_CRYPT_CAMELLIA_H
|
||||
#define CTAO_CRYPT_CAMELLIA_H
|
||||
|
||||
#ifndef WOLF_CRYPT_CAMELLIA_H
|
||||
#define WOLF_CRYPT_CAMELLIA_H
|
||||
#include <wolfssl/wolfcrypt/camellia.h>
|
||||
|
||||
|
||||
#include <cyassl/ctaocrypt/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
enum {
|
||||
CAMELLIA_BLOCK_SIZE = 16
|
||||
};
|
||||
|
||||
#define CAMELLIA_TABLE_BYTE_LEN 272
|
||||
#define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / sizeof(word32))
|
||||
|
||||
typedef word32 KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN];
|
||||
|
||||
typedef struct Camellia {
|
||||
word32 keySz;
|
||||
KEY_TABLE_TYPE key;
|
||||
word32 reg[CAMELLIA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
|
||||
word32 tmp[CAMELLIA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
|
||||
} Camellia;
|
||||
|
||||
|
||||
CYASSL_API int CamelliaSetKey(Camellia* cam,
|
||||
const byte* key, word32 len, const byte* iv);
|
||||
CYASSL_API int CamelliaSetIV(Camellia* cam, const byte* iv);
|
||||
CYASSL_API void CamelliaEncryptDirect(Camellia* cam, byte* out, const byte* in);
|
||||
CYASSL_API void CamelliaDecryptDirect(Camellia* cam, byte* out, const byte* in);
|
||||
CYASSL_API void CamelliaCbcEncrypt(Camellia* cam,
|
||||
byte* out, const byte* in, word32 sz);
|
||||
CYASSL_API void CamelliaCbcDecrypt(Camellia* cam,
|
||||
byte* out, const byte* in, word32 sz);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* WOLF_CRYPT_AES_H */
|
||||
#endif /* HAVE_CAMELLIA */
|
||||
|
||||
|
@ -62,6 +62,6 @@ CYASSL_API int DsaPrivateKeyDecode(const byte* input, word32* inOutIdx, DsaKey*,
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* CTAO_CRYPT_DSA_H */
|
||||
#endif /* WOLF_CRYPT_DSA_H */
|
||||
#endif /* NO_DSA */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user