mbedtls ported to mbed-classic

Fork of mbedtls by Christopher Haster

Embed: (wiki syntax)

« Back to documentation index

ecjpake.h File Reference

ecjpake.h File Reference

Elliptic curve J-PAKE. More...

Go to the source code of this file.

Data Structures

struct  mbedtls_ecjpake_context
 EC J-PAKE context structure. More...

Enumerations

enum  mbedtls_ecjpake_role { MBEDTLS_ECJPAKE_CLIENT = 0, MBEDTLS_ECJPAKE_SERVER }
 

Roles in the EC J-PAKE exchange.

More...

Functions

void mbedtls_ecjpake_init (mbedtls_ecjpake_context *ctx)
 Initialize a context (just makes it ready for setup() or free()).
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.
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, excluding extension type and length bytes)
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, excluding extension type and length bytes)
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)
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)
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)
void mbedtls_ecjpake_free (mbedtls_ecjpake_context *ctx)
 Free a context's content.
int mbedtls_ecjpake_self_test (int verbose)
 Checkup routine.

Detailed Description

Elliptic curve J-PAKE.

Copyright (C) 2006-2015, ARM Limited, All Rights Reserved SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This file is part of mbed TLS (https://tls.mbed.org)

Definition in file ecjpake.h.


Enumeration Type Documentation

Roles in the EC J-PAKE exchange.

Enumerator:
MBEDTLS_ECJPAKE_CLIENT 

Client.

MBEDTLS_ECJPAKE_SERVER 

Server.

Definition at line 53 of file ecjpake.h.


Function Documentation

int mbedtls_ecjpake_derive_secret ( mbedtls_ecjpake_context ctx,
unsigned char *  buf,
size_t  len,
size_t *  olen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Derive the shared secret (TLS: Pre-Master Secret)

Parameters:
ctxContext to use
bufBuffer to write the contents to
lenBuffer size
olenWill be updated with the number of bytes written
f_rngRNG function
p_rngRNG parameter
Returns:
0 if successfull, a negative error code otherwise

Definition at line 717 of file ecjpake.c.

void mbedtls_ecjpake_free ( mbedtls_ecjpake_context ctx )

Free a context's content.

Parameters:
ctxcontext to free

Definition at line 76 of file ecjpake.c.

void mbedtls_ecjpake_init ( mbedtls_ecjpake_context ctx )

Initialize a context (just makes it ready for setup() or free()).

Parameters:
ctxcontext to initialize

Definition at line 53 of file ecjpake.c.

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, excluding extension type and length bytes)

Parameters:
ctxContext to use
bufPointer to extension contents
lenExtension length
Returns:
0 if successfull, a negative error code otherwise

Definition at line 501 of file ecjpake.c.

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)

Parameters:
ctxContext to use
bufPointer to the message
lenMessage length
Returns:
0 if successfull, a negative error code otherwise

Definition at line 551 of file ecjpake.c.

int mbedtls_ecjpake_self_test ( int  verbose )

Checkup routine.

Returns:
0 if successful, or 1 if a test failed

Definition at line 968 of file ecjpake.c.

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.

Note:
Currently the only values for hash/curve allowed by the standard are MBEDTLS_MD_SHA256/MBEDTLS_ECP_DP_SECP256R1.
Parameters:
ctxcontext to set up
roleOur role: client or server
hashhash function to use (MBEDTLS_MD_XXX)
curveelliptic curve identifier (MBEDTLS_ECP_DP_XXX)
secretpre-shared secret (passphrase)
lenlength of the shared secret
Returns:
0 if successfull, a negative error code otherwise

Definition at line 98 of file ecjpake.c.

int mbedtls_ecjpake_write_round_one ( mbedtls_ecjpake_context ctx,
unsigned char *  buf,
size_t  len,
size_t *  olen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Generate and write the first round message (TLS: contents of the Client/ServerHello extension, excluding extension type and length bytes)

Parameters:
ctxContext to use
bufBuffer to write the contents to
lenBuffer size
olenWill be updated with the number of bytes written
f_rngRNG function
p_rngRNG parameter
Returns:
0 if successfull, a negative error code otherwise

Definition at line 514 of file ecjpake.c.

int mbedtls_ecjpake_write_round_two ( mbedtls_ecjpake_context ctx,
unsigned char *  buf,
size_t  len,
size_t *  olen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Generate and write the second round message (TLS: contents of the Client/ServerKeyExchange)

Parameters:
ctxContext to use
bufBuffer to write the contents to
lenBuffer size
olenWill be updated with the number of bytes written
f_rngRNG function
p_rngRNG parameter
Returns:
0 if successfull, a negative error code otherwise

Definition at line 640 of file ecjpake.c.