#include "polarssl/config.h"
#include "polarssl/pk_wrap.h"
#include "polarssl/rsa.h"
#include "polarssl/ecp.h"
#include "polarssl/ecdsa.h"
#include <stdlib.h>
Go to the source code of this file.
Defines | |
#define | polarssl_malloc malloc |
#define | polarssl_free free |
Functions | |
static int | rsa_can_do (pk_type_t type) |
static size_t | rsa_get_size (const void *ctx) |
static int | rsa_verify_wrap (void *ctx, md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len) |
static int | rsa_sign_wrap (void *ctx, 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) |
static int | rsa_decrypt_wrap (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) |
static int | rsa_encrypt_wrap (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) |
static void * | rsa_alloc_wrap (void) |
static void | rsa_free_wrap (void *ctx) |
static void | rsa_debug (const void *ctx, pk_debug_item *items) |
static int | eckey_can_do (pk_type_t type) |
static size_t | eckey_get_size (const void *ctx) |
static int | ecdsa_verify_wrap (void *ctx, md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len) |
static int | ecdsa_sign_wrap (void *ctx, 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) |
static int | eckey_verify_wrap (void *ctx, md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len) |
static int | eckey_sign_wrap (void *ctx, 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) |
static void * | eckey_alloc_wrap (void) |
static void | eckey_free_wrap (void *ctx) |
static void | eckey_debug (const void *ctx, pk_debug_item *items) |
static int | eckeydh_can_do (pk_type_t type) |
static int | ecdsa_can_do (pk_type_t type) |
static void * | ecdsa_alloc_wrap (void) |
static void | ecdsa_free_wrap (void *ctx) |
static size_t | rsa_alt_get_size (const void *ctx) |
static int | rsa_alt_sign_wrap (void *ctx, 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) |
static int | rsa_alt_decrypt_wrap (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) |
static void * | rsa_alt_alloc_wrap (void) |
static void | rsa_alt_free_wrap (void *ctx) |
Variables | |
const pk_info_t | rsa_info |
const pk_info_t | eckey_info |
const pk_info_t | eckeydh_info |
const pk_info_t | ecdsa_info |
const pk_info_t | rsa_alt_info |
#define polarssl_free free |
#define polarssl_malloc malloc |
static void* ecdsa_alloc_wrap | ( | void | ) | [static] |
Definition at line 312 of file pk_wrap.c.
References ecdsa_init(), and polarssl_malloc.
static int ecdsa_can_do | ( | pk_type_t | type | ) | [static] |
Definition at line 286 of file pk_wrap.c.
References POLARSSL_PK_ECDSA.
static void ecdsa_free_wrap | ( | void * | ctx | ) | [static] |
Definition at line 322 of file pk_wrap.c.
References ecdsa_free(), and polarssl_free.
static int ecdsa_sign_wrap | ( | void * | ctx, | |
md_type_t | md_alg, | |||
const unsigned char * | hash, | |||
size_t | hash_len, | |||
unsigned char * | sig, | |||
size_t * | sig_len, | |||
int(*)(void *, unsigned char *, size_t) | f_rng, | |||
void * | p_rng | |||
) | [static] |
Definition at line 301 of file pk_wrap.c.
References ecdsa_write_signature().
Referenced by eckey_sign_wrap().
static int ecdsa_verify_wrap | ( | void * | ctx, | |
md_type_t | md_alg, | |||
const unsigned char * | hash, | |||
size_t | hash_len, | |||
const unsigned char * | sig, | |||
size_t | sig_len | |||
) | [static] |
Definition at line 291 of file pk_wrap.c.
References ecdsa_read_signature().
Referenced by eckey_verify_wrap().
static void* eckey_alloc_wrap | ( | void | ) | [static] |
Definition at line 219 of file pk_wrap.c.
References ecp_keypair_init(), and polarssl_malloc.
static int eckey_can_do | ( | pk_type_t | type | ) | [static] |
Definition at line 158 of file pk_wrap.c.
References POLARSSL_PK_ECDSA, POLARSSL_PK_ECKEY, and POLARSSL_PK_ECKEY_DH.
static void eckey_debug | ( | const void * | ctx, | |
pk_debug_item * | items | |||
) | [static] |
Definition at line 235 of file pk_wrap.c.
References pk_debug_item::name, POLARSSL_PK_DEBUG_ECP, pk_debug_item::type, and pk_debug_item::value.
static void eckey_free_wrap | ( | void * | ctx | ) | [static] |
Definition at line 229 of file pk_wrap.c.
References ecp_keypair_free(), and polarssl_free.
static size_t eckey_get_size | ( | const void * | ctx | ) | [static] |
static int eckey_sign_wrap | ( | void * | ctx, | |
md_type_t | md_alg, | |||
const unsigned char * | hash, | |||
size_t | hash_len, | |||
unsigned char * | sig, | |||
size_t * | sig_len, | |||
int(*)(void *, unsigned char *, size_t) | f_rng, | |||
void * | p_rng | |||
) | [static] |
Definition at line 198 of file pk_wrap.c.
References ecdsa_free(), ecdsa_from_keypair(), ecdsa_init(), and ecdsa_sign_wrap().
static int eckey_verify_wrap | ( | void * | ctx, | |
md_type_t | md_alg, | |||
const unsigned char * | hash, | |||
size_t | hash_len, | |||
const unsigned char * | sig, | |||
size_t | sig_len | |||
) | [static] |
Definition at line 181 of file pk_wrap.c.
References ecdsa_free(), ecdsa_from_keypair(), ecdsa_init(), and ecdsa_verify_wrap().
static int eckeydh_can_do | ( | pk_type_t | type | ) | [static] |
Definition at line 264 of file pk_wrap.c.
References POLARSSL_PK_ECKEY, and POLARSSL_PK_ECKEY_DH.
static void* rsa_alloc_wrap | ( | void | ) | [static] |
Definition at line 110 of file pk_wrap.c.
References polarssl_malloc, and rsa_init().
static void* rsa_alt_alloc_wrap | ( | void | ) | [static] |
Definition at line 384 of file pk_wrap.c.
References polarssl_malloc.
static int rsa_alt_decrypt_wrap | ( | void * | ctx, | |
const unsigned char * | input, | |||
size_t | ilen, | |||
unsigned char * | output, | |||
size_t * | olen, | |||
size_t | osize, | |||
int(*)(void *, unsigned char *, size_t) | f_rng, | |||
void * | p_rng | |||
) | [static] |
Definition at line 367 of file pk_wrap.c.
References rsa_alt_context::decrypt_func, rsa_alt_context::key, rsa_alt_context::key_len_func, POLARSSL_ERR_RSA_BAD_INPUT_DATA, and RSA_PRIVATE.
static void rsa_alt_free_wrap | ( | void * | ctx | ) | [static] |
Definition at line 394 of file pk_wrap.c.
References polarssl_free.
static size_t rsa_alt_get_size | ( | const void * | ctx | ) | [static] |
Definition at line 347 of file pk_wrap.c.
References rsa_alt_context::key, and rsa_alt_context::key_len_func.
static int rsa_alt_sign_wrap | ( | void * | ctx, | |
md_type_t | md_alg, | |||
const unsigned char * | hash, | |||
size_t | hash_len, | |||
unsigned char * | sig, | |||
size_t * | sig_len, | |||
int(*)(void *, unsigned char *, size_t) | f_rng, | |||
void * | p_rng | |||
) | [static] |
Definition at line 354 of file pk_wrap.c.
References rsa_alt_context::key, rsa_alt_context::key_len_func, RSA_PRIVATE, and rsa_alt_context::sign_func.
static int rsa_can_do | ( | pk_type_t | type | ) | [static] |
Definition at line 52 of file pk_wrap.c.
References POLARSSL_PK_RSA.
static void rsa_debug | ( | const void * | ctx, | |
pk_debug_item * | items | |||
) | [static] |
Definition at line 126 of file pk_wrap.c.
References pk_debug_item::name, POLARSSL_PK_DEBUG_MPI, pk_debug_item::type, and pk_debug_item::value.
static int rsa_decrypt_wrap | ( | void * | ctx, | |
const unsigned char * | input, | |||
size_t | ilen, | |||
unsigned char * | output, | |||
size_t * | olen, | |||
size_t | osize, | |||
int(*)(void *, unsigned char *, size_t) | f_rng, | |||
void * | p_rng | |||
) | [static] |
Definition at line 85 of file pk_wrap.c.
References POLARSSL_ERR_RSA_BAD_INPUT_DATA, rsa_pkcs1_decrypt(), and RSA_PRIVATE.
static int rsa_encrypt_wrap | ( | void * | ctx, | |
const unsigned char * | input, | |||
size_t | ilen, | |||
unsigned char * | output, | |||
size_t * | olen, | |||
size_t | osize, | |||
int(*)(void *, unsigned char *, size_t) | f_rng, | |||
void * | p_rng | |||
) | [static] |
Definition at line 97 of file pk_wrap.c.
References rsa_pkcs1_encrypt(), and RSA_PUBLIC.
static void rsa_free_wrap | ( | void * | ctx | ) | [static] |
Definition at line 120 of file pk_wrap.c.
References polarssl_free, and rsa_free().
static int rsa_sign_wrap | ( | void * | ctx, | |
md_type_t | md_alg, | |||
const unsigned char * | hash, | |||
size_t | hash_len, | |||
unsigned char * | sig, | |||
size_t * | sig_len, | |||
int(*)(void *, unsigned char *, size_t) | f_rng, | |||
void * | p_rng | |||
) | [static] |
Definition at line 74 of file pk_wrap.c.
References rsa_pkcs1_sign(), and RSA_PRIVATE.
static int rsa_verify_wrap | ( | void * | ctx, | |
md_type_t | md_alg, | |||
const unsigned char * | hash, | |||
size_t | hash_len, | |||
const unsigned char * | sig, | |||
size_t | sig_len | |||
) | [static] |
Definition at line 63 of file pk_wrap.c.
References POLARSSL_ERR_RSA_VERIFY_FAILED, rsa_pkcs1_verify(), and RSA_PUBLIC.
const pk_info_t ecdsa_info |
{ POLARSSL_PK_ECDSA, "ECDSA", eckey_get_size, ecdsa_can_do, ecdsa_verify_wrap, ecdsa_sign_wrap, NULL, NULL, ecdsa_alloc_wrap, ecdsa_free_wrap, eckey_debug, }
Definition at line 328 of file pk_wrap.c.
Referenced by pk_info_from_type().
const pk_info_t eckey_info |
{ POLARSSL_PK_ECKEY, "EC", eckey_get_size, eckey_can_do, eckey_verify_wrap, eckey_sign_wrap, NULL, NULL, eckey_alloc_wrap, eckey_free_wrap, eckey_debug, }
Definition at line 242 of file pk_wrap.c.
Referenced by pk_info_from_type().
const pk_info_t eckeydh_info |
{ POLARSSL_PK_ECKEY_DH, "EC_DH", eckey_get_size, eckeydh_can_do, NULL, NULL, NULL, NULL, eckey_alloc_wrap, eckey_free_wrap, eckey_debug, }
Definition at line 270 of file pk_wrap.c.
Referenced by pk_info_from_type().
const pk_info_t rsa_alt_info |
{ POLARSSL_PK_RSA_ALT, "RSA-alt", rsa_alt_get_size, rsa_can_do, NULL, rsa_alt_sign_wrap, rsa_alt_decrypt_wrap, NULL, rsa_alt_alloc_wrap, rsa_alt_free_wrap, NULL, }
Definition at line 399 of file pk_wrap.c.
Referenced by pk_init_ctx_rsa_alt().
{ POLARSSL_PK_RSA, "RSA", rsa_get_size, rsa_can_do, rsa_verify_wrap, rsa_sign_wrap, rsa_decrypt_wrap, rsa_encrypt_wrap, rsa_alloc_wrap, rsa_free_wrap, rsa_debug, }
Definition at line 139 of file pk_wrap.c.
Referenced by pk_info_from_type().