TianoCore EDK2 master
Loading...
Searching...
No Matches
EcSm2Null.c File Reference
#include <Library/DebugLib.h>
#include <mbedtls/ecp.h>
#include <mbedtls/ecdh.h>
#include <mbedtls/ecdsa.h>
#include <mbedtls/bignum.h>
#include <bignum_core.h>

Go to the source code of this file.

Functions

const mbedtls_ecp_curve_info * mbedtls_ecp_curve_info_from_grp_id (mbedtls_ecp_group_id grp_id)
 
void mbedtls_ecdh_init (mbedtls_ecdh_context *ctx)
 
void mbedtls_ecdh_free (mbedtls_ecdh_context *ctx)
 
int mbedtls_ecdh_calc_secret (mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 
void mbedtls_ecp_keypair_init (mbedtls_ecp_keypair *key)
 
void mbedtls_ecp_keypair_free (mbedtls_ecp_keypair *key)
 
int mbedtls_ecp_check_pub_priv (const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 
int mbedtls_ecdsa_write_signature (mbedtls_ecdsa_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hlen, unsigned char *sig, size_t sig_size, size_t *slen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 
int mbedtls_ecdsa_write_signature_restartable (mbedtls_ecdsa_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hlen, unsigned char *sig, size_t sig_size, size_t *slen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, mbedtls_ecdsa_restart_ctx *rs_ctx)
 
int mbedtls_ecdsa_read_signature (mbedtls_ecdsa_context *ctx, const unsigned char *hash, size_t hlen, const unsigned char *sig, size_t slen)
 
int mbedtls_ecdsa_read_signature_restartable (mbedtls_ecdsa_context *ctx, const unsigned char *hash, size_t hlen, const unsigned char *sig, size_t slen, mbedtls_ecdsa_restart_ctx *rs_ctx)
 
int mbedtls_ecdsa_from_keypair (mbedtls_ecdsa_context *ctx, const mbedtls_ecp_keypair *key)
 
void mbedtls_ecdsa_init (mbedtls_ecdsa_context *ctx)
 
void mbedtls_ecdsa_free (mbedtls_ecdsa_context *ctx)
 
void mbedtls_ecdsa_restart_init (mbedtls_ecdsa_restart_ctx *ctx)
 
void mbedtls_ecdsa_restart_free (mbedtls_ecdsa_restart_ctx *ctx)
 
int mbedtls_ecp_point_write_binary (const mbedtls_ecp_group *grp, const mbedtls_ecp_point *P, int format, size_t *olen, unsigned char *buf, size_t buflen)
 
int mbedtls_ecp_point_read_binary (const mbedtls_ecp_group *grp, mbedtls_ecp_point *P, const unsigned char *buf, size_t ilen)
 
int mbedtls_ecp_write_key (mbedtls_ecp_keypair *key, unsigned char *buf, size_t buflen)
 
int mbedtls_ecp_group_load (mbedtls_ecp_group *grp, mbedtls_ecp_group_id id)
 
int mbedtls_ecp_mul (mbedtls_ecp_group *grp, mbedtls_ecp_point *R, const mbedtls_mpi *m, const mbedtls_ecp_point *P, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 
int mbedtls_ecp_check_pubkey (const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt)
 
int mbedtls_ecp_check_privkey (const mbedtls_ecp_group *grp, const mbedtls_mpi *d)
 
int mbedtls_ecp_restart_is_enabled (void)
 
const mbedtls_ecp_curve_info * mbedtls_ecp_curve_info_from_tls_id (uint16_t tls_id)
 
int mbedtls_ecdh_setup (mbedtls_ecdh_context *ctx, mbedtls_ecp_group_id grp_id)
 
int mbedtls_ecdh_make_params (mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 
int mbedtls_ecdh_get_params (mbedtls_ecdh_context *ctx, const mbedtls_ecp_keypair *key, mbedtls_ecdh_side side)
 
int mbedtls_ecdh_read_public (mbedtls_ecdh_context *ctx, const unsigned char *buf, size_t blen)
 
int mbedtls_ecdh_read_params (mbedtls_ecdh_context *ctx, const unsigned char **buf, const unsigned char *end)
 
int mbedtls_ecdh_make_public (mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 
void mbedtls_ecdh_enable_restart (mbedtls_ecdh_context *ctx)
 
void mbedtls_ecp_point_init (mbedtls_ecp_point *pt)
 
void mbedtls_ecp_group_init (mbedtls_ecp_group *grp)
 
void mbedtls_ecp_point_free (mbedtls_ecp_point *pt)
 
void mbedtls_ecp_group_free (mbedtls_ecp_group *grp)
 
int mbedtls_ecp_is_zero (mbedtls_ecp_point *pt)
 
int mbedtls_ecp_point_cmp (const mbedtls_ecp_point *P, const mbedtls_ecp_point *Q)
 
int mbedtls_ecp_muladd (mbedtls_ecp_group *grp, mbedtls_ecp_point *R, const mbedtls_mpi *m, const mbedtls_ecp_point *P, const mbedtls_mpi *n, const mbedtls_ecp_point *Q)
 
int mbedtls_ecdh_gen_public (mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 
int mbedtls_ecdh_compute_shared (mbedtls_ecp_group *grp, mbedtls_mpi *z, const mbedtls_ecp_point *Q, const mbedtls_mpi *d, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 
int mbedtls_ecdsa_verify (mbedtls_ecp_group *grp, const unsigned char *buf, size_t blen, const mbedtls_ecp_point *Q, const mbedtls_mpi *r, const mbedtls_mpi *s)
 
int mbedtls_ecdsa_sign (mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, const mbedtls_mpi *d, const unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 

Detailed Description

Null implementation of EC and SM2 functions called by BaseCryptLib.

Copyright (c) 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file EcSm2Null.c.

Function Documentation

◆ mbedtls_ecdh_calc_secret()

int mbedtls_ecdh_calc_secret ( mbedtls_ecdh_context *  ctx,
size_t *  olen,
unsigned char *  buf,
size_t  blen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 49 of file EcSm2Null.c.

◆ mbedtls_ecdh_compute_shared()

int mbedtls_ecdh_compute_shared ( mbedtls_ecp_group *  grp,
mbedtls_mpi *  z,
const mbedtls_ecp_point *  Q,
const mbedtls_mpi *  d,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 451 of file EcSm2Null.c.

◆ mbedtls_ecdh_enable_restart()

void mbedtls_ecdh_enable_restart ( mbedtls_ecdh_context *  ctx)

Definition at line 365 of file EcSm2Null.c.

◆ mbedtls_ecdh_free()

void mbedtls_ecdh_free ( mbedtls_ecdh_context *  ctx)

Definition at line 41 of file EcSm2Null.c.

◆ mbedtls_ecdh_gen_public()

int mbedtls_ecdh_gen_public ( mbedtls_ecp_group *  grp,
mbedtls_mpi *  d,
mbedtls_ecp_point *  Q,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 438 of file EcSm2Null.c.

◆ mbedtls_ecdh_get_params()

int mbedtls_ecdh_get_params ( mbedtls_ecdh_context *  ctx,
const mbedtls_ecp_keypair *  key,
mbedtls_ecdh_side  side 
)

Definition at line 318 of file EcSm2Null.c.

◆ mbedtls_ecdh_init()

void mbedtls_ecdh_init ( mbedtls_ecdh_context *  ctx)

Definition at line 30 of file EcSm2Null.c.

◆ mbedtls_ecdh_make_params()

int mbedtls_ecdh_make_params ( mbedtls_ecdh_context *  ctx,
size_t *  olen,
unsigned char *  buf,
size_t  blen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 304 of file EcSm2Null.c.

◆ mbedtls_ecdh_make_public()

int mbedtls_ecdh_make_public ( mbedtls_ecdh_context *  ctx,
size_t *  olen,
unsigned char *  buf,
size_t  blen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 351 of file EcSm2Null.c.

◆ mbedtls_ecdh_read_params()

int mbedtls_ecdh_read_params ( mbedtls_ecdh_context *  ctx,
const unsigned char **  buf,
const unsigned char *  end 
)

Definition at line 340 of file EcSm2Null.c.

◆ mbedtls_ecdh_read_public()

int mbedtls_ecdh_read_public ( mbedtls_ecdh_context *  ctx,
const unsigned char *  buf,
size_t  blen 
)

Definition at line 329 of file EcSm2Null.c.

◆ mbedtls_ecdh_setup()

int mbedtls_ecdh_setup ( mbedtls_ecdh_context *  ctx,
mbedtls_ecp_group_id  grp_id 
)

Definition at line 294 of file EcSm2Null.c.

◆ mbedtls_ecdsa_free()

void mbedtls_ecdsa_free ( mbedtls_ecdsa_context *  ctx)

Definition at line 171 of file EcSm2Null.c.

◆ mbedtls_ecdsa_from_keypair()

int mbedtls_ecdsa_from_keypair ( mbedtls_ecdsa_context *  ctx,
const mbedtls_ecp_keypair *  key 
)

Definition at line 153 of file EcSm2Null.c.

◆ mbedtls_ecdsa_init()

void mbedtls_ecdsa_init ( mbedtls_ecdsa_context *  ctx)

Definition at line 163 of file EcSm2Null.c.

◆ mbedtls_ecdsa_read_signature()

int mbedtls_ecdsa_read_signature ( mbedtls_ecdsa_context *  ctx,
const unsigned char *  hash,
size_t  hlen,
const unsigned char *  sig,
size_t  slen 
)

Definition at line 126 of file EcSm2Null.c.

◆ mbedtls_ecdsa_read_signature_restartable()

int mbedtls_ecdsa_read_signature_restartable ( mbedtls_ecdsa_context *  ctx,
const unsigned char *  hash,
size_t  hlen,
const unsigned char *  sig,
size_t  slen,
mbedtls_ecdsa_restart_ctx *  rs_ctx 
)

Definition at line 139 of file EcSm2Null.c.

◆ mbedtls_ecdsa_restart_free()

void mbedtls_ecdsa_restart_free ( mbedtls_ecdsa_restart_ctx *  ctx)

Definition at line 187 of file EcSm2Null.c.

◆ mbedtls_ecdsa_restart_init()

void mbedtls_ecdsa_restart_init ( mbedtls_ecdsa_restart_ctx *  ctx)

Definition at line 179 of file EcSm2Null.c.

◆ mbedtls_ecdsa_sign()

int mbedtls_ecdsa_sign ( mbedtls_ecp_group *  grp,
mbedtls_mpi *  r,
mbedtls_mpi *  s,
const mbedtls_mpi *  d,
const unsigned char *  buf,
size_t  blen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 482 of file EcSm2Null.c.

◆ mbedtls_ecdsa_verify()

int mbedtls_ecdsa_verify ( mbedtls_ecp_group *  grp,
const unsigned char *  buf,
size_t  blen,
const mbedtls_ecp_point *  Q,
const mbedtls_mpi *  r,
const mbedtls_mpi *  s 
)

Definition at line 465 of file EcSm2Null.c.

◆ mbedtls_ecdsa_write_signature()

int mbedtls_ecdsa_write_signature ( mbedtls_ecdsa_context *  ctx,
mbedtls_md_type_t  md_alg,
const unsigned char *  hash,
size_t  hlen,
unsigned char *  sig,
size_t  sig_size,
size_t *  slen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 91 of file EcSm2Null.c.

◆ mbedtls_ecdsa_write_signature_restartable()

int mbedtls_ecdsa_write_signature_restartable ( mbedtls_ecdsa_context *  ctx,
mbedtls_md_type_t  md_alg,
const unsigned char *  hash,
size_t  hlen,
unsigned char *  sig,
size_t  sig_size,
size_t *  slen,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng,
mbedtls_ecdsa_restart_ctx *  rs_ctx 
)

Definition at line 108 of file EcSm2Null.c.

◆ mbedtls_ecp_check_privkey()

int mbedtls_ecp_check_privkey ( const mbedtls_ecp_group *  grp,
const mbedtls_mpi *  d 
)

Definition at line 266 of file EcSm2Null.c.

◆ mbedtls_ecp_check_pub_priv()

int mbedtls_ecp_check_pub_priv ( const mbedtls_ecp_keypair *  pub,
const mbedtls_ecp_keypair *  prv,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 79 of file EcSm2Null.c.

◆ mbedtls_ecp_check_pubkey()

int mbedtls_ecp_check_pubkey ( const mbedtls_ecp_group *  grp,
const mbedtls_ecp_point *  pt 
)

Definition at line 256 of file EcSm2Null.c.

◆ mbedtls_ecp_curve_info_from_grp_id()

const mbedtls_ecp_curve_info * mbedtls_ecp_curve_info_from_grp_id ( mbedtls_ecp_group_id  grp_id)

Definition at line 21 of file EcSm2Null.c.

◆ mbedtls_ecp_curve_info_from_tls_id()

const mbedtls_ecp_curve_info * mbedtls_ecp_curve_info_from_tls_id ( uint16_t  tls_id)

Definition at line 285 of file EcSm2Null.c.

◆ mbedtls_ecp_group_free()

void mbedtls_ecp_group_free ( mbedtls_ecp_group *  grp)

Definition at line 397 of file EcSm2Null.c.

◆ mbedtls_ecp_group_init()

void mbedtls_ecp_group_init ( mbedtls_ecp_group *  grp)

Definition at line 381 of file EcSm2Null.c.

◆ mbedtls_ecp_group_load()

int mbedtls_ecp_group_load ( mbedtls_ecp_group *  grp,
mbedtls_ecp_group_id  id 
)

Definition at line 232 of file EcSm2Null.c.

◆ mbedtls_ecp_is_zero()

int mbedtls_ecp_is_zero ( mbedtls_ecp_point *  pt)

Definition at line 405 of file EcSm2Null.c.

◆ mbedtls_ecp_keypair_free()

void mbedtls_ecp_keypair_free ( mbedtls_ecp_keypair *  key)

Definition at line 71 of file EcSm2Null.c.

◆ mbedtls_ecp_keypair_init()

void mbedtls_ecp_keypair_init ( mbedtls_ecp_keypair *  key)

Definition at line 63 of file EcSm2Null.c.

◆ mbedtls_ecp_mul()

int mbedtls_ecp_mul ( mbedtls_ecp_group *  grp,
mbedtls_ecp_point *  R,
const mbedtls_mpi *  m,
const mbedtls_ecp_point *  P,
int(*)(void *, unsigned char *, size_t)  f_rng,
void *  p_rng 
)

Definition at line 242 of file EcSm2Null.c.

◆ mbedtls_ecp_muladd()

int mbedtls_ecp_muladd ( mbedtls_ecp_group *  grp,
mbedtls_ecp_point *  R,
const mbedtls_mpi *  m,
const mbedtls_ecp_point *  P,
const mbedtls_mpi *  n,
const mbedtls_ecp_point *  Q 
)

Definition at line 424 of file EcSm2Null.c.

◆ mbedtls_ecp_point_cmp()

int mbedtls_ecp_point_cmp ( const mbedtls_ecp_point *  P,
const mbedtls_ecp_point *  Q 
)

Definition at line 414 of file EcSm2Null.c.

◆ mbedtls_ecp_point_free()

void mbedtls_ecp_point_free ( mbedtls_ecp_point *  pt)

Definition at line 389 of file EcSm2Null.c.

◆ mbedtls_ecp_point_init()

void mbedtls_ecp_point_init ( mbedtls_ecp_point *  pt)

Definition at line 373 of file EcSm2Null.c.

◆ mbedtls_ecp_point_read_binary()

int mbedtls_ecp_point_read_binary ( const mbedtls_ecp_group *  grp,
mbedtls_ecp_point *  P,
const unsigned char *  buf,
size_t  ilen 
)

Definition at line 209 of file EcSm2Null.c.

◆ mbedtls_ecp_point_write_binary()

int mbedtls_ecp_point_write_binary ( const mbedtls_ecp_group *  grp,
const mbedtls_ecp_point *  P,
int  format,
size_t *  olen,
unsigned char *  buf,
size_t  buflen 
)

Definition at line 195 of file EcSm2Null.c.

◆ mbedtls_ecp_restart_is_enabled()

int mbedtls_ecp_restart_is_enabled ( void  )

Definition at line 276 of file EcSm2Null.c.

◆ mbedtls_ecp_write_key()

int mbedtls_ecp_write_key ( mbedtls_ecp_keypair *  key,
unsigned char *  buf,
size_t  buflen 
)

Definition at line 221 of file EcSm2Null.c.