Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
pk_internal.h
00001 /** 00002 * \file pk_internal.h 00003 * 00004 * \brief Public Key abstraction layer: wrapper functions 00005 */ 00006 /* 00007 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 00008 * SPDX-License-Identifier: Apache-2.0 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00011 * not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00018 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 * 00022 * This file is part of mbed TLS (https://tls.mbed.org) 00023 */ 00024 00025 #ifndef MBEDTLS_PK_WRAP_H 00026 #define MBEDTLS_PK_WRAP_H 00027 00028 #if !defined(MBEDTLS_CONFIG_FILE) 00029 #include "mbedtls/config.h" 00030 #else 00031 #include MBEDTLS_CONFIG_FILE 00032 #endif 00033 00034 #include "mbedtls/pk.h" 00035 00036 struct mbedtls_pk_info_t 00037 { 00038 /** Public key type */ 00039 mbedtls_pk_type_t type; 00040 00041 /** Type name */ 00042 const char *name; 00043 00044 /** Get key size in bits */ 00045 size_t (*get_bitlen)( const void * ); 00046 00047 /** Tell if the context implements this type (e.g. ECKEY can do ECDSA) */ 00048 int (*can_do)( mbedtls_pk_type_t type ); 00049 00050 /** Verify signature */ 00051 int (*verify_func)( void *ctx, mbedtls_md_type_t md_alg, 00052 const unsigned char *hash, size_t hash_len, 00053 const unsigned char *sig, size_t sig_len ); 00054 00055 /** Make signature */ 00056 int (*sign_func)( void *ctx, mbedtls_md_type_t md_alg, 00057 const unsigned char *hash, size_t hash_len, 00058 unsigned char *sig, size_t *sig_len, 00059 int (*f_rng)(void *, unsigned char *, size_t), 00060 void *p_rng ); 00061 00062 #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE) 00063 /** Verify signature (restartable) */ 00064 int (*verify_rs_func)( void *ctx, mbedtls_md_type_t md_alg, 00065 const unsigned char *hash, size_t hash_len, 00066 const unsigned char *sig, size_t sig_len, 00067 void *rs_ctx ); 00068 00069 /** Make signature (restartable) */ 00070 int (*sign_rs_func)( void *ctx, mbedtls_md_type_t md_alg, 00071 const unsigned char *hash, size_t hash_len, 00072 unsigned char *sig, size_t *sig_len, 00073 int (*f_rng)(void *, unsigned char *, size_t), 00074 void *p_rng, void *rs_ctx ); 00075 #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */ 00076 00077 /** Decrypt message */ 00078 int (*decrypt_func)( void *ctx, const unsigned char *input, size_t ilen, 00079 unsigned char *output, size_t *olen, size_t osize, 00080 int (*f_rng)(void *, unsigned char *, size_t), 00081 void *p_rng ); 00082 00083 /** Encrypt message */ 00084 int (*encrypt_func)( void *ctx, const unsigned char *input, size_t ilen, 00085 unsigned char *output, size_t *olen, size_t osize, 00086 int (*f_rng)(void *, unsigned char *, size_t), 00087 void *p_rng ); 00088 00089 /** Check public-private key pair */ 00090 int (*check_pair_func)( const void *pub, const void *prv ); 00091 00092 /** Allocate a new context */ 00093 void * (*ctx_alloc_func)( void ); 00094 00095 /** Free the given context */ 00096 void (*ctx_free_func)( void *ctx ); 00097 00098 #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE) 00099 /** Allocate the restart context */ 00100 void * (*rs_alloc_func)( void ); 00101 00102 /** Free the restart context */ 00103 void (*rs_free_func)( void *rs_ctx ); 00104 #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */ 00105 00106 /** Interface with the debug module */ 00107 void (*debug_func)( const void *ctx, mbedtls_pk_debug_item *items ); 00108 00109 }; 00110 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) 00111 /* Container for RSA-alt */ 00112 typedef struct 00113 { 00114 void *key; 00115 mbedtls_pk_rsa_alt_decrypt_func decrypt_func; 00116 mbedtls_pk_rsa_alt_sign_func sign_func; 00117 mbedtls_pk_rsa_alt_key_len_func key_len_func; 00118 } mbedtls_rsa_alt_context; 00119 #endif 00120 00121 #if defined(MBEDTLS_RSA_C) 00122 extern const mbedtls_pk_info_t mbedtls_rsa_info; 00123 #endif 00124 00125 #if defined(MBEDTLS_ECP_C) 00126 extern const mbedtls_pk_info_t mbedtls_eckey_info; 00127 extern const mbedtls_pk_info_t mbedtls_eckeydh_info; 00128 #endif 00129 00130 #if defined(MBEDTLS_ECDSA_C) 00131 extern const mbedtls_pk_info_t mbedtls_ecdsa_info; 00132 #endif 00133 00134 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) 00135 extern const mbedtls_pk_info_t mbedtls_rsa_alt_info; 00136 #endif 00137 00138 #if defined(MBEDTLS_USE_PSA_CRYPTO) 00139 extern const mbedtls_pk_info_t mbedtls_pk_opaque_info; 00140 #endif 00141 00142 #endif /* MBEDTLS_PK_WRAP_H */
Generated on Tue Jul 12 2022 13:54:41 by
