mbed TLS v2.14.1
ecjpake.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
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  * This file is part of mbed TLS (https://tls.mbed.org)
23  */
24 #ifndef MBEDTLS_ECJPAKE_H
25 #define MBEDTLS_ECJPAKE_H
26 
27 /*
28  * J-PAKE is a password-authenticated key exchange that allows deriving a
29  * strong shared secret from a (potentially low entropy) pre-shared
30  * passphrase, with forward secrecy and mutual authentication.
31  * https://en.wikipedia.org/wiki/Password_Authenticated_Key_Exchange_by_Juggling
32  *
33  * This file implements the Elliptic Curve variant of J-PAKE,
34  * as defined in Chapter 7.4 of the Thread v1.0 Specification,
35  * available to members of the Thread Group http://threadgroup.org/
36  *
37  * As the J-PAKE algorithm is inherently symmetric, so is our API.
38  * Each party needs to send its first round message, in any order, to the
39  * other party, then each sends its second round message, in any order.
40  * The payloads are serialized in a way suitable for use in TLS, but could
41  * also be use outside TLS.
42  */
43 
44 #include "ecp.h"
45 #include "md.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
54 typedef enum {
58 
59 #if !defined(MBEDTLS_ECJPAKE_ALT)
60 
72 {
89 
90 #else /* MBEDTLS_ECJPAKE_ALT */
91 #include "ecjpake_alt.h"
92 #endif /* MBEDTLS_ECJPAKE_ALT */
93 
101 
120  mbedtls_md_type_t hash,
121  mbedtls_ecp_group_id curve,
122  const unsigned char *secret,
123  size_t len );
124 
134 
151  unsigned char *buf, size_t len, size_t *olen,
152  int (*f_rng)(void *, unsigned char *, size_t),
153  void *p_rng );
154 
168  const unsigned char *buf,
169  size_t len );
170 
186  unsigned char *buf, size_t len, size_t *olen,
187  int (*f_rng)(void *, unsigned char *, size_t),
188  void *p_rng );
189 
202  const unsigned char *buf,
203  size_t len );
204 
220  unsigned char *buf, size_t len, size_t *olen,
221  int (*f_rng)(void *, unsigned char *, size_t),
222  void *p_rng );
223 
230 
231 
232 
233 #if defined(MBEDTLS_SELF_TEST)
234 
240 int mbedtls_ecjpake_self_test( int verbose );
241 
242 #endif /* MBEDTLS_SELF_TEST */
243 
244 #ifdef __cplusplus
245 }
246 #endif
247 
248 
249 #endif /* ecjpake.h */