Gilles Peskine | 80ba850 | 2021-04-03 20:36:37 +0200 | [diff] [blame] | 1 | /** |
| 2 | * \file ecp_invasive.h |
| 3 | * |
| 4 | * \brief ECP module: interfaces for invasive testing only. |
| 5 | * |
| 6 | * The interfaces in this file are intended for testing purposes only. |
| 7 | * They SHOULD NOT be made available in library integrations except when |
| 8 | * building the library for testing. |
| 9 | */ |
| 10 | /* |
| 11 | * Copyright The Mbed TLS Contributors |
| 12 | * SPDX-License-Identifier: Apache-2.0 |
| 13 | * |
| 14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 15 | * not use this file except in compliance with the License. |
| 16 | * You may obtain a copy of the License at |
| 17 | * |
| 18 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 19 | * |
| 20 | * Unless required by applicable law or agreed to in writing, software |
| 21 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 23 | * See the License for the specific language governing permissions and |
| 24 | * limitations under the License. |
| 25 | */ |
| 26 | #ifndef MBEDTLS_ECP_INVASIVE_H |
| 27 | #define MBEDTLS_ECP_INVASIVE_H |
| 28 | |
| 29 | #include "common.h" |
| 30 | #include "mbedtls/ecp.h" |
| 31 | |
| 32 | #if defined(MBEDTLS_TEST_HOOKS) && defined(MBEDTLS_ECP_C) |
| 33 | |
Gilles Peskine | 618be2e | 2021-04-03 21:47:53 +0200 | [diff] [blame] | 34 | #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \ |
| 35 | defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \ |
| 36 | defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) |
| 37 | /* Preconditions: |
| 38 | * - bits is a multiple of 64 or is 224 |
| 39 | * - c is -1 or -2 |
| 40 | * - 0 <= N < 2^bits |
Gilles Peskine | 392d101 | 2021-04-09 15:46:51 +0200 | [diff] [blame^] | 41 | * - N has room for bits plus one limb |
Gilles Peskine | 618be2e | 2021-04-03 21:47:53 +0200 | [diff] [blame] | 42 | * |
Gilles Peskine | 392d101 | 2021-04-09 15:46:51 +0200 | [diff] [blame^] | 43 | * Behavior: |
| 44 | * Set N to c * 2^bits + old_value_of_N. |
Gilles Peskine | 618be2e | 2021-04-03 21:47:53 +0200 | [diff] [blame] | 45 | */ |
| 46 | void mbedtls_ecp_fix_negative( mbedtls_mpi *N, signed char c, size_t bits ); |
| 47 | #endif |
| 48 | |
Gilles Peskine | 80ba850 | 2021-04-03 20:36:37 +0200 | [diff] [blame] | 49 | #endif /* MBEDTLS_TEST_HOOKS && MBEDTLS_ECP_C */ |
| 50 | |
| 51 | #endif /* MBEDTLS_ECP_INVASIVE_H */ |