iPXE
Functions
ecdhe.h File Reference

Elliptic Curve Ephemeral Diffie-Hellman (ECDHE) key exchange. More...

#include <ipxe/crypto.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
int ecdhe_key (struct elliptic_curve *curve, const void *partner, const void *private, void *public, void *shared)
 Calculate ECDHE key. More...
 

Detailed Description

Elliptic Curve Ephemeral Diffie-Hellman (ECDHE) key exchange.

Definition in file ecdhe.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ ecdhe_key()

int ecdhe_key ( struct elliptic_curve curve,
const void *  partner,
const void *  private,
void *  public,
void *  shared 
)

Calculate ECDHE key.

Parameters
curveElliptic curve
partnerPartner public curve point
privatePrivate key
publicPublic curve point to fill in (may overlap partner key)
sharedShared secret curve point to fill in
Return values
rcReturn status code

Definition at line 45 of file ecdhe.c.

46  {
47  int rc;
48 
49  /* Construct shared key */
50  if ( ( rc = elliptic_multiply ( curve, partner, private,
51  shared ) ) != 0 ) {
52  DBGC ( curve, "CURVE %s could not generate shared key: %s\n",
53  curve->name, strerror ( rc ) );
54  return rc;
55  }
56 
57  /* Construct public key */
58  if ( ( rc = elliptic_multiply ( curve, NULL, private,
59  public ) ) != 0 ) {
60  DBGC ( curve, "CURVE %s could not generate public key: %s\n",
61  curve->name, strerror ( rc ) );
62  return rc;
63  }
64 
65  return 0;
66 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int elliptic_multiply(struct elliptic_curve *curve, const void *base, const void *scalar, void *result)
Definition: crypto.h:310
#define DBGC(...)
Definition: compiler.h:505
const char * name
Curve name.
Definition: crypto.h:186
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
struct eth_slow_lacp_entity_tlv partner
Partner information.
Definition: eth_slow.h:16

References DBGC, elliptic_multiply(), elliptic_curve::name, NULL, partner, rc, and strerror().

Referenced by tls_send_client_key_exchange_ecdhe().