ReactOS  0.4.15-dev-3428-g0609db5
ecp_internal.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright The Mbed TLS Contributors
9  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
10  *
11  * This file is provided under the Apache License 2.0, or the
12  * GNU General Public License v2.0 or later.
13  *
14  * **********
15  * Apache License 2.0:
16  *
17  * Licensed under the Apache License, Version 2.0 (the "License"); you may
18  * not use this file except in compliance with the License.
19  * You may obtain a copy of the License at
20  *
21  * http://www.apache.org/licenses/LICENSE-2.0
22  *
23  * Unless required by applicable law or agreed to in writing, software
24  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
25  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26  * See the License for the specific language governing permissions and
27  * limitations under the License.
28  *
29  * **********
30  *
31  * **********
32  * GNU General Public License v2.0 or later:
33  *
34  * This program is free software; you can redistribute it and/or modify
35  * it under the terms of the GNU General Public License as published by
36  * the Free Software Foundation; either version 2 of the License, or
37  * (at your option) any later version.
38  *
39  * This program is distributed in the hope that it will be useful,
40  * but WITHOUT ANY WARRANTY; without even the implied warranty of
41  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42  * GNU General Public License for more details.
43  *
44  * You should have received a copy of the GNU General Public License along
45  * with this program; if not, write to the Free Software Foundation, Inc.,
46  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
47  *
48  * **********
49  */
50 
51 /*
52  * References:
53  *
54  * [1] BERNSTEIN, Daniel J. Curve25519: new Diffie-Hellman speed records.
55  * <http://cr.yp.to/ecdh/curve25519-20060209.pdf>
56  *
57  * [2] CORON, Jean-S'ebastien. Resistance against differential power analysis
58  * for elliptic curve cryptosystems. In : Cryptographic Hardware and
59  * Embedded Systems. Springer Berlin Heidelberg, 1999. p. 292-302.
60  * <http://link.springer.com/chapter/10.1007/3-540-48059-5_25>
61  *
62  * [3] HEDABOU, Mustapha, PINEL, Pierre, et B'EN'ETEAU, Lucien. A comb method to
63  * render ECC resistant against Side Channel Attacks. IACR Cryptology
64  * ePrint Archive, 2004, vol. 2004, p. 342.
65  * <http://eprint.iacr.org/2004/342.pdf>
66  *
67  * [4] Certicom Research. SEC 2: Recommended Elliptic Curve Domain Parameters.
68  * <http://www.secg.org/sec2-v2.pdf>
69  *
70  * [5] HANKERSON, Darrel, MENEZES, Alfred J., VANSTONE, Scott. Guide to Elliptic
71  * Curve Cryptography.
72  *
73  * [6] Digital Signature Standard (DSS), FIPS 186-4.
74  * <http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf>
75  *
76  * [7] Elliptic Curve Cryptography (ECC) Cipher Suites for Transport Layer
77  * Security (TLS), RFC 4492.
78  * <https://tools.ietf.org/search/rfc4492>
79  *
80  * [8] <http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian.html>
81  *
82  * [9] COHEN, Henri. A Course in Computational Algebraic Number Theory.
83  * Springer Science & Business Media, 1 Aug 2000
84  */
85 
86 #ifndef MBEDTLS_ECP_INTERNAL_H
87 #define MBEDTLS_ECP_INTERNAL_H
88 
89 #if !defined(MBEDTLS_CONFIG_FILE)
90 #include "config.h"
91 #else
92 #include MBEDTLS_CONFIG_FILE
93 #endif
94 
95 #if defined(MBEDTLS_ECP_INTERNAL_ALT)
96 
106 unsigned char mbedtls_internal_ecp_grp_capable( const mbedtls_ecp_group *grp );
107 
123 int mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp );
124 
131 void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp );
132 
133 #if defined(ECP_SHORTWEIERSTRASS)
134 
135 #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT)
136 
151 int mbedtls_internal_ecp_randomize_jac( const mbedtls_ecp_group *grp,
152  mbedtls_ecp_point *pt, int (*f_rng)(void *, unsigned char *, size_t),
153  void *p_rng );
154 #endif
155 
156 #if defined(MBEDTLS_ECP_ADD_MIXED_ALT)
157 
196 int mbedtls_internal_ecp_add_mixed( const mbedtls_ecp_group *grp,
198  const mbedtls_ecp_point *Q );
199 #endif
200 
220 #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT)
221 int mbedtls_internal_ecp_double_jac( const mbedtls_ecp_group *grp,
223 #endif
224 
250 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT)
251 int mbedtls_internal_ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
252  mbedtls_ecp_point *T[], size_t t_len );
253 #endif
254 
268 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT)
269 int mbedtls_internal_ecp_normalize_jac( const mbedtls_ecp_group *grp,
271 #endif
272 
273 #endif /* ECP_SHORTWEIERSTRASS */
274 
275 #if defined(ECP_MONTGOMERY)
276 
277 #if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT)
278 int mbedtls_internal_ecp_double_add_mxz( const mbedtls_ecp_group *grp,
280  const mbedtls_ecp_point *Q, const mbedtls_mpi *d );
281 #endif
282 
298 #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT)
299 int mbedtls_internal_ecp_randomize_mxz( const mbedtls_ecp_group *grp,
300  mbedtls_ecp_point *P, int (*f_rng)(void *, unsigned char *, size_t),
301  void *p_rng );
302 #endif
303 
314 #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT)
315 int mbedtls_internal_ecp_normalize_mxz( const mbedtls_ecp_group *grp,
316  mbedtls_ecp_point *P );
317 #endif
318 
319 #endif /* ECP_MONTGOMERY */
320 
321 #endif /* MBEDTLS_ECP_INTERNAL_ALT */
322 
323 #endif /* ecp_internal.h */
324 
#define R(b, x)
Definition: sha2.c:134
#define pt(x, y)
Definition: drawing.c:79
Definition: movable.cpp:7
#define T
Definition: mbstring.h:31
The ECP group structure.
Definition: ecp.h:232
#define P(row, col)
MPI structure.
Definition: bignum.h:210
The ECP point structure, in Jacobian coordinates.
Definition: ecp.h:149
#define d
Definition: ke_i.h:81