RetroArch
ecjpake.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_ECJPAKE_H
24 #define MBEDTLS_ECJPAKE_H
25 
26 /*
27  * J-PAKE is a password-authenticated key exchange that allows deriving a
28  * strong shared secret from a (potentially low entropy) pre-shared
29  * passphrase, with forward secrecy and mutual authentication.
30  * https://en.wikipedia.org/wiki/Password_Authenticated_Key_Exchange_by_Juggling
31  *
32  * This file implements the Elliptic Curve variant of J-PAKE,
33  * as defined in Chapter 7.4 of the Thread v1.0 Specification,
34  * available to members of the Thread Group http://threadgroup.org/
35  *
36  * As the J-PAKE algorithm is inherently symmetric, so is our API.
37  * Each party needs to send its first round message, in any order, to the
38  * other party, then each sends its second round message, in any order.
39  * The payloads are serialized in a way suitable for use in TLS, but could
40  * also be use outside TLS.
41  */
42 
43 #include "ecp.h"
44 #include "md.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
53 typedef enum {
57 
69 typedef struct
70 {
87 
95 
114  mbedtls_md_type_t hash,
115  mbedtls_ecp_group_id curve,
116  const unsigned char *secret,
117  size_t len );
118 
128 
145  unsigned char *buf, size_t len, size_t *olen,
146  int (*f_rng)(void *, unsigned char *, size_t),
147  void *p_rng );
148 
162  const unsigned char *buf,
163  size_t len );
164 
180  unsigned char *buf, size_t len, size_t *olen,
181  int (*f_rng)(void *, unsigned char *, size_t),
182  void *p_rng );
183 
196  const unsigned char *buf,
197  size_t len );
198 
214  unsigned char *buf, size_t len, size_t *olen,
215  int (*f_rng)(void *, unsigned char *, size_t),
216  void *p_rng );
217 
224 
225 #if defined(MBEDTLS_SELF_TEST)
226 
231 int mbedtls_ecjpake_self_test( int verbose );
232 #endif
233 
234 #ifdef __cplusplus
235 }
236 #endif
237 
238 #endif /* ecjpake.h */
int mbedtls_ecjpake_read_round_two(mbedtls_ecjpake_context *ctx, const unsigned char *buf, size_t len)
Read and process the second round message (TLS: contents of the Client/ServerKeyExchange)
Elliptic curves over GF(p)
mbedtls_ecp_point Xm1
Definition: ecjpake.h:76
mbedtls_ecjpake_role role
Definition: ecjpake.h:73
ECP group structure.
Definition: ecp.h:138
mbedtls_mpi xm1
Definition: ecjpake.h:82
const mbedtls_md_info_t * md_info
Definition: ecjpake.h:71
Definition: ecjpake.h:69
mbedtls_ecp_group grp
Definition: ecjpake.h:72
int mbedtls_ecjpake_check(const mbedtls_ecjpake_context *ctx)
Check if a context is ready for use.
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
int mbedtls_ecjpake_read_round_one(mbedtls_ecjpake_context *ctx, const unsigned char *buf, size_t len)
Read and process the first round message (TLS: contents of the Client/ServerHello extension,...
GLenum GLsizei len
Definition: glext.h:7389
Definition: ecjpake.h:55
void mbedtls_ecjpake_free(mbedtls_ecjpake_context *ctx)
Free a context's content.
mbedtls_md_type_t
Definition: md.h:39
mbedtls_ecp_point Xm2
Definition: ecjpake.h:77
AVFormatContext * ctx
Definition: record_ffmpeg.c:247
mbedtls_ecjpake_role
Definition: ecjpake.h:53
Generic message digest wrapper.
mbedtls_ecp_point Xp
Definition: ecjpake.h:80
int mbedtls_ecjpake_derive_secret(mbedtls_ecjpake_context *ctx, unsigned char *buf, size_t len, size_t *olen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Derive the shared secret (TLS: Pre-Master Secret)
int point_format
Definition: ecjpake.h:74
int mbedtls_ecjpake_self_test(int verbose)
Checkup routine.
mbedtls_mpi s
Definition: ecjpake.h:85
Definition: md_internal.h:46
Definition: ecjpake.h:54
ECP point structure (jacobian coordinates)
Definition: ecp.h:106
MPI structure.
Definition: bignum.h:179
int mbedtls_ecjpake_setup(mbedtls_ecjpake_context *ctx, mbedtls_ecjpake_role role, mbedtls_md_type_t hash, mbedtls_ecp_group_id curve, const unsigned char *secret, size_t len)
Set up a context for use.
mbedtls_mpi xm2
Definition: ecjpake.h:83
mbedtls_ecp_point Xp1
Definition: ecjpake.h:78
int mbedtls_ecjpake_write_round_one(mbedtls_ecjpake_context *ctx, unsigned char *buf, size_t len, size_t *olen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Generate and write the first round message (TLS: contents of the Client/ServerHello extension,...
mbedtls_ecp_group_id
Definition: ecp.h:62
int mbedtls_ecjpake_write_round_two(mbedtls_ecjpake_context *ctx, unsigned char *buf, size_t len, size_t *olen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Generate and write the second round message (TLS: contents of the Client/ServerKeyExchange)
mbedtls_ecp_point Xp2
Definition: ecjpake.h:79
void mbedtls_ecjpake_init(mbedtls_ecjpake_context *ctx)
Initialize a context (just makes it ready for setup() or free()).