RetroArch
|
#include "mbedtls/config.h"
#include "mbedtls/rsa.h"
#include "mbedtls/oid.h"
#include <string.h>
#include "mbedtls/md.h"
#include <stdlib.h>
#include "mbedtls/platform.h"
#include "arc4_alt.h"
#include "mbedtls/sha1.h"
Macros | |
#define | RSA_EXPONENT_BLINDING 28 |
#define | KEY_LEN 128 |
#define | RSA_N |
#define | RSA_E "10001" |
#define | RSA_D |
#define | RSA_P |
#define | RSA_Q |
#define | RSA_DP |
#define | RSA_DQ |
#define | RSA_QP |
#define | PT_LEN 24 |
#define | RSA_PT |
Functions | |
void | mbedtls_rsa_init (mbedtls_rsa_context *ctx, int padding, int hash_id) |
Initialize an RSA context. More... | |
void | mbedtls_rsa_set_padding (mbedtls_rsa_context *ctx, int padding, int hash_id) |
Set padding for an already initialized RSA context See mbedtls_rsa_init() for details. More... | |
int | mbedtls_rsa_gen_key (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, unsigned int nbits, int exponent) |
Generate an RSA keypair. More... | |
int | mbedtls_rsa_check_pubkey (const mbedtls_rsa_context *ctx) |
Check a public RSA key. More... | |
int | mbedtls_rsa_check_privkey (const mbedtls_rsa_context *ctx) |
Check a private RSA key. More... | |
int | mbedtls_rsa_check_pub_priv (const mbedtls_rsa_context *pub, const mbedtls_rsa_context *prv) |
Check a public-private RSA key pair. Check each of the contexts, and make sure they match. More... | |
int | mbedtls_rsa_public (mbedtls_rsa_context *ctx, const unsigned char *input, unsigned char *output) |
Do an RSA public key operation. More... | |
static int | rsa_prepare_blinding (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng) |
int | mbedtls_rsa_private (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, const unsigned char *input, unsigned char *output) |
Do an RSA private key operation. More... | |
static void | mgf_mask (unsigned char *dst, size_t dlen, unsigned char *src, size_t slen, mbedtls_md_context_t *md_ctx) |
int | mbedtls_rsa_rsaes_oaep_encrypt (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, const unsigned char *label, size_t label_len, size_t ilen, const unsigned char *input, unsigned char *output) |
Perform a PKCS#1 v2.1 OAEP encryption (RSAES-OAEP-ENCRYPT) More... | |
int | mbedtls_rsa_rsaes_pkcs1_v15_encrypt (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, size_t ilen, const unsigned char *input, unsigned char *output) |
Perform a PKCS#1 v1.5 encryption (RSAES-PKCS1-v1_5-ENCRYPT) More... | |
int | mbedtls_rsa_pkcs1_encrypt (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, size_t ilen, const unsigned char *input, unsigned char *output) |
Generic wrapper to perform a PKCS#1 encryption using the mode from the context. Add the message padding, then do an RSA operation. More... | |
int | mbedtls_rsa_rsaes_oaep_decrypt (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, const unsigned char *label, size_t label_len, size_t *olen, const unsigned char *input, unsigned char *output, size_t output_max_len) |
Perform a PKCS#1 v2.1 OAEP decryption (RSAES-OAEP-DECRYPT) More... | |
int | mbedtls_rsa_rsaes_pkcs1_v15_decrypt (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, size_t *olen, const unsigned char *input, unsigned char *output, size_t output_max_len) |
Perform a PKCS#1 v1.5 decryption (RSAES-PKCS1-v1_5-DECRYPT) More... | |
int | mbedtls_rsa_pkcs1_decrypt (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, size_t *olen, const unsigned char *input, unsigned char *output, size_t output_max_len) |
Generic wrapper to perform a PKCS#1 decryption using the mode from the context. Do an RSA operation, then remove the message padding. More... | |
int | mbedtls_rsa_rsassa_pss_sign (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, mbedtls_md_type_t md_alg, unsigned int hashlen, const unsigned char *hash, unsigned char *sig) |
Perform a PKCS#1 v2.1 PSS signature (RSASSA-PSS-SIGN) More... | |
int | mbedtls_rsa_rsassa_pkcs1_v15_sign (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, mbedtls_md_type_t md_alg, unsigned int hashlen, const unsigned char *hash, unsigned char *sig) |
Perform a PKCS#1 v1.5 signature (RSASSA-PKCS1-v1_5-SIGN) More... | |
int | mbedtls_rsa_pkcs1_sign (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, mbedtls_md_type_t md_alg, unsigned int hashlen, const unsigned char *hash, unsigned char *sig) |
Generic wrapper to perform a PKCS#1 signature using the mode from the context. Do a private RSA operation to sign a message digest. More... | |
int | mbedtls_rsa_rsassa_pss_verify_ext (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, mbedtls_md_type_t md_alg, unsigned int hashlen, const unsigned char *hash, mbedtls_md_type_t mgf1_hash_id, int expected_salt_len, const unsigned char *sig) |
Perform a PKCS#1 v2.1 PSS verification (RSASSA-PSS-VERIFY) (This is the version with "full" options.) More... | |
int | mbedtls_rsa_rsassa_pss_verify (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, mbedtls_md_type_t md_alg, unsigned int hashlen, const unsigned char *hash, const unsigned char *sig) |
Perform a PKCS#1 v2.1 PSS verification (RSASSA-PSS-VERIFY) (This is the "simple" version.) More... | |
int | mbedtls_rsa_rsassa_pkcs1_v15_verify (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, mbedtls_md_type_t md_alg, unsigned int hashlen, const unsigned char *hash, const unsigned char *sig) |
Perform a PKCS#1 v1.5 verification (RSASSA-PKCS1-v1_5-VERIFY) More... | |
int | mbedtls_rsa_pkcs1_verify (mbedtls_rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, mbedtls_md_type_t md_alg, unsigned int hashlen, const unsigned char *hash, const unsigned char *sig) |
Generic wrapper to perform a PKCS#1 verification using the mode from the context. Do a public RSA operation and check the message digest. More... | |
int | mbedtls_rsa_copy (mbedtls_rsa_context *dst, const mbedtls_rsa_context *src) |
Copy the components of an RSA context. More... | |
void | mbedtls_rsa_free (mbedtls_rsa_context *ctx) |
Free the components of an RSA key. More... | |
static int | myrand (void *rng_state, unsigned char *output, size_t len) |
int | mbedtls_rsa_self_test (int verbose) |
Checkup routine. More... | |
#define KEY_LEN 128 |
#define PT_LEN 24 |
#define RSA_D |
#define RSA_DP |
#define RSA_DQ |
#define RSA_E "10001" |
#define RSA_EXPONENT_BLINDING 28 |
#define RSA_N |
#define RSA_P |
#define RSA_PT |
#define RSA_Q |
#define RSA_QP |
int mbedtls_rsa_check_privkey | ( | const mbedtls_rsa_context * | ctx | ) |
Check a private RSA key.
ctx | RSA context to be checked |
int mbedtls_rsa_check_pub_priv | ( | const mbedtls_rsa_context * | pub, |
const mbedtls_rsa_context * | prv | ||
) |
Check a public-private RSA key pair. Check each of the contexts, and make sure they match.
pub | RSA context holding the public key |
prv | RSA context holding the private key |
int mbedtls_rsa_check_pubkey | ( | const mbedtls_rsa_context * | ctx | ) |
Check a public RSA key.
ctx | RSA context to be checked |
int mbedtls_rsa_copy | ( | mbedtls_rsa_context * | dst, |
const mbedtls_rsa_context * | src | ||
) |
Copy the components of an RSA context.
dst | Destination context |
src | Source context |
void mbedtls_rsa_free | ( | mbedtls_rsa_context * | ctx | ) |
Free the components of an RSA key.
ctx | RSA Context to free |
int mbedtls_rsa_gen_key | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
unsigned int | nbits, | ||
int | exponent | ||
) |
Generate an RSA keypair.
ctx | RSA context that will hold the key |
f_rng | RNG function |
p_rng | RNG parameter |
nbits | size of the public key in bits |
exponent | public exponent (e.g., 65537) |
void mbedtls_rsa_init | ( | mbedtls_rsa_context * | ctx, |
int | padding, | ||
int | hash_id | ||
) |
Initialize an RSA context.
Note: Set padding to MBEDTLS_RSA_PKCS_V21 for the RSAES-OAEP encryption scheme and the RSASSA-PSS signature scheme.
ctx | RSA context to be initialized |
padding | MBEDTLS_RSA_PKCS_V15 or MBEDTLS_RSA_PKCS_V21 |
hash_id | MBEDTLS_RSA_PKCS_V21 hash identifier |
int mbedtls_rsa_pkcs1_decrypt | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
size_t * | olen, | ||
const unsigned char * | input, | ||
unsigned char * | output, | ||
size_t | output_max_len | ||
) |
Generic wrapper to perform a PKCS#1 decryption using the mode from the context. Do an RSA operation, then remove the message padding.
ctx | RSA context |
f_rng | RNG function (Only needed for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
olen | will contain the plaintext length |
input | buffer holding the encrypted data |
output | buffer that will hold the plaintext |
output_max_len | maximum length of the output buffer |
output_max_len
should be as large as the size ctx->len of ctx->N (eg. 128 bytes if RSA-1024 is used) to be able to hold an arbitrary decrypted message. If it is not large enough to hold the decryption of the particular ciphertext provided, the function will return MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE.int mbedtls_rsa_pkcs1_encrypt | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
size_t | ilen, | ||
const unsigned char * | input, | ||
unsigned char * | output | ||
) |
Generic wrapper to perform a PKCS#1 encryption using the mode from the context. Add the message padding, then do an RSA operation.
ctx | RSA context |
f_rng | RNG function (Needed for padding and PKCS#1 v2.1 encoding and MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
ilen | contains the plaintext length |
input | buffer holding the data to be encrypted |
output | buffer that will hold the ciphertext |
int mbedtls_rsa_pkcs1_sign | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
mbedtls_md_type_t | md_alg, | ||
unsigned int | hashlen, | ||
const unsigned char * | hash, | ||
unsigned char * | sig | ||
) |
Generic wrapper to perform a PKCS#1 signature using the mode from the context. Do a private RSA operation to sign a message digest.
ctx | RSA context |
f_rng | RNG function (Needed for PKCS#1 v2.1 encoding and for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
md_alg | a MBEDTLS_MD_XXX (use MBEDTLS_MD_NONE for signing raw data) |
hashlen | message digest length (for MBEDTLS_MD_NONE only) |
hash | buffer holding the message digest |
sig | buffer that will hold the ciphertext |
mbedtls_rsa_rsassa_pss_sign()
for details on md_alg and hash_id. int mbedtls_rsa_pkcs1_verify | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
mbedtls_md_type_t | md_alg, | ||
unsigned int | hashlen, | ||
const unsigned char * | hash, | ||
const unsigned char * | sig | ||
) |
Generic wrapper to perform a PKCS#1 verification using the mode from the context. Do a public RSA operation and check the message digest.
ctx | points to an RSA public key |
f_rng | RNG function (Only needed for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
md_alg | a MBEDTLS_MD_XXX (use MBEDTLS_MD_NONE for signing raw data) |
hashlen | message digest length (for MBEDTLS_MD_NONE only) |
hash | buffer holding the message digest |
sig | buffer holding the ciphertext |
mbedtls_rsa_rsassa_pss_verify()
about md_alg and hash_id. int mbedtls_rsa_private | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
const unsigned char * | input, | ||
unsigned char * | output | ||
) |
Do an RSA private key operation.
ctx | RSA context |
f_rng | RNG function (Needed for blinding) |
p_rng | RNG parameter |
input | input buffer |
output | output buffer |
int mbedtls_rsa_public | ( | mbedtls_rsa_context * | ctx, |
const unsigned char * | input, | ||
unsigned char * | output | ||
) |
Do an RSA public key operation.
ctx | RSA context |
input | input buffer |
output | output buffer |
int mbedtls_rsa_rsaes_oaep_decrypt | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
const unsigned char * | label, | ||
size_t | label_len, | ||
size_t * | olen, | ||
const unsigned char * | input, | ||
unsigned char * | output, | ||
size_t | output_max_len | ||
) |
Perform a PKCS#1 v2.1 OAEP decryption (RSAES-OAEP-DECRYPT)
ctx | RSA context |
f_rng | RNG function (Only needed for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
label | buffer holding the custom label to use |
label_len | contains the label length |
olen | will contain the plaintext length |
input | buffer holding the encrypted data |
output | buffer that will hold the plaintext |
output_max_len | maximum length of the output buffer |
output_max_len
should be as large as the size ctx->len of ctx->N (eg. 128 bytes if RSA-1024 is used) to be able to hold an arbitrary decrypted message. If it is not large enough to hold the decryption of the particular ciphertext provided, the function will return MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE.int mbedtls_rsa_rsaes_oaep_encrypt | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
const unsigned char * | label, | ||
size_t | label_len, | ||
size_t | ilen, | ||
const unsigned char * | input, | ||
unsigned char * | output | ||
) |
Perform a PKCS#1 v2.1 OAEP encryption (RSAES-OAEP-ENCRYPT)
ctx | RSA context |
f_rng | RNG function (Needed for padding and PKCS#1 v2.1 encoding and MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
label | buffer holding the custom label to use |
label_len | contains the label length |
ilen | contains the plaintext length |
input | buffer holding the data to be encrypted |
output | buffer that will hold the ciphertext |
int mbedtls_rsa_rsaes_pkcs1_v15_decrypt | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
size_t * | olen, | ||
const unsigned char * | input, | ||
unsigned char * | output, | ||
size_t | output_max_len | ||
) |
Perform a PKCS#1 v1.5 decryption (RSAES-PKCS1-v1_5-DECRYPT)
ctx | RSA context |
f_rng | RNG function (Only needed for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
olen | will contain the plaintext length |
input | buffer holding the encrypted data |
output | buffer that will hold the plaintext |
output_max_len | maximum length of the output buffer |
output_max_len
should be as large as the size ctx->len of ctx->N (eg. 128 bytes if RSA-1024 is used) to be able to hold an arbitrary decrypted message. If it is not large enough to hold the decryption of the particular ciphertext provided, the function will return MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE.int mbedtls_rsa_rsaes_pkcs1_v15_encrypt | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
size_t | ilen, | ||
const unsigned char * | input, | ||
unsigned char * | output | ||
) |
Perform a PKCS#1 v1.5 encryption (RSAES-PKCS1-v1_5-ENCRYPT)
ctx | RSA context |
f_rng | RNG function (Needed for padding and MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
ilen | contains the plaintext length |
input | buffer holding the data to be encrypted |
output | buffer that will hold the ciphertext |
int mbedtls_rsa_rsassa_pkcs1_v15_sign | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
mbedtls_md_type_t | md_alg, | ||
unsigned int | hashlen, | ||
const unsigned char * | hash, | ||
unsigned char * | sig | ||
) |
Perform a PKCS#1 v1.5 signature (RSASSA-PKCS1-v1_5-SIGN)
ctx | RSA context |
f_rng | RNG function (Only needed for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
md_alg | a MBEDTLS_MD_XXX (use MBEDTLS_MD_NONE for signing raw data) |
hashlen | message digest length (for MBEDTLS_MD_NONE only) |
hash | buffer holding the message digest |
sig | buffer that will hold the ciphertext |
int mbedtls_rsa_rsassa_pkcs1_v15_verify | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
mbedtls_md_type_t | md_alg, | ||
unsigned int | hashlen, | ||
const unsigned char * | hash, | ||
const unsigned char * | sig | ||
) |
Perform a PKCS#1 v1.5 verification (RSASSA-PKCS1-v1_5-VERIFY)
ctx | points to an RSA public key |
f_rng | RNG function (Only needed for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
md_alg | a MBEDTLS_MD_XXX (use MBEDTLS_MD_NONE for signing raw data) |
hashlen | message digest length (for MBEDTLS_MD_NONE only) |
hash | buffer holding the message digest |
sig | buffer holding the ciphertext |
int mbedtls_rsa_rsassa_pss_sign | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
mbedtls_md_type_t | md_alg, | ||
unsigned int | hashlen, | ||
const unsigned char * | hash, | ||
unsigned char * | sig | ||
) |
Perform a PKCS#1 v2.1 PSS signature (RSASSA-PSS-SIGN)
ctx | RSA context |
f_rng | RNG function (Needed for PKCS#1 v2.1 encoding and for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
md_alg | a MBEDTLS_MD_XXX (use MBEDTLS_MD_NONE for signing raw data) |
hashlen | message digest length (for MBEDTLS_MD_NONE only) |
hash | buffer holding the message digest |
sig | buffer that will hold the ciphertext |
int mbedtls_rsa_rsassa_pss_verify | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
mbedtls_md_type_t | md_alg, | ||
unsigned int | hashlen, | ||
const unsigned char * | hash, | ||
const unsigned char * | sig | ||
) |
Perform a PKCS#1 v2.1 PSS verification (RSASSA-PSS-VERIFY) (This is the "simple" version.)
ctx | points to an RSA public key |
f_rng | RNG function (Only needed for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
md_alg | a MBEDTLS_MD_XXX (use MBEDTLS_MD_NONE for signing raw data) |
hashlen | message digest length (for MBEDTLS_MD_NONE only) |
hash | buffer holding the message digest |
sig | buffer holding the ciphertext |
int mbedtls_rsa_rsassa_pss_verify_ext | ( | mbedtls_rsa_context * | ctx, |
int(*)(void *, unsigned char *, size_t) | f_rng, | ||
void * | p_rng, | ||
int | mode, | ||
mbedtls_md_type_t | md_alg, | ||
unsigned int | hashlen, | ||
const unsigned char * | hash, | ||
mbedtls_md_type_t | mgf1_hash_id, | ||
int | expected_salt_len, | ||
const unsigned char * | sig | ||
) |
Perform a PKCS#1 v2.1 PSS verification (RSASSA-PSS-VERIFY) (This is the version with "full" options.)
ctx | points to an RSA public key |
f_rng | RNG function (Only needed for MBEDTLS_RSA_PRIVATE) |
p_rng | RNG parameter |
mode | MBEDTLS_RSA_PUBLIC or MBEDTLS_RSA_PRIVATE |
md_alg | a MBEDTLS_MD_XXX (use MBEDTLS_MD_NONE for signing raw data) |
hashlen | message digest length (for MBEDTLS_MD_NONE only) |
hash | buffer holding the message digest |
mgf1_hash_id | message digest used for mask generation |
expected_salt_len | Length of the salt used in padding, use MBEDTLS_RSA_SALT_LEN_ANY to accept any salt length |
sig | buffer holding the ciphertext |
int mbedtls_rsa_self_test | ( | int | verbose | ) |
Checkup routine.
void mbedtls_rsa_set_padding | ( | mbedtls_rsa_context * | ctx, |
int | padding, | ||
int | hash_id | ||
) |
Set padding for an already initialized RSA context See mbedtls_rsa_init()
for details.
ctx | RSA context to be set |
padding | MBEDTLS_RSA_PKCS_V15 or MBEDTLS_RSA_PKCS_V21 |
hash_id | MBEDTLS_RSA_PKCS_V21 hash identifier |
|
static |
Generate and apply the MGF1 operation (from PKCS#1 v2.1) to a buffer.
dst | buffer to mask |
dlen | length of destination buffer |
src | source of the mask generation |
slen | length of the source buffer |
md_ctx | message digest context to use |
|
static |
|
static |