I added functionality to get the RSSI, BER, and Cell Neighbor for reporting connection issues to M2X
Dependencies: WncControllerK64F
mbedtls/mbedtls/pk_internal.h@18:198e9b0acf11, 2016-11-17 (annotated)
- Committer:
- JMF
- Date:
- Thu Nov 17 16:13:29 2016 +0000
- Revision:
- 18:198e9b0acf11
- Parent:
- 12:0071cb144c7a
Updates to mbed os resulted in mutex.h going away and rtos.h needed to be used; This fixes the Mutex typedef failure. Also cast data buffers from 'char *' to (const std::uint8_t*) to conform with Fred's changes in WncController
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JMF | 12:0071cb144c7a | 1 | /** |
JMF | 12:0071cb144c7a | 2 | * \file pk.h |
JMF | 12:0071cb144c7a | 3 | * |
JMF | 12:0071cb144c7a | 4 | * \brief Public Key abstraction layer: wrapper functions |
JMF | 12:0071cb144c7a | 5 | * |
JMF | 12:0071cb144c7a | 6 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved |
JMF | 12:0071cb144c7a | 7 | * SPDX-License-Identifier: Apache-2.0 |
JMF | 12:0071cb144c7a | 8 | * |
JMF | 12:0071cb144c7a | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
JMF | 12:0071cb144c7a | 10 | * not use this file except in compliance with the License. |
JMF | 12:0071cb144c7a | 11 | * You may obtain a copy of the License at |
JMF | 12:0071cb144c7a | 12 | * |
JMF | 12:0071cb144c7a | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
JMF | 12:0071cb144c7a | 14 | * |
JMF | 12:0071cb144c7a | 15 | * Unless required by applicable law or agreed to in writing, software |
JMF | 12:0071cb144c7a | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
JMF | 12:0071cb144c7a | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
JMF | 12:0071cb144c7a | 18 | * See the License for the specific language governing permissions and |
JMF | 12:0071cb144c7a | 19 | * limitations under the License. |
JMF | 12:0071cb144c7a | 20 | * |
JMF | 12:0071cb144c7a | 21 | * This file is part of mbed TLS (https://tls.mbed.org) |
JMF | 12:0071cb144c7a | 22 | */ |
JMF | 12:0071cb144c7a | 23 | |
JMF | 12:0071cb144c7a | 24 | #ifndef MBEDTLS_PK_WRAP_H |
JMF | 12:0071cb144c7a | 25 | #define MBEDTLS_PK_WRAP_H |
JMF | 12:0071cb144c7a | 26 | |
JMF | 12:0071cb144c7a | 27 | #if !defined(MBEDTLS_CONFIG_FILE) |
JMF | 12:0071cb144c7a | 28 | #include "config.h" |
JMF | 12:0071cb144c7a | 29 | #else |
JMF | 12:0071cb144c7a | 30 | #include MBEDTLS_CONFIG_FILE |
JMF | 12:0071cb144c7a | 31 | #endif |
JMF | 12:0071cb144c7a | 32 | |
JMF | 12:0071cb144c7a | 33 | #include "pk.h" |
JMF | 12:0071cb144c7a | 34 | |
JMF | 12:0071cb144c7a | 35 | struct mbedtls_pk_info_t |
JMF | 12:0071cb144c7a | 36 | { |
JMF | 12:0071cb144c7a | 37 | /** Public key type */ |
JMF | 12:0071cb144c7a | 38 | mbedtls_pk_type_t type; |
JMF | 12:0071cb144c7a | 39 | |
JMF | 12:0071cb144c7a | 40 | /** Type name */ |
JMF | 12:0071cb144c7a | 41 | const char *name; |
JMF | 12:0071cb144c7a | 42 | |
JMF | 12:0071cb144c7a | 43 | /** Get key size in bits */ |
JMF | 12:0071cb144c7a | 44 | size_t (*get_bitlen)( const void * ); |
JMF | 12:0071cb144c7a | 45 | |
JMF | 12:0071cb144c7a | 46 | /** Tell if the context implements this type (e.g. ECKEY can do ECDSA) */ |
JMF | 12:0071cb144c7a | 47 | int (*can_do)( mbedtls_pk_type_t type ); |
JMF | 12:0071cb144c7a | 48 | |
JMF | 12:0071cb144c7a | 49 | /** Verify signature */ |
JMF | 12:0071cb144c7a | 50 | int (*verify_func)( void *ctx, mbedtls_md_type_t md_alg, |
JMF | 12:0071cb144c7a | 51 | const unsigned char *hash, size_t hash_len, |
JMF | 12:0071cb144c7a | 52 | const unsigned char *sig, size_t sig_len ); |
JMF | 12:0071cb144c7a | 53 | |
JMF | 12:0071cb144c7a | 54 | /** Make signature */ |
JMF | 12:0071cb144c7a | 55 | int (*sign_func)( void *ctx, mbedtls_md_type_t md_alg, |
JMF | 12:0071cb144c7a | 56 | const unsigned char *hash, size_t hash_len, |
JMF | 12:0071cb144c7a | 57 | unsigned char *sig, size_t *sig_len, |
JMF | 12:0071cb144c7a | 58 | int (*f_rng)(void *, unsigned char *, size_t), |
JMF | 12:0071cb144c7a | 59 | void *p_rng ); |
JMF | 12:0071cb144c7a | 60 | |
JMF | 12:0071cb144c7a | 61 | /** Decrypt message */ |
JMF | 12:0071cb144c7a | 62 | int (*decrypt_func)( void *ctx, const unsigned char *input, size_t ilen, |
JMF | 12:0071cb144c7a | 63 | unsigned char *output, size_t *olen, size_t osize, |
JMF | 12:0071cb144c7a | 64 | int (*f_rng)(void *, unsigned char *, size_t), |
JMF | 12:0071cb144c7a | 65 | void *p_rng ); |
JMF | 12:0071cb144c7a | 66 | |
JMF | 12:0071cb144c7a | 67 | /** Encrypt message */ |
JMF | 12:0071cb144c7a | 68 | int (*encrypt_func)( void *ctx, const unsigned char *input, size_t ilen, |
JMF | 12:0071cb144c7a | 69 | unsigned char *output, size_t *olen, size_t osize, |
JMF | 12:0071cb144c7a | 70 | int (*f_rng)(void *, unsigned char *, size_t), |
JMF | 12:0071cb144c7a | 71 | void *p_rng ); |
JMF | 12:0071cb144c7a | 72 | |
JMF | 12:0071cb144c7a | 73 | /** Check public-private key pair */ |
JMF | 12:0071cb144c7a | 74 | int (*check_pair_func)( const void *pub, const void *prv ); |
JMF | 12:0071cb144c7a | 75 | |
JMF | 12:0071cb144c7a | 76 | /** Allocate a new context */ |
JMF | 12:0071cb144c7a | 77 | void * (*ctx_alloc_func)( void ); |
JMF | 12:0071cb144c7a | 78 | |
JMF | 12:0071cb144c7a | 79 | /** Free the given context */ |
JMF | 12:0071cb144c7a | 80 | void (*ctx_free_func)( void *ctx ); |
JMF | 12:0071cb144c7a | 81 | |
JMF | 12:0071cb144c7a | 82 | /** Interface with the debug module */ |
JMF | 12:0071cb144c7a | 83 | void (*debug_func)( const void *ctx, mbedtls_pk_debug_item *items ); |
JMF | 12:0071cb144c7a | 84 | |
JMF | 12:0071cb144c7a | 85 | }; |
JMF | 12:0071cb144c7a | 86 | #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) |
JMF | 12:0071cb144c7a | 87 | /* Container for RSA-alt */ |
JMF | 12:0071cb144c7a | 88 | typedef struct |
JMF | 12:0071cb144c7a | 89 | { |
JMF | 12:0071cb144c7a | 90 | void *key; |
JMF | 12:0071cb144c7a | 91 | mbedtls_pk_rsa_alt_decrypt_func decrypt_func; |
JMF | 12:0071cb144c7a | 92 | mbedtls_pk_rsa_alt_sign_func sign_func; |
JMF | 12:0071cb144c7a | 93 | mbedtls_pk_rsa_alt_key_len_func key_len_func; |
JMF | 12:0071cb144c7a | 94 | } mbedtls_rsa_alt_context; |
JMF | 12:0071cb144c7a | 95 | #endif |
JMF | 12:0071cb144c7a | 96 | |
JMF | 12:0071cb144c7a | 97 | #if defined(MBEDTLS_RSA_C) |
JMF | 12:0071cb144c7a | 98 | extern const mbedtls_pk_info_t mbedtls_rsa_info; |
JMF | 12:0071cb144c7a | 99 | #endif |
JMF | 12:0071cb144c7a | 100 | |
JMF | 12:0071cb144c7a | 101 | #if defined(MBEDTLS_ECP_C) |
JMF | 12:0071cb144c7a | 102 | extern const mbedtls_pk_info_t mbedtls_eckey_info; |
JMF | 12:0071cb144c7a | 103 | extern const mbedtls_pk_info_t mbedtls_eckeydh_info; |
JMF | 12:0071cb144c7a | 104 | #endif |
JMF | 12:0071cb144c7a | 105 | |
JMF | 12:0071cb144c7a | 106 | #if defined(MBEDTLS_ECDSA_C) |
JMF | 12:0071cb144c7a | 107 | extern const mbedtls_pk_info_t mbedtls_ecdsa_info; |
JMF | 12:0071cb144c7a | 108 | #endif |
JMF | 12:0071cb144c7a | 109 | |
JMF | 12:0071cb144c7a | 110 | #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) |
JMF | 12:0071cb144c7a | 111 | extern const mbedtls_pk_info_t mbedtls_rsa_alt_info; |
JMF | 12:0071cb144c7a | 112 | #endif |
JMF | 12:0071cb144c7a | 113 | |
JMF | 12:0071cb144c7a | 114 | #endif /* MBEDTLS_PK_WRAP_H */ |