| Jerry Yu | bdc7188 | 2021-09-14 19:30:36 +0800 | [diff] [blame] | 1 | /** | 
|  | 2 | * \file ecdh_misc.h | 
|  | 3 | * | 
|  | 4 | * \brief Internal functions shared by the ECDH module | 
|  | 5 | */ | 
|  | 6 | /* | 
|  | 7 | *  Copyright The Mbed TLS Contributors | 
|  | 8 | *  SPDX-License-Identifier: Apache-2.0 | 
|  | 9 | * | 
|  | 10 | *  Licensed under the Apache License, Version 2.0 ( the "License" ); you may | 
|  | 11 | *  not use this file except in compliance with the License. | 
|  | 12 | *  You may obtain a copy of the License at | 
|  | 13 | * | 
|  | 14 | *  http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 15 | * | 
|  | 16 | *  Unless required by applicable law or agreed to in writing, software | 
|  | 17 | *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | 
|  | 18 | *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 19 | *  See the License for the specific language governing permissions and | 
|  | 20 | *  limitations under the License. | 
|  | 21 | */ | 
|  | 22 | #if !defined(MBEDTLS_ECDH_MISC_H) | 
|  | 23 | #define MBEDTLS_ECDH_MISC_H | 
|  | 24 |  | 
| Jerry Yu | dd1fb9e | 2021-09-15 11:10:15 +0800 | [diff] [blame] | 25 | #include "mbedtls/ecdh.h" | 
|  | 26 | #include "mbedtls/ecp.h" | 
|  | 27 |  | 
| Jerry Yu | bdc7188 | 2021-09-14 19:30:36 +0800 | [diff] [blame] | 28 | #if defined(MBEDTLS_ECDH_C) | 
|  | 29 |  | 
|  | 30 | #if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) | 
|  | 31 |  | 
|  | 32 | /* | 
| Jerry Yu | 388bd0d | 2021-09-15 18:41:02 +0800 | [diff] [blame] | 33 | * Setup context without Everest | 
| Jerry Yu | dd1fb9e | 2021-09-15 11:10:15 +0800 | [diff] [blame] | 34 | */ | 
|  | 35 | int mbedtls_ecdh_setup_no_everest( mbedtls_ecdh_context *ctx, | 
|  | 36 | mbedtls_ecp_group_id grp_id ); | 
|  | 37 |  | 
|  | 38 | /* | 
| Jerry Yu | b85277e | 2021-10-13 13:36:05 +0800 | [diff] [blame] | 39 | * TLS 1.3 version of mbedtls_ecdh_make_params | 
| Jerry Yu | bdc7188 | 2021-09-14 19:30:36 +0800 | [diff] [blame] | 40 | */ | 
|  | 41 | int mbedtls_ecdh_tls13_make_params( mbedtls_ecdh_context *ctx, size_t *olen, | 
| Jerry Yu | b85277e | 2021-10-13 13:36:05 +0800 | [diff] [blame] | 42 | unsigned char *buf, size_t buf_len, | 
| Jerry Yu | bdc7188 | 2021-09-14 19:30:36 +0800 | [diff] [blame] | 43 | int ( *f_rng )( void *, unsigned char *, size_t ), | 
|  | 44 | void *p_rng ); | 
|  | 45 |  | 
| Jerry Yu | 1efa815 | 2021-09-09 15:42:32 +0800 | [diff] [blame] | 46 | /* | 
| Jerry Yu | b85277e | 2021-10-13 13:36:05 +0800 | [diff] [blame] | 47 | * TLS 1.3 version of mbedtls_ecdh_read_public | 
| Jerry Yu | 1efa815 | 2021-09-09 15:42:32 +0800 | [diff] [blame] | 48 | */ | 
| Jerry Yu | c068b66 | 2021-10-11 22:30:19 +0800 | [diff] [blame] | 49 | int mbedtls_ecdh_tls13_read_public( mbedtls_ecdh_context *ctx, | 
|  | 50 | const unsigned char *buf, | 
| Jerry Yu | b85277e | 2021-10-13 13:36:05 +0800 | [diff] [blame] | 51 | size_t buf_len ); | 
| Jerry Yu | dd1fb9e | 2021-09-15 11:10:15 +0800 | [diff] [blame] | 52 |  | 
| Jerry Yu | bdc7188 | 2021-09-14 19:30:36 +0800 | [diff] [blame] | 53 | #endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */ | 
|  | 54 |  | 
|  | 55 | #endif /* MBEDTLS_ECDH_C */ | 
|  | 56 |  | 
|  | 57 | #endif /* !MBEDTLS_ECDH_MISC_H */ |