header files for des3, hmac, random and rsa

This commit is contained in:
Jacob Barthelmeh
2014-12-18 14:58:09 -07:00
parent 7bab3a9564
commit d2a97b035d
4 changed files with 109 additions and 344 deletions

View File

@@ -22,94 +22,50 @@
#ifndef NO_DES3 #ifndef NO_DES3
#ifndef CTAO_CRYPT_DES3_H #ifndef WOLF_CRYPT_DES3_H
#define CTAO_CRYPT_DES3_H #define WOLF_CRYPT_DES3_H
#include <cyassl/ctaocrypt/types.h> #include <wolfssl/wolfcrypt/types.h>
/* included for fips */
#include <cyassl/ctaocrypt/des3.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define CYASSL_3DES_CAVIUM_MAGIC 0xBEEF0003
enum { WOLFSSL_API int wc_Des_SetKey(Des* des, const byte* key, const byte* iv, int dir);
DES_ENC_TYPE = 2, /* cipher unique type */ WOLFSSL_API void wc_Des_SetIV(Des* des, const byte* iv);
DES3_ENC_TYPE = 3, /* cipher unique type */ WOLFSSL_API int wc_Des_CbcEncrypt(Des* des, byte* out, const byte* in, word32 sz);
DES_BLOCK_SIZE = 8, WOLFSSL_API int wc_Des_CbcDecrypt(Des* des, byte* out, const byte* in, word32 sz);
DES_KS_SIZE = 32, WOLFSSL_API int wc_Des_EcbEncrypt(Des* des, byte* out, const byte* in, word32 sz);
WOLFSSL_API int wc_Des_CbcDecryptWithKey(byte* out, const byte* in, word32 sz,
DES_ENCRYPTION = 0,
DES_DECRYPTION = 1
};
#define DES_IVLEN 8
#define DES_KEYLEN 8
#define DES3_IVLEN 8
#define DES3_KEYLEN 24
#ifdef STM32F2_CRYPTO
enum {
DES_CBC = 0,
DES_ECB = 1
};
#endif
/* DES encryption and decryption */
typedef struct Des {
word32 reg[DES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
word32 tmp[DES_BLOCK_SIZE / sizeof(word32)]; /* same */
word32 key[DES_KS_SIZE];
} Des;
/* DES3 encryption and decryption */
typedef struct Des3 {
word32 key[3][DES_KS_SIZE];
word32 reg[DES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
word32 tmp[DES_BLOCK_SIZE / sizeof(word32)]; /* same */
#ifdef HAVE_CAVIUM
int devId; /* nitrox device id */
word32 magic; /* using cavium magic */
word64 contextHandle; /* nitrox context memory handle */
#endif
} Des3;
CYASSL_API int Des_SetKey(Des* des, const byte* key, const byte* iv, int dir);
CYASSL_API void Des_SetIV(Des* des, const byte* iv);
CYASSL_API int Des_CbcEncrypt(Des* des, byte* out, const byte* in, word32 sz);
CYASSL_API int Des_CbcDecrypt(Des* des, byte* out, const byte* in, word32 sz);
CYASSL_API int Des_EcbEncrypt(Des* des, byte* out, const byte* in, word32 sz);
CYASSL_API int Des_CbcDecryptWithKey(byte* out, const byte* in, word32 sz,
const byte* key, const byte* iv); const byte* key, const byte* iv);
CYASSL_API int Des3_SetKey(Des3* des, const byte* key, const byte* iv,int dir); WOLFSSL_API int wc_Des3_SetKey(Des3* des, const byte* key, const byte* iv,int dir);
CYASSL_API int Des3_SetIV(Des3* des, const byte* iv); WOLFSSL_API int wc_Des3_SetIV(Des3* des, const byte* iv);
CYASSL_API int Des3_CbcEncrypt(Des3* des, byte* out, const byte* in,word32 sz); WOLFSSL_API int wc_Des3_CbcEncrypt(Des3* des, byte* out, const byte* in,word32 sz);
CYASSL_API int Des3_CbcDecrypt(Des3* des, byte* out, const byte* in,word32 sz); WOLFSSL_API int wc_Des3_CbcDecrypt(Des3* des, byte* out, const byte* in,word32 sz);
CYASSL_API int Des3_CbcDecryptWithKey(byte* out, const byte* in, word32 sz, WOLFSSL_API int wc_Des3_CbcDecryptWithKey(byte* out, const byte* in, word32 sz,
const byte* key, const byte* iv); const byte* key, const byte* iv);
#ifdef HAVE_CAVIUM #ifdef HAVE_CAVIUM
CYASSL_API int Des3_InitCavium(Des3*, int); WOLFSSL_API int wc_Des3_InitCavium(Des3*, int);
CYASSL_API void Des3_FreeCavium(Des3*); WOLFSSL_API void wc_Des3_FreeCavium(Des3*);
#endif #endif
#ifdef HAVE_FIPS #ifdef HAVE_FIPS
/* fips wrapper calls, user can call direct */ /* fips wrapper calls, user can call direct */
CYASSL_API int Des3_SetKey_fips(Des3* des, const byte* key, const byte* iv, WOLFSSL_API int wc_Des3_SetKey_fips(Des3* des, const byte* key, const byte* iv,
int dir); int dir);
CYASSL_API int Des3_SetIV_fips(Des3* des, const byte* iv); WOLFSSL_API int wc_Des3_SetIV_fips(Des3* des, const byte* iv);
CYASSL_API int Des3_CbcEncrypt_fips(Des3* des, byte* out, const byte* in, WOLFSSL_API int wc_Des3_CbcEncrypt_fips(Des3* des, byte* out, const byte* in,
word32 sz); word32 sz);
CYASSL_API int Des3_CbcDecrypt_fips(Des3* des, byte* out, const byte* in, WOLFSSL_API int wc_Des3_CbcDecrypt_fips(Des3* des, byte* out, const byte* in,
word32 sz); word32 sz);
#ifndef FIPS_NO_WRAPPERS #ifndef FIPS_NO_WRAPPERS
/* if not impl or fips.c impl wrapper force fips calls if fips build */ /* if not impl or fips.c impl wrapper force fips calls if fips build */

View File

@@ -22,152 +22,42 @@
#ifndef NO_HMAC #ifndef NO_HMAC
#ifndef CTAO_CRYPT_HMAC_H #ifndef WOLF_CRYPT_HMAC_H
#define CTAO_CRYPT_HMAC_H #define WOLF_CRYPT_HMAC_H
#include <cyassl/ctaocrypt/types.h> /* for fips */
#include <cyassl/ctaocrypt/hmac.h>
#ifndef NO_MD5 #if defined(WOLFSSL_SHA512) && !defined(CYASSL_SHA512)
#include <cyassl/ctaocrypt/md5.h> #define CYASSL_SHA512
#endif #endif
#ifndef NO_SHA
#include <cyassl/ctaocrypt/sha.h>
#endif
#ifndef NO_SHA256
#include <cyassl/ctaocrypt/sha256.h>
#endif
#ifdef CYASSL_SHA512
#include <cyassl/ctaocrypt/sha512.h>
#endif
#ifdef HAVE_BLAKE2
#include <cyassl/ctaocrypt/blake2.h>
#endif
#ifdef HAVE_CAVIUM #ifdef HAVE_CAVIUM
#include <cyassl/ctaocrypt/logging.h> #include <wolfssl/wolfcrypt/logging.h>
#include "cavium_common.h" #include "cavium_common.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define CYASSL_HMAC_CAVIUM_MAGIC 0xBEEF0005
enum {
HMAC_FIPS_MIN_KEY = 14, /* 112 bit key length minimum */
IPAD = 0x36,
OPAD = 0x5C,
/* If any hash is not enabled, add the ID here. */
#ifdef NO_MD5
MD5 = 0,
#endif
#ifdef NO_SHA
SHA = 1,
#endif
#ifdef NO_SHA256
SHA256 = 2,
#endif
#ifndef CYASSL_SHA512
SHA512 = 4,
#endif
#ifndef CYASSL_SHA384
SHA384 = 5,
#endif
#ifndef HAVE_BLAKE2
BLAKE2B_ID = 7,
#endif
/* Select the largest available hash for the buffer size. */
#if defined(CYASSL_SHA512)
MAX_DIGEST_SIZE = SHA512_DIGEST_SIZE,
HMAC_BLOCK_SIZE = SHA512_BLOCK_SIZE
#elif defined(HAVE_BLAKE2)
MAX_DIGEST_SIZE = BLAKE2B_OUTBYTES,
HMAC_BLOCK_SIZE = BLAKE2B_BLOCKBYTES,
#elif defined(CYASSL_SHA384)
MAX_DIGEST_SIZE = SHA384_DIGEST_SIZE,
HMAC_BLOCK_SIZE = SHA384_BLOCK_SIZE
#elif !defined(NO_SHA256)
MAX_DIGEST_SIZE = SHA256_DIGEST_SIZE,
HMAC_BLOCK_SIZE = SHA256_BLOCK_SIZE
#elif !defined(NO_SHA)
MAX_DIGEST_SIZE = SHA_DIGEST_SIZE,
HMAC_BLOCK_SIZE = SHA_BLOCK_SIZE
#elif !defined(NO_MD5)
MAX_DIGEST_SIZE = MD5_DIGEST_SIZE,
HMAC_BLOCK_SIZE = MD5_BLOCK_SIZE
#else
#error "You have to have some kind of hash if you want to use HMAC."
#endif
};
/* hash union */
typedef union {
#ifndef NO_MD5
Md5 md5;
#endif
#ifndef NO_SHA
Sha sha;
#endif
#ifndef NO_SHA256
Sha256 sha256;
#endif
#ifdef CYASSL_SHA384
Sha384 sha384;
#endif
#ifdef CYASSL_SHA512
Sha512 sha512;
#endif
#ifdef HAVE_BLAKE2
Blake2b blake2b;
#endif
} Hash;
/* Hmac digest */
typedef struct Hmac {
Hash hash;
word32 ipad[HMAC_BLOCK_SIZE / sizeof(word32)]; /* same block size all*/
word32 opad[HMAC_BLOCK_SIZE / sizeof(word32)];
word32 innerHash[MAX_DIGEST_SIZE / sizeof(word32)];
byte macType; /* md5 sha or sha256 */
byte innerHashKeyed; /* keyed flag */
#ifdef HAVE_CAVIUM
word16 keyLen; /* hmac key length */
word16 dataLen;
HashType type; /* hmac key type */
int devId; /* nitrox device id */
word32 magic; /* using cavium magic */
word64 contextHandle; /* nitrox context memory handle */
byte* data; /* buffered input data for one call */
#endif
} Hmac;
/* does init */ /* does init */
CYASSL_API int HmacSetKey(Hmac*, int type, const byte* key, word32 keySz); WOLFSSL_API int wc_HmacSetKey(Hmac*, int type, const byte* key, word32 keySz);
CYASSL_API int HmacUpdate(Hmac*, const byte*, word32); WOLFSSL_API int wc_HmacUpdate(Hmac*, const byte*, word32);
CYASSL_API int HmacFinal(Hmac*, byte*); WOLFSSL_API int wc_HmacFinal(Hmac*, byte*);
#ifdef HAVE_CAVIUM #ifdef HAVE_CAVIUM
CYASSL_API int HmacInitCavium(Hmac*, int); WOLFSSL_API int wc_HmacInitCavium(Hmac*, int);
CYASSL_API void HmacFreeCavium(Hmac*); WOLFSSL_API void wc_HmacFreeCavium(Hmac*);
#endif #endif
CYASSL_API int CyaSSL_GetHmacMaxSize(void); WOLFSSL_API int wc_WolfSSL_GetHmacMaxSize(void);
#ifdef HAVE_HKDF #ifdef HAVE_HKDF
CYASSL_API int HKDF(int type, const byte* inKey, word32 inKeySz, WOLFSSL_API int wc_HKDF(int type, const byte* inKey, word32 inKeySz,
const byte* salt, word32 saltSz, const byte* salt, word32 saltSz,
const byte* info, word32 infoSz, const byte* info, word32 infoSz,
byte* out, word32 outSz); byte* out, word32 outSz);
@@ -177,10 +67,10 @@ CYASSL_API int HKDF(int type, const byte* inKey, word32 inKeySz,
#ifdef HAVE_FIPS #ifdef HAVE_FIPS
/* fips wrapper calls, user can call direct */ /* fips wrapper calls, user can call direct */
CYASSL_API int HmacSetKey_fips(Hmac*, int type, const byte* key, WOLFSSL_API int wc_HmacSetKey_fips(Hmac*, int type, const byte* key,
word32 keySz); word32 keySz);
CYASSL_API int HmacUpdate_fips(Hmac*, const byte*, word32); WOLFSSL_API int wc_HmacUpdate_fips(Hmac*, const byte*, word32);
CYASSL_API int HmacFinal_fips(Hmac*, byte*); WOLFSSL_API int wc_HmacFinal_fips(Hmac*, byte*);
#ifndef FIPS_NO_WRAPPERS #ifndef FIPS_NO_WRAPPERS
/* if not impl or fips.c impl wrapper force fips calls if fips build */ /* if not impl or fips.c impl wrapper force fips calls if fips build */
#define HmacSetKey HmacSetKey_fips #define HmacSetKey HmacSetKey_fips
@@ -195,7 +85,7 @@ CYASSL_API int HKDF(int type, const byte* inKey, word32 inKeySz,
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /* CTAO_CRYPT_HMAC_H */ #endif /* WOLF_CRYPT_HMAC_H */
#endif /* NO_HMAC */ #endif /* NO_HMAC */

View File

@@ -2,14 +2,14 @@
* *
* Copyright (C) 2006-2014 wolfSSL Inc. * Copyright (C) 2006-2014 wolfSSL Inc.
* *
* This file is part of CyaSSL. * This file is part of wolfSSL. (formerly known as CyaSSL)
* *
* CyaSSL is free software; you can redistribute it and/or modify * wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* CyaSSL is distributed in the hope that it will be useful, * wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
@@ -20,10 +20,10 @@
*/ */
#ifndef CTAO_CRYPT_RANDOM_H #ifndef WOLF_CRYPT_RANDOM_H
#define CTAO_CRYPT_RANDOM_H #define WOLF_CRYPT_RANDOM_H
#include <cyassl/ctaocrypt/types.h> #include <wolfssl/wolfcrypt/types.h>
#if defined(HAVE_HASHDRBG) || defined(NO_RC4) #if defined(HAVE_HASHDRBG) || defined(NO_RC4)
#ifdef NO_SHA256 #ifdef NO_SHA256
@@ -35,91 +35,34 @@
#include <cyassl/ctaocrypt/arc4.h> #include <cyassl/ctaocrypt/arc4.h>
#endif /* HAVE_HASHDRBG || NO_RC4 */ #endif /* HAVE_HASHDRBG || NO_RC4 */
/* for fips */
#include <cyassl/ctaocrypt/random.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if defined(USE_WINDOWS_API) WOLFSSL_LOCAL
#if defined(_WIN64) int wc_GenerateSeed(OS_Seed* os, byte* seed, word32 sz);
typedef unsigned __int64 ProviderHandle;
/* type HCRYPTPROV, avoid #include <windows.h> */
#else
typedef unsigned long ProviderHandle;
#endif
#endif
/* OS specific seeder */
typedef struct OS_Seed {
#if defined(USE_WINDOWS_API)
ProviderHandle handle;
#else
int fd;
#endif
} OS_Seed;
CYASSL_LOCAL
int GenerateSeed(OS_Seed* os, byte* seed, word32 sz);
#if defined(CYASSL_MDK_ARM)
#undef RNG
#define RNG CyaSSL_RNG /* for avoiding name conflict in "stm32f2xx.h" */
#endif
#if defined(HAVE_HASHDRBG) || defined(NO_RC4) #if defined(HAVE_HASHDRBG) || defined(NO_RC4)
#define DRBG_SEED_LEN (440/8)
struct DRBG; /* Private DRBG state */
/* Hash-based Deterministic Random Bit Generator */
typedef struct RNG {
OS_Seed seed;
struct DRBG* drbg;
byte status;
} RNG;
#else /* HAVE_HASHDRBG || NO_RC4 */
#define CYASSL_RNG_CAVIUM_MAGIC 0xBEEF0004
/* secure Random Number Generator */
typedef struct RNG {
OS_Seed seed;
Arc4 cipher;
#ifdef HAVE_CAVIUM #ifdef HAVE_CAVIUM
int devId; /* nitrox device id */ WOLFSSL_API int wc_InitRngCavium(RNG*, int);
word32 magic; /* using cavium magic */
#endif #endif
} RNG;
#ifdef HAVE_CAVIUM
CYASSL_API int InitRngCavium(RNG*, int);
#endif
#endif /* HAVE_HASH_DRBG || NO_RC4 */ #endif /* HAVE_HASH_DRBG || NO_RC4 */
CYASSL_API int InitRng(RNG*); WOLFSSL_API int wc_InitRng(RNG*);
CYASSL_API int RNG_GenerateBlock(RNG*, byte*, word32 sz); WOLFSSL_API int wc_RNG_GenerateBlock(RNG*, byte*, word32 sz);
CYASSL_API int RNG_GenerateByte(RNG*, byte*); WOLFSSL_API int wc_RNG_GenerateByte(RNG*, byte*);
#if defined(HAVE_HASHDRBG) || defined(NO_RC4) #if defined(HAVE_HASHDRBG) || defined(NO_RC4)
CYASSL_API int FreeRng(RNG*); WOLFSSL_API int wc_FreeRng(RNG*);
CYASSL_API int RNG_HealthTest(int reseed, WOLFSSL_API int wc_RNG_HealthTest(int reseed,
const byte* entropyA, word32 entropyASz, const byte* entropyA, word32 entropyASz,
const byte* entropyB, word32 entropyBSz, const byte* entropyB, word32 entropyBSz,
byte* output, word32 outputSz); byte* output, word32 outputSz);
@@ -128,10 +71,10 @@ CYASSL_API int RNG_GenerateByte(RNG*, byte*);
#ifdef HAVE_FIPS #ifdef HAVE_FIPS
/* fips wrapper calls, user can call direct */ /* fips wrapper calls, user can call direct */
CYASSL_API int InitRng_fips(RNG* rng); WOLFSSL_API int wc_InitRng_fips(RNG* rng);
CYASSL_API int FreeRng_fips(RNG* rng); WOLFSSL_API int wc_FreeRng_fips(RNG* rng);
CYASSL_API int RNG_GenerateBlock_fips(RNG* rng, byte* buf, word32 bufSz); WOLFSSL_API int wc_RNG_GenerateBlock_fips(RNG* rng, byte* buf, word32 bufSz);
CYASSL_API int RNG_HealthTest_fips(int reseed, WOLFSSL_API int wc_RNG_HealthTest_fips(int reseed,
const byte* entropyA, word32 entropyASz, const byte* entropyA, word32 entropyASz,
const byte* entropyB, word32 entropyBSz, const byte* entropyB, word32 entropyBSz,
byte* output, word32 outputSz); byte* output, word32 outputSz);
@@ -149,5 +92,5 @@ CYASSL_API int RNG_GenerateByte(RNG*, byte*);
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /* CTAO_CRYPT_RANDOM_H */ #endif /* WOLF_CRYPT_RANDOM_H */

View File

@@ -2,14 +2,14 @@
* *
* Copyright (C) 2006-2014 wolfSSL Inc. * Copyright (C) 2006-2014 wolfSSL Inc.
* *
* This file is part of CyaSSL. * This file is part of wolfSSL. (formerly known as CyaSSL)
* *
* CyaSSL is free software; you can redistribute it and/or modify * wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* CyaSSL is distributed in the hope that it will be useful, * wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
@@ -21,104 +21,80 @@
#ifndef NO_RSA #ifndef NO_RSA
#ifndef CTAO_CRYPT_RSA_H #ifndef WOLF_CRYPT_RSA_H
#define CTAO_CRYPT_RSA_H #define WOLF_CRYPT_RSA_H
#include <cyassl/ctaocrypt/types.h> /* for fips */
#include <cyassl/ctaocrypt/integer.h> #include <cyassl/ctaocrypt/rsa.h>
#include <cyassl/ctaocrypt/random.h>
//#include <cyassl/ctaocrypt/types.h>
//#include <cyassl/ctaocrypt/integer.h>
//#include <cyassl/ctaocrypt/random.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define CYASSL_RSA_CAVIUM_MAGIC 0xBEEF0006 WOLFSSL_API int wc_InitRsaKey(RsaKey* key, void*);
WOLFSSL_API int wc_FreeRsaKey(RsaKey* key);
enum { WOLFSSL_API int wc_RsaPublicEncrypt(const byte* in, word32 inLen, byte* out,
RSA_PUBLIC = 0,
RSA_PRIVATE = 1
};
/* RSA */
typedef struct RsaKey {
mp_int n, e, d, p, q, dP, dQ, u;
int type; /* public or private */
void* heap; /* for user memory overrides */
#ifdef HAVE_CAVIUM
int devId; /* nitrox device id */
word32 magic; /* using cavium magic */
word64 contextHandle; /* nitrox context memory handle */
byte* c_n; /* cavium byte buffers for key parts */
byte* c_e;
byte* c_d;
byte* c_p;
byte* c_q;
byte* c_dP;
byte* c_dQ;
byte* c_u; /* sizes in bytes */
word16 c_nSz, c_eSz, c_dSz, c_pSz, c_qSz, c_dP_Sz, c_dQ_Sz, c_uSz;
#endif
} RsaKey;
CYASSL_API int InitRsaKey(RsaKey* key, void*);
CYASSL_API int FreeRsaKey(RsaKey* key);
CYASSL_API int RsaPublicEncrypt(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key, RNG* rng); word32 outLen, RsaKey* key, RNG* rng);
CYASSL_API int RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out, WOLFSSL_API int wc_RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out,
RsaKey* key); RsaKey* key);
CYASSL_API int RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out, WOLFSSL_API int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key); word32 outLen, RsaKey* key);
CYASSL_API int RsaSSL_Sign(const byte* in, word32 inLen, byte* out, WOLFSSL_API int wc_RsaSSL_Sign(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key, RNG* rng); word32 outLen, RsaKey* key, RNG* rng);
CYASSL_API int RsaSSL_VerifyInline(byte* in, word32 inLen, byte** out, WOLFSSL_API int wc_RsaSSL_VerifyInline(byte* in, word32 inLen, byte** out,
RsaKey* key); RsaKey* key);
CYASSL_API int RsaSSL_Verify(const byte* in, word32 inLen, byte* out, WOLFSSL_API int wc_RsaSSL_Verify(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key); word32 outLen, RsaKey* key);
CYASSL_API int RsaEncryptSize(RsaKey* key); WOLFSSL_API int wc_RsaEncryptSize(RsaKey* key);
CYASSL_API int RsaPrivateKeyDecode(const byte* input, word32* inOutIdx, RsaKey*, WOLFSSL_API int wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
word32); RsaKey*, word32);
CYASSL_API int RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey*, WOLFSSL_API int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx,
word32); RsaKey*, word32);
CYASSL_API int RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, const byte* e, WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz,
word32 eSz, RsaKey* key); const byte* e, word32 eSz, RsaKey* key);
CYASSL_API int RsaFlattenPublicKey(RsaKey*, byte*, word32*, byte*, word32*); WOLFSSL_API int wc_RsaFlattenPublicKey(RsaKey*, byte*, word32*, byte*,
word32*);
#ifdef CYASSL_KEY_GEN #ifdef WOLFSSL_KEY_GEN
CYASSL_API int MakeRsaKey(RsaKey* key, int size, long e, RNG* rng); WOLFSSL_API int MakeRsaKey(RsaKey* key, int size, long e, RNG* rng);
CYASSL_API int RsaKeyToDer(RsaKey*, byte* output, word32 inLen); WOLFSSL_API int RsaKeyToDer(RsaKey*, byte* output, word32 inLen);
#endif #endif
#ifdef HAVE_CAVIUM #ifdef HAVE_CAVIUM
CYASSL_API int RsaInitCavium(RsaKey*, int); WOLFSSL_API int RsaInitCavium(RsaKey*, int);
CYASSL_API void RsaFreeCavium(RsaKey*); WOLFSSL_API void RsaFreeCavium(RsaKey*);
#endif #endif
#ifdef HAVE_FIPS #ifdef HAVE_FIPS
/* fips wrapper calls, user can call direct */ /* fips wrapper calls, user can call direct */
CYASSL_API int InitRsaKey_fips(RsaKey* key, void*); WOLFSSL_API int InitRsaKey_fips(RsaKey* key, void*);
CYASSL_API int FreeRsaKey_fips(RsaKey* key); WOLFSSL_API int FreeRsaKey_fips(RsaKey* key);
CYASSL_API int RsaPublicEncrypt_fips(const byte* in,word32 inLen,byte* out, WOLFSSL_API int RsaPublicEncrypt_fips(const byte* in,word32 inLen,byte* out,
word32 outLen, RsaKey* key, RNG* rng); word32 outLen, RsaKey* key, RNG* rng);
CYASSL_API int RsaPrivateDecryptInline_fips(byte* in, word32 inLen, WOLFSSL_API int RsaPrivateDecryptInline_fips(byte* in, word32 inLen,
byte** out, RsaKey* key); byte** out, RsaKey* key);
CYASSL_API int RsaPrivateDecrypt_fips(const byte* in, word32 inLen, WOLFSSL_API int RsaPrivateDecrypt_fips(const byte* in, word32 inLen,
byte* out,word32 outLen,RsaKey* key); byte* out,word32 outLen,RsaKey* key);
CYASSL_API int RsaSSL_Sign_fips(const byte* in, word32 inLen, byte* out, WOLFSSL_API int RsaSSL_Sign_fips(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key, RNG* rng); word32 outLen, RsaKey* key, RNG* rng);
CYASSL_API int RsaSSL_VerifyInline_fips(byte* in, word32 inLen, byte** out, WOLFSSL_API int RsaSSL_VerifyInline_fips(byte* in, word32 inLen, byte** out,
RsaKey* key); RsaKey* key);
CYASSL_API int RsaSSL_Verify_fips(const byte* in, word32 inLen, byte* out, WOLFSSL_API int RsaSSL_Verify_fips(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key); word32 outLen, RsaKey* key);
CYASSL_API int RsaEncryptSize_fips(RsaKey* key); WOLFSSL_API int RsaEncryptSize_fips(RsaKey* key);
CYASSL_API int RsaPrivateKeyDecode_fips(const byte* input, word32* inOutIdx, WOLFSSL_API int RsaPrivateKeyDecode_fips(const byte* input, word32* inOutIdx,
RsaKey*, word32); RsaKey*, word32);
CYASSL_API int RsaPublicKeyDecode_fips(const byte* input, word32* inOutIdx, WOLFSSL_API int RsaPublicKeyDecode_fips(const byte* input, word32* inOutIdx,
RsaKey*, word32); RsaKey*, word32);
#ifndef FIPS_NO_WRAPPERS #ifndef FIPS_NO_WRAPPERS
/* if not impl or fips.c impl wrapper force fips calls if fips build */ /* if not impl or fips.c impl wrapper force fips calls if fips build */
@@ -141,6 +117,6 @@ CYASSL_API int RsaFlattenPublicKey(RsaKey*, byte*, word32*, byte*, word32*);
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /* CTAO_CRYPT_RSA_H */ #endif /* WOLF_CRYPT_RSA_H */
#endif /* NO_RSA */ #endif /* NO_RSA */