29 #if !defined(MBEDTLS_CONFIG_FILE) 32 #include MBEDTLS_CONFIG_FILE 37 #if defined(MBEDTLS_RSA_C) 41 #if defined(MBEDTLS_ECP_C) 45 #if defined(MBEDTLS_ECDSA_C) 49 #define MBEDTLS_ERR_PK_ALLOC_FAILED -0x3F80 50 #define MBEDTLS_ERR_PK_TYPE_MISMATCH -0x3F00 51 #define MBEDTLS_ERR_PK_BAD_INPUT_DATA -0x3E80 52 #define MBEDTLS_ERR_PK_FILE_IO_ERROR -0x3E00 53 #define MBEDTLS_ERR_PK_KEY_INVALID_VERSION -0x3D80 54 #define MBEDTLS_ERR_PK_KEY_INVALID_FORMAT -0x3D00 55 #define MBEDTLS_ERR_PK_UNKNOWN_PK_ALG -0x3C80 56 #define MBEDTLS_ERR_PK_PASSWORD_REQUIRED -0x3C00 57 #define MBEDTLS_ERR_PK_PASSWORD_MISMATCH -0x3B80 58 #define MBEDTLS_ERR_PK_INVALID_PUBKEY -0x3B00 59 #define MBEDTLS_ERR_PK_INVALID_ALG -0x3A80 60 #define MBEDTLS_ERR_PK_UNKNOWN_NAMED_CURVE -0x3A00 61 #define MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE -0x3980 62 #define MBEDTLS_ERR_PK_SIG_LEN_MISMATCH -0x3900 113 #define MBEDTLS_PK_DEBUG_MAX_ITEMS 3 129 #if defined(MBEDTLS_RSA_C) 142 #if defined(MBEDTLS_ECP_C) 155 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) 161 size_t output_max_len );
163 int (*f_rng)(
void *,
unsigned char *, size_t),
void *p_rng,
165 const unsigned char *hash,
unsigned char *sig );
204 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) 281 const unsigned char *hash,
size_t hash_len,
282 const unsigned char *sig,
size_t sig_len );
315 const unsigned char *hash,
size_t hash_len,
316 const unsigned char *sig,
size_t sig_len );
343 const unsigned char *hash,
size_t hash_len,
344 unsigned char *sig,
size_t *sig_len,
345 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
364 const unsigned char *
input,
size_t ilen,
365 unsigned char *
output,
size_t *olen,
size_t osize,
366 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
385 const unsigned char *
input,
size_t ilen,
386 unsigned char *
output,
size_t *olen,
size_t osize,
387 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
427 #if defined(MBEDTLS_PK_PARSE_C) 448 const unsigned char *key,
size_t keylen,
449 const unsigned char *pwd,
size_t pwdlen );
469 const unsigned char *key,
size_t keylen );
471 #if defined(MBEDTLS_FS_IO) 511 #if defined(MBEDTLS_PK_WRITE_C) 542 #if defined(MBEDTLS_PEM_WRITE_C) 572 #if defined(MBEDTLS_PK_PARSE_C) 586 #if defined(MBEDTLS_PK_WRITE_C) 605 #if defined(MBEDTLS_FS_IO) void * value
Definition: pk.h:109
int mbedtls_pk_parse_keyfile(mbedtls_pk_context *ctx, const char *path, const char *password)
Load and parse a private key.
Definition: pkparse.c:118
Definition: pk_internal.h:35
const char * name
Definition: pk.h:108
int mbedtls_pk_verify_ext(mbedtls_pk_type_t type, const void *options, mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len)
Verify signature, with options. (Includes verification of the padding depending on type....
Definition: pk.c:196
Elliptic curves over GF(p)
GLenum mode
Definition: glext.h:6857
static const unsigned char password[MAX_TESTS][32]
Definition: pkcs5.c:305
#define INLINE
Definition: retro_inline.h:35
int mbedtls_pk_sign(mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, unsigned char *sig, size_t *sig_len, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Make signature, including padding if relevant.
Definition: pk.c:254
int mbedtls_pk_verify(mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len)
Verify signature (including padding if relevant).
Definition: pk.c:178
int mbedtls_pk_decrypt(mbedtls_pk_context *ctx, const unsigned char *input, size_t ilen, unsigned char *output, size_t *olen, size_t osize, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Decrypt message (including padding if relevant).
Definition: pk.c:273
Configuration options (set of defines)
GLuint start
Definition: glext.h:6292
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
void mbedtls_pk_free(mbedtls_pk_context *ctx)
Free a mbedtls_pk_context.
Definition: pk.c:63
Definition: libretro.h:2275
int(* sign_func)(void *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, unsigned char *sig, size_t *sig_len, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Definition: pk_internal.h:55
GLsizei const GLchar ** path
Definition: glext.h:7901
int expected_salt_len
Definition: pk.h:88
GLsizeiptr size
Definition: glext.h:6559
int mbedtls_pk_write_key_pem(mbedtls_pk_context *ctx, unsigned char *buf, size_t size)
Write a private key to a PKCS#1 or SEC1 PEM string.
Definition: pkwrite.c:400
static INLINE mbedtls_ecp_keypair * mbedtls_pk_ec(const mbedtls_pk_context pk)
Definition: pk.h:149
int mbedtls_pk_parse_key(mbedtls_pk_context *ctx, const unsigned char *key, size_t keylen, const unsigned char *pwd, size_t pwdlen)
Parse a private key in PEM or DER format.
Definition: pkparse.c:1056
int mbedtls_pk_write_key_der(mbedtls_pk_context *ctx, unsigned char *buf, size_t size)
Write a private key to a PKCS#1 or SEC1 DER structure Note: data is written at the end of the buffer!...
Definition: pkwrite.c:199
int mbedtls_pk_check_pair(const mbedtls_pk_context *pub, const mbedtls_pk_context *prv)
Check if a public-private pair of keys matches.
Definition: pk.c:309
int mbedtls_pk_load_file(const char *path, unsigned char **buf, size_t *n)
Definition: pkparse.c:73
const mbedtls_pk_info_t * mbedtls_pk_info_from_type(mbedtls_pk_type_t pk_type)
Return information associated with the given PK type.
Definition: pk.c:76
int mbedtls_pk_write_pubkey_der(mbedtls_pk_context *ctx, unsigned char *buf, size_t size)
Write a public key to a SubjectPublicKeyInfo DER structure Note: data is written at the end of the bu...
Definition: pkwrite.c:151
GLenum GLenum GLenum input
Definition: glext.h:9938
mbedtls_pk_debug_type type
Definition: pk.h:107
mbedtls_md_type_t
Definition: md.h:39
int mbedtls_pk_parse_public_keyfile(mbedtls_pk_context *ctx, const char *path)
Load and parse a public key.
Definition: pkparse.c:143
mbedtls_pk_type_t mbedtls_pk_get_type(const mbedtls_pk_context *ctx)
Get the key type.
Definition: pk.c:372
mbedtls_pk_type_t
Public key types.
Definition: pk.h:71
int mbedtls_pk_write_pubkey(unsigned char **p, unsigned char *start, const mbedtls_pk_context *key)
Write a subjectPublicKey to ASN.1 data Note: function works backwards in data buffer.
Definition: pkwrite.c:130
int mbedtls_pk_parse_subpubkey(unsigned char **p, const unsigned char *end, mbedtls_pk_context *pk)
Parse a SubjectPublicKeyInfo DER structure.
Definition: pkparse.c:576
GLenum type
Definition: glext.h:6233
int mbedtls_pk_setup_rsa_alt(mbedtls_pk_context *ctx, void *key, mbedtls_pk_rsa_alt_decrypt_func decrypt_func, mbedtls_pk_rsa_alt_sign_func sign_func, mbedtls_pk_rsa_alt_key_len_func key_len_func)
Initialize an RSA-alt context.
Definition: pk.c:119
const mbedtls_pk_info_t * pk_info
Definition: pk.h:125
int mbedtls_pk_write_pubkey_pem(mbedtls_pk_context *ctx, unsigned char *buf, size_t size)
Write a public key to a PEM string.
Definition: pkwrite.c:378
AVFormatContext * ctx
Definition: record_ffmpeg.c:247
int mbedtls_pk_can_do(const mbedtls_pk_context *ctx, mbedtls_pk_type_t type)
Tell if a context can do the operation given by type.
Definition: pk.c:149
Generic message digest wrapper.
int mbedtls_pk_parse_public_key(mbedtls_pk_context *ctx, const unsigned char *key, size_t keylen)
Parse a public key in PEM or DER format.
Definition: pkparse.c:1245
Options for RSASSA-PSS signature verification. See mbedtls_rsa_rsassa_pss_verify_ext()
Definition: pk.h:85
static INLINE size_t mbedtls_pk_get_len(const mbedtls_pk_context *ctx)
Get the length in bytes of the underlying key.
Definition: pk.h:240
void * pk_ctx
Definition: pk.h:126
int mbedtls_pk_encrypt(mbedtls_pk_context *ctx, const unsigned char *input, size_t ilen, unsigned char *output, size_t *olen, size_t osize, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Encrypt message (including padding if relevant).
Definition: pk.c:291
void mbedtls_pk_init(mbedtls_pk_context *ctx)
Initialize a mbedtls_pk_context (as NONE)
Definition: pk.c:51
GLfloat GLfloat p
Definition: glext.h:9809
int(* decrypt_func)(void *ctx, const unsigned char *input, size_t ilen, unsigned char *output, size_t *olen, size_t osize, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Definition: pk_internal.h:62
int(* mbedtls_pk_rsa_alt_decrypt_func)(void *ctx, int mode, size_t *olen, const unsigned char *input, unsigned char *output, size_t output_max_len)
Types for RSA-alt abstraction.
Definition: pk.h:159
size_t(* mbedtls_pk_rsa_alt_key_len_func)(void *ctx)
Definition: pk.h:166
int mbedtls_pk_debug(const mbedtls_pk_context *ctx, mbedtls_pk_debug_item *items)
Export debug information.
Definition: pk.c:346
std::string output
Definition: Config.FromFile.cpp:44
const char * mbedtls_pk_get_name(const mbedtls_pk_context *ctx)
Access the type name.
Definition: pk.c:361
Public key container.
Definition: pk.h:123
mbedtls_md_type_t mgf1_hash_id
Definition: pk.h:87
GLuint GLuint end
Definition: glext.h:6292
RSA context structure.
Definition: rsa.h:79
int(* mbedtls_pk_rsa_alt_sign_func)(void *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)
Definition: pk.h:162
Item to send to the debug module.
Definition: pk.h:105
static INLINE mbedtls_rsa_context * mbedtls_pk_rsa(const mbedtls_pk_context pk)
Definition: pk.h:136
The RSA public-key cryptosystem.
size_t mbedtls_pk_get_bitlen(const mbedtls_pk_context *ctx)
Get the size in bits of the underlying key.
Definition: pk.c:335
int mbedtls_pk_setup(mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info)
Initialize a PK context with the information given and allocates the type-specific PK subcontext.
Definition: pk.c:102
GLdouble n
Definition: glext.h:8396
bf_uint8_t options
Definition: connect_ps4.c:78
ECP key pair structure.
Definition: ecp.h:165
mbedtls_pk_debug_type
Types for interfacing with the debug module.
Definition: pk.h:95