27#ifndef USER_WOLF_CRYPT_RSA_H
28#define USER_WOLF_CRYPT_RSA_H
30#include <wolfssl/wolfcrypt/settings.h>
46#if defined(OPENSSL_EXTRA) && !defined(WOLFSSL_TYPES_DEFINED) \
47 && !defined(WOLFSSL_RSA_TYPE_DEFINED)
50 #define WOLFSSL_RSA_TYPE_DEFINED
63 IppsBigNumState* dipp;
64 IppsBigNumState* pipp;
65 IppsBigNumState* qipp;
66 IppsBigNumState* dPipp;
67 IppsBigNumState* dQipp;
68 IppsBigNumState* uipp;
70 IppsRSAPublicKeyState* pPub;
71 IppsRSAPrivateKeyState* pPrv;
78#ifndef WC_RSAKEY_TYPE_DEFINED
80 #define WC_RSAKEY_TYPE_DEFINED
84WOLFSSL_API
int wc_InitRsaKey_ex(
RsaKey* key,
void* heap,
int devId);
92 word32 outLen,
RsaKey* key);
93WOLFSSL_API
int wc_RsaSSL_Sign(
const byte* in, word32 inLen,
byte* out,
98 word32 outLen,
RsaKey* key);
103WOLFSSL_API
int wc_RsaPublicKeyDecode_ex(
const byte* input, word32* inOutIdx,
104 word32 inSz,
const byte** n, word32* nSz,
const byte** e, word32* eSz);
108 const byte* e, word32 eSz,
RsaKey* key);
111#ifdef WOLFSSL_KEY_GEN
119#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_KEY_GEN) || defined(OPENSSL_EXTRA)
121 WOLFSSL_API
int wc_Rsa_leading_bit(
void* BN);
122 WOLFSSL_API
int wc_Rsa_unsigned_bin_size(
void* BN);
125 WOLFSSL_API
int wc_Rsa_to_unsigned_bin(
void* BN,
byte* in,
int inLen);
WOLFSSL_API int wc_InitRsaKey(RsaKey *key, void *)
This function initializes a provided RsaKey struct. It also takes in a heap identifier,...
Definition rsa.c:79
WOLFSSL_API int wc_RsaPublicKeyDecode(const byte *input, word32 *inOutIdx, RsaKey *, word32)
This function parses a DER-formatted RSA public key, extracts the public key and stores it in the giv...
Definition asn.c:4321
WOLFSSL_API int wc_FreeRsaKey(RsaKey *key)
This function frees a provided RsaKey struct using mp_clear.
Definition rsa.c:99
WOLFSSL_API int wc_RsaSSL_VerifyInline(byte *in, word32 inLen, byte **out, RsaKey *key)
Used to verify that the message was signed by RSA key. The output uses the same byte array as the inp...
Definition rsa.c:149
WOLFSSL_API int wc_RsaSSL_Verify(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key)
Used to verify that the message was signed by key.
Definition rsa.c:158
WOLFSSL_API int wc_RsaPrivateDecryptInline(byte *in, word32 inLen, byte **out, RsaKey *key)
This functions is utilized by the wc_RsaPrivateDecrypt function for decrypting.
Definition rsa.c:118
WOLFSSL_API int wc_RsaFlattenPublicKey(RsaKey *, byte *, word32 *, byte *, word32 *)
Flattens the RsaKey structure into individual elements (e, n) used for the RSA algorithm.
Definition rsa.c:178
WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey *, byte *output, word32 inLen)
Convert Rsa Public key to DER format. Writes to output, and returns count of bytes written.
Definition asn.c:11254
WOLFSSL_API int wc_MakeRsaKey(RsaKey *key, int size, long e, WC_RNG *rng)
This function generates a RSA private key of length size (in bits) and given exponent (e)....
Definition rsa.c:189
WOLFSSL_API int wc_RsaPrivateKeyDecode(const byte *input, word32 *inOutIdx, RsaKey *, word32)
This function parses a DER-formatted RSA private key, extracts the private key and stores it in the g...
Definition asn.c:2567
WOLFSSL_API int wc_RsaPrivateDecrypt(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key)
This functions provides private RSA decryption.
Definition rsa.c:128
WOLFSSL_API int wc_RsaKeyToDer(RsaKey *, byte *output, word32 inLen)
This function converts an RsaKey key to DER format. The result is written to output and it returns th...
Definition asn.c:11179
WOLFSSL_API int wc_RsaPublicEncrypt(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key, WC_RNG *rng)
This function encrypts a message from in and stores the result in out. It requires an initialized pub...
Definition rsa.c:106
WOLFSSL_API int wc_RsaSSL_Sign(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key, WC_RNG *rng)
Signs the provided array with the private key.
Definition rsa.c:138
WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte *n, word32 nSz, const byte *e, word32 eSz, RsaKey *key)
This function decodes the raw elements of an RSA public key, taking in the public modulus (n) and exp...
Definition asn.c:4340
WOLFSSL_API int wc_RsaEncryptSize(RsaKey *key)
Returns the encryption size for the provided key structure.
Definition rsa.c:168