]> git.zerfleddert.de Git - proxmark3-svn/blob - common/mbedtls/pk_internal.h
Add ROCA vulnerability test (RRG repository PR 76 by @merlokk) (#762)
[proxmark3-svn] / common / mbedtls / pk_internal.h
1 /**
2 * \file pk_internal.h
3 *
4 * \brief Public Key abstraction layer: wrapper functions
5 */
6 /*
7 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
8 * SPDX-License-Identifier: GPL-2.0
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 *
24 * This file is part of mbed TLS (https://tls.mbed.org)
25 */
26
27 #ifndef MBEDTLS_PK_WRAP_H
28 #define MBEDTLS_PK_WRAP_H
29
30 #if !defined(MBEDTLS_CONFIG_FILE)
31 #include "config.h"
32 #else
33 #include MBEDTLS_CONFIG_FILE
34 #endif
35
36 #include "pk.h"
37
38 struct mbedtls_pk_info_t
39 {
40 /** Public key type */
41 mbedtls_pk_type_t type;
42
43 /** Type name */
44 const char *name;
45
46 /** Get key size in bits */
47 size_t (*get_bitlen)( const void * );
48
49 /** Tell if the context implements this type (e.g. ECKEY can do ECDSA) */
50 int (*can_do)( mbedtls_pk_type_t type );
51
52 /** Verify signature */
53 int (*verify_func)( void *ctx, mbedtls_md_type_t md_alg,
54 const unsigned char *hash, size_t hash_len,
55 const unsigned char *sig, size_t sig_len );
56
57 /** Make signature */
58 int (*sign_func)( void *ctx, mbedtls_md_type_t md_alg,
59 const unsigned char *hash, size_t hash_len,
60 unsigned char *sig, size_t *sig_len,
61 int (*f_rng)(void *, unsigned char *, size_t),
62 void *p_rng );
63
64 /** Decrypt message */
65 int (*decrypt_func)( void *ctx, const unsigned char *input, size_t ilen,
66 unsigned char *output, size_t *olen, size_t osize,
67 int (*f_rng)(void *, unsigned char *, size_t),
68 void *p_rng );
69
70 /** Encrypt message */
71 int (*encrypt_func)( void *ctx, const unsigned char *input, size_t ilen,
72 unsigned char *output, size_t *olen, size_t osize,
73 int (*f_rng)(void *, unsigned char *, size_t),
74 void *p_rng );
75
76 /** Check public-private key pair */
77 int (*check_pair_func)( const void *pub, const void *prv );
78
79 /** Allocate a new context */
80 void * (*ctx_alloc_func)( void );
81
82 /** Free the given context */
83 void (*ctx_free_func)( void *ctx );
84
85 /** Interface with the debug module */
86 void (*debug_func)( const void *ctx, mbedtls_pk_debug_item *items );
87
88 };
89 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
90 /* Container for RSA-alt */
91 typedef struct
92 {
93 void *key;
94 mbedtls_pk_rsa_alt_decrypt_func decrypt_func;
95 mbedtls_pk_rsa_alt_sign_func sign_func;
96 mbedtls_pk_rsa_alt_key_len_func key_len_func;
97 } mbedtls_rsa_alt_context;
98 #endif
99
100 #if defined(MBEDTLS_RSA_C)
101 extern const mbedtls_pk_info_t mbedtls_rsa_info;
102 #endif
103
104 #if defined(MBEDTLS_ECP_C)
105 extern const mbedtls_pk_info_t mbedtls_eckey_info;
106 extern const mbedtls_pk_info_t mbedtls_eckeydh_info;
107 #endif
108
109 #if defined(MBEDTLS_ECDSA_C)
110 extern const mbedtls_pk_info_t mbedtls_ecdsa_info;
111 #endif
112
113 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
114 extern const mbedtls_pk_info_t mbedtls_rsa_alt_info;
115 #endif
116
117 #endif /* MBEDTLS_PK_WRAP_H */
Impressum, Datenschutz