mbed TLS v2.2.0
pk_internal.h
Go to the documentation of this file.
1 
24 #ifndef MBEDTLS_PK_WRAP_H
25 #define MBEDTLS_PK_WRAP_H
26 
27 #if !defined(MBEDTLS_CONFIG_FILE)
28 #include "config.h"
29 #else
30 #include MBEDTLS_CONFIG_FILE
31 #endif
32 
33 #include "pk.h"
34 
36 {
39 
41  const char *name;
42 
44  size_t (*get_bitlen)( const void * );
45 
48 
50  int (*verify_func)( void *ctx, mbedtls_md_type_t md_alg,
51  const unsigned char *hash, size_t hash_len,
52  const unsigned char *sig, size_t sig_len );
53 
55  int (*sign_func)( void *ctx, mbedtls_md_type_t md_alg,
56  const unsigned char *hash, size_t hash_len,
57  unsigned char *sig, size_t *sig_len,
58  int (*f_rng)(void *, unsigned char *, size_t),
59  void *p_rng );
60 
62  int (*decrypt_func)( void *ctx, const unsigned char *input, size_t ilen,
63  unsigned char *output, size_t *olen, size_t osize,
64  int (*f_rng)(void *, unsigned char *, size_t),
65  void *p_rng );
66 
68  int (*encrypt_func)( void *ctx, const unsigned char *input, size_t ilen,
69  unsigned char *output, size_t *olen, size_t osize,
70  int (*f_rng)(void *, unsigned char *, size_t),
71  void *p_rng );
72 
74  int (*check_pair_func)( const void *pub, const void *prv );
75 
77  void * (*ctx_alloc_func)( void );
78 
80  void (*ctx_free_func)( void *ctx );
81 
83  void (*debug_func)( const void *ctx, mbedtls_pk_debug_item *items );
84 
85 };
86 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
87 /* Container for RSA-alt */
88 typedef struct
89 {
90  void *key;
91  mbedtls_pk_rsa_alt_decrypt_func decrypt_func;
92  mbedtls_pk_rsa_alt_sign_func sign_func;
93  mbedtls_pk_rsa_alt_key_len_func key_len_func;
94 } mbedtls_rsa_alt_context;
95 #endif
96 
97 #if defined(MBEDTLS_RSA_C)
98 extern const mbedtls_pk_info_t mbedtls_rsa_info;
99 #endif
100 
101 #if defined(MBEDTLS_ECP_C)
102 extern const mbedtls_pk_info_t mbedtls_eckey_info;
103 extern const mbedtls_pk_info_t mbedtls_eckeydh_info;
104 #endif
105 
106 #if defined(MBEDTLS_ECDSA_C)
107 extern const mbedtls_pk_info_t mbedtls_ecdsa_info;
108 #endif
109 
110 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
111 extern const mbedtls_pk_info_t mbedtls_rsa_alt_info;
112 #endif
113 
114 #endif /* MBEDTLS_PK_WRAP_H */
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_pk_type_t
Public key types.
Definition: pk.h:74
Compatibility names (set of defines)
mbedtls_pk_type_t type
Public key type.
Definition: pk_internal.h:38
Public Key abstraction layer.
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
const char * name
Type name.
Definition: pk_internal.h:41
int(* check_pair_func)(const void *pub, const void *prv)
Check public-private key pair.
Definition: pk_internal.h:74
size_t(* get_bitlen)(const void *)
Get key size in bits.
Definition: pk_internal.h:44
void(* debug_func)(const void *ctx, mbedtls_pk_debug_item *items)
Interface with the debug module.
Definition: pk_internal.h:83
int(* can_do)(mbedtls_pk_type_t type)
Tell if the context implements this type (e.g.
Definition: pk_internal.h:47
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_md_type_t
Definition: md.h:39
Item to send to the debug module.
Definition: pk.h:108
void(* ctx_free_func)(void *ctx)
Free the given context.
Definition: pk_internal.h:80
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