My Project
rsa.h
Go to the documentation of this file.
1 
33 int wc_InitRsaKey(RsaKey* key, void* heap);
34 
82 int wc_InitRsaKey_Id(RsaKey* key, unsigned char* id, int len,
83  void* heap, int devId);
84 
110 int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng);
111 
132 int wc_FreeRsaKey(RsaKey* key);
133 
176 int wc_RsaDirect(byte* in, word32 inLen, byte* out, word32* outSz,
177  RsaKey* key, int type, WC_RNG* rng);
178 
249 int wc_RsaPublicEncrypt(const byte* in, word32 inLen, byte* out,
250  word32 outLen, RsaKey* key, WC_RNG* rng);
251 
273 int wc_RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out,
274  RsaKey* key);
275 
307 int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out,
308  word32 outLen, RsaKey* key);
309 
340 int wc_RsaSSL_Sign(const byte* in, word32 inLen, byte* out,
341  word32 outLen, RsaKey* key, WC_RNG* rng);
342 
378 int wc_RsaSSL_VerifyInline(byte* in, word32 inLen, byte** out,
379  RsaKey* key);
380 
410 int wc_RsaSSL_Verify(const byte* in, word32 inLen, byte* out,
411  word32 outLen, RsaKey* key);
412 
460 int wc_RsaPSS_Sign(const byte* in, word32 inLen, byte* out,
461  word32 outLen, enum wc_HashType hash, int mgf,
462  RsaKey* key, WC_RNG* rng);
463 
514 int wc_RsaPSS_Verify(byte* in, word32 inLen, byte* out,
515  word32 outLen, enum wc_HashType hash, int mgf,
516  RsaKey* key);
517 
575 int wc_RsaPSS_VerifyInline(byte* in, word32 inLen, byte** out,
576  enum wc_HashType hash, int mgf,
577  RsaKey* key);
643 int wc_RsaPSS_VerifyCheck(byte* in, word32 inLen,
644  byte* out, word32 outLen,
645  const byte* digest, word32 digestLen,
646  enum wc_HashType hash, int mgf,
647  RsaKey* key);
715 int wc_RsaPSS_VerifyCheck_ex(byte* in, word32 inLen,
716  byte* out, word32 outLen,
717  const byte* digest, word32 digestLen,
718  enum wc_HashType hash, int mgf, int saltLen,
719  RsaKey* key);
720 
785 int wc_RsaPSS_VerifyCheckInline(byte* in, word32 inLen, byte** out,
786  const byte* digest, word32 digentLen,
787  enum wc_HashType hash, int mgf,
788  RsaKey* key);
854 int wc_RsaPSS_VerifyCheckInline_ex(byte* in, word32 inLen, byte** out,
855  const byte* digest, word32 digentLen,
856  enum wc_HashType hash, int mgf, int saltLen,
857  RsaKey* key);
858 
919 int wc_RsaPSS_CheckPadding(const byte* in, word32 inLen, byte* sig,
920  word32 sigSz,
921  enum wc_HashType hashType);
984 int wc_RsaPSS_CheckPadding_ex(const byte* in, word32 inLen, byte* sig,
985  word32 sigSz, enum wc_HashType hashType, int saltLen, int bits);
1004 int wc_RsaEncryptSize(RsaKey* key);
1005 
1047 int wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
1048  RsaKey* key, word32 inSz);
1049 
1096 int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx,
1097  RsaKey* key, word32 inSz);
1098 
1141 int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz,
1142  const byte* e, word32 eSz, RsaKey* key);
1143 
1182 int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen);
1183 
1225 int wc_RsaPublicEncrypt_ex(const byte* in, word32 inLen, byte* out,
1226  word32 outLen, RsaKey* key, WC_RNG* rng, int type,
1227  enum wc_HashType hash, int mgf, byte* label, word32 labelSz);
1228 
1278 int wc_RsaPrivateDecrypt_ex(const byte* in, word32 inLen,
1279  byte* out, word32 outLen, RsaKey* key, int type,
1280  enum wc_HashType hash, int mgf, byte* label, word32 labelSz);
1281 
1336 int wc_RsaPrivateDecryptInline_ex(byte* in, word32 inLen,
1337  byte** out, RsaKey* key, int type, enum wc_HashType hash,
1338  int mgf, byte* label, word32 labelSz);
1339 
1381 int wc_RsaFlattenPublicKey(RsaKey* key, byte* e, word32* eSz, byte* n,
1382  word32* nSz);
1383 
1417 int wc_RsaKeyToPublicDer(RsaKey* key, byte* output, word32 inLen);
1418 
1453 int wc_RsaKeyToPublicDer_ex(RsaKey* key, byte* output, word32 inLen,
1454  int with_header);
1455 
1525 int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng);
1526 
1570 int wc_RsaSetNonBlock(RsaKey* key, RsaNb* nb);
1571 
1602 int wc_RsaSetNonBlockTime(RsaKey* key, word32 maxBlockUs,
1603  word32 cpuMHz);
int wc_InitRsaKey(RsaKey *key, void *heap)
This function initializes a provided RsaKey struct. It also takes in a heap identifier,...
int wc_FreeRsaKey(RsaKey *key)
This function frees a provided RsaKey struct using mp_clear.
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...
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.
int wc_RsaPublicKeyDecode(const byte *input, word32 *inOutIdx, RsaKey *key, word32 inSz)
This function parses a DER-formatted RSA public key, extracts the public key and stores it in the giv...
int wc_RsaPrivateDecryptInline(byte *in, word32 inLen, byte **out, RsaKey *key)
This functions is utilized by the wc_RsaPrivateDecrypt function for decrypting.
int wc_RsaPSS_VerifyInline(byte *in, word32 inLen, byte **out, enum wc_HashType hash, int mgf, RsaKey *key)
Decrypt input signature to verify that the message was signed by RSA key. The output uses the same by...
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)....
int wc_RsaKeyToDer(RsaKey *key, byte *output, word32 inLen)
This function converts an RsaKey key to DER format. The result is written to output and it returns th...
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...
int wc_RsaKeyToPublicDer(RsaKey *key, byte *output, word32 inLen)
Convert Rsa Public key to DER format. Writes to output, and returns count of bytes written.
int wc_RsaPSS_VerifyCheck_ex(byte *in, word32 inLen, byte *out, word32 outLen, const byte *digest, word32 digestLen, enum wc_HashType hash, int mgf, int saltLen, RsaKey *key)
Verify the message signed with RSA-PSS. The key has to be associated with RNG by wc_RsaSetRNG when WC...
int wc_RsaSetNonBlockTime(RsaKey *key, word32 maxBlockUs, word32 cpuMHz)
This function configures the maximum amount of blocking time in microseconds. It uses a pre-computed ...
int wc_RsaFlattenPublicKey(RsaKey *key, byte *e, word32 *eSz, byte *n, word32 *nSz)
Flattens the RsaKey structure into individual elements (e, n) used for the RSA algorithm.
int wc_RsaPrivateDecryptInline_ex(byte *in, word32 inLen, byte **out, RsaKey *key, int type, enum wc_HashType hash, int mgf, byte *label, word32 labelSz)
This function uses RSA to decrypt a message inline and gives the option of what padding type....
int wc_RsaPrivateDecrypt(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key)
This functions provides private RSA decryption.
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...
int wc_RsaKeyToPublicDer_ex(RsaKey *key, byte *output, word32 inLen, int with_header)
Convert RSA Public key to DER format. Writes to output, and returns count of bytes written....
int wc_RsaPSS_CheckPadding_ex(const byte *in, word32 inLen, byte *sig, word32 sigSz, enum wc_HashType hashType, int saltLen, int bits)
Checks the PSS data to ensure that the signature matches. Salt length is equal to hash length.
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.
int wc_RsaPublicEncrypt_ex(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key, WC_RNG *rng, int type, enum wc_HashType hash, int mgf, byte *label, word32 labelSz)
This function performs RSA encrypt while allowing the choice of which padding to use.
int wc_RsaEncryptSize(RsaKey *key)
Returns the encryption size for the provided key structure.
int wc_RsaPrivateDecrypt_ex(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key, int type, enum wc_HashType hash, int mgf, byte *label, word32 labelSz)
This function uses RSA to decrypt a message and gives the option of what padding type.
int wc_RsaPSS_Sign(const byte *in, word32 inLen, byte *out, word32 outLen, enum wc_HashType hash, int mgf, RsaKey *key, WC_RNG *rng)
Signs the provided array with the private key.
int wc_RsaSetNonBlock(RsaKey *key, RsaNb *nb)
This function sets the non-blocking RSA context. When a RsaNb context is set it enables fast math bas...
int wc_InitRsaKey_Id(RsaKey *key, unsigned char *id, int len, void *heap, int devId)
This function initializes a provided RsaKey struct. The id and len are used to identify the key on th...
int wc_RsaPSS_VerifyCheck(byte *in, word32 inLen, byte *out, word32 outLen, const byte *digest, word32 digestLen, enum wc_HashType hash, int mgf, RsaKey *key)
Verify the message signed with RSA-PSS. Salt length is equal to hash length. The key has to be associ...
int wc_RsaPSS_CheckPadding(const byte *in, word32 inLen, byte *sig, word32 sigSz, enum wc_HashType hashType)
Checks the PSS data to ensure that the signature matches. Salt length is equal to hash length....
int wc_RsaPrivateKeyDecode(const byte *input, word32 *inOutIdx, RsaKey *key, word32 inSz)
This function parses a DER-formatted RSA private key, extracts the private key and stores it in the g...
int wc_RsaPSS_Verify(byte *in, word32 inLen, byte *out, word32 outLen, enum wc_HashType hash, int mgf, RsaKey *key)
Decrypt input signature to verify that the message was signed by key. The key has to be associated wi...
int wc_RsaPSS_VerifyCheckInline_ex(byte *in, word32 inLen, byte **out, const byte *digest, word32 digentLen, enum wc_HashType hash, int mgf, int saltLen, RsaKey *key)
Verify the message signed with RSA-PSS. The input buffer is reused for the output buffer....
int wc_RsaSetRNG(RsaKey *key, WC_RNG *rng)
This function associates RNG with Key. It is needed when WC_RSA_BLINDING is enabled.
int wc_RsaDirect(byte *in, word32 inLen, byte *out, word32 *outSz, RsaKey *key, int type, WC_RNG *rng)
Function that does the RSA operation directly with no padding. The input size must match key size....
int wc_RsaPSS_VerifyCheckInline(byte *in, word32 inLen, byte **out, const byte *digest, word32 digentLen, enum wc_HashType hash, int mgf, RsaKey *key)
Verify the message signed with RSA-PSS. The input buffer is reused for the output buffer....