pk_internal.h
Go to the documentation of this file.
#ifndef MBEDTLS_PK_WRAP_H
#define MBEDTLS_PK_WRAP_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "pk.h"
struct mbedtls_pk_info_t
{
mbedtls_pk_type_t type;
const char *name;
size_t (*get_bitlen)( const void * );
int (*can_do)( mbedtls_pk_type_t type );
int (*verify_func)( void *ctx, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len,
const unsigned char *sig, size_t sig_len );
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 );
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 );
int (*encrypt_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 );
int (*check_pair_func)( const void *pub, const void *prv );
void * (*ctx_alloc_func)( void );
void (*ctx_free_func)( void *ctx );
void (*debug_func)( const void *ctx, mbedtls_pk_debug_item *items );
};
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/* Container for RSA-alt */
typedef struct
{
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;
} mbedtls_rsa_alt_context;
#endif
#if defined(MBEDTLS_RSA_C)
extern const mbedtls_pk_info_t mbedtls_rsa_info;
#endif
#if defined(MBEDTLS_ECP_C)
extern const mbedtls_pk_info_t mbedtls_eckey_info;
extern const mbedtls_pk_info_t mbedtls_eckeydh_info;
#endif
#if defined(MBEDTLS_ECDSA_C)
extern const mbedtls_pk_info_t mbedtls_ecdsa_info;
#endif
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
extern const mbedtls_pk_info_t mbedtls_rsa_alt_info;
#endif
#endif /* MBEDTLS_PK_WRAP_H */
mbedtls_ecdsa_info
const mbedtls_pk_info_t mbedtls_ecdsa_info
mbedtls_pk_info_t::encrypt_func
int(* encrypt_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)
Encrypt message.
Definition: pk_internal.h:68
mbedtls_rsa_alt_info
const mbedtls_pk_info_t mbedtls_rsa_alt_info
mbedtls_rsa_alt_context::decrypt_func
mbedtls_pk_rsa_alt_decrypt_func decrypt_func
Definition: pk_internal.h:91
mbedtls_pk_type_t
mbedtls_pk_type_t
Public key types.
Definition: pk.h:74
config.h
Configuration options (set of defines)
mbedtls_rsa_alt_context
Definition: pk_internal.h:88
mbedtls_pk_info_t::type
mbedtls_pk_type_t type
Public key type.
Definition: pk_internal.h:38
mbedtls_rsa_alt_context::key
void * key
Definition: pk_internal.h:90
pk.h
Public Key abstraction layer.
mbedtls_pk_info_t::decrypt_func
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)
Decrypt message.
Definition: pk_internal.h:62
mbedtls_pk_rsa_alt_key_len_func
size_t(* mbedtls_pk_rsa_alt_key_len_func)(void *ctx)
Definition: pk.h:169
mbedtls_rsa_alt_context::key_len_func
mbedtls_pk_rsa_alt_key_len_func key_len_func
Definition: pk_internal.h:93
mbedtls_pk_info_t::name
const char * name
Type name.
Definition: pk_internal.h:41
mbedtls_pk_info_t
Definition: pk_internal.h:35
mbedtls_rsa_alt_context::sign_func
mbedtls_pk_rsa_alt_sign_func sign_func
Definition: pk_internal.h:92
mbedtls_pk_info_t::check_pair_func
int(* check_pair_func)(const void *pub, const void *prv)
Check public-private key pair.
Definition: pk_internal.h:74
mbedtls_pk_info_t::get_bitlen
size_t(* get_bitlen)(const void *)
Get key size in bits.
Definition: pk_internal.h:44
mbedtls_rsa_info
const mbedtls_pk_info_t mbedtls_rsa_info
mbedtls_pk_info_t::debug_func
void(* debug_func)(const void *ctx, mbedtls_pk_debug_item *items)
Interface with the debug module.
Definition: pk_internal.h:83
mbedtls_pk_info_t::can_do
int(* can_do)(mbedtls_pk_type_t type)
Tell if the context implements this type (e.g.
Definition: pk_internal.h:47
mbedtls_pk_info_t::verify_func
int(* verify_func)(void *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.
Definition: pk_internal.h:50
mbedtls_pk_rsa_alt_sign_func
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:165
mbedtls_pk_rsa_alt_decrypt_func
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:162
mbedtls_eckeydh_info
const mbedtls_pk_info_t mbedtls_eckeydh_info
mbedtls_eckey_info
const mbedtls_pk_info_t mbedtls_eckey_info
mbedtls_md_type_t
mbedtls_md_type_t
Definition: md.h:39
mbedtls_pk_debug_item
Item to send to the debug module.
Definition: pk.h:108
mbedtls_pk_info_t::ctx_free_func
void(* ctx_free_func)(void *ctx)
Free the given context.
Definition: pk_internal.h:80
mbedtls_pk_info_t::sign_func
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)
Make signature.
Definition: pk_internal.h:55