iPXE
Data Fields
pubkey_algorithm Struct Reference

A public key algorithm. More...

#include <crypto.h>

Data Fields

const char * name
 Algorithm name. More...
 
size_t ctxsize
 Context size. More...
 
int(* init )(void *ctx, const void *key, size_t key_len)
 Initialise algorithm. More...
 
size_t(* max_len )(void *ctx)
 Calculate maximum output length. More...
 
int(* encrypt )(void *ctx, const void *data, size_t len, void *out)
 Encrypt. More...
 
int(* decrypt )(void *ctx, const void *data, size_t len, void *out)
 Decrypt. More...
 
int(* sign )(void *ctx, struct digest_algorithm *digest, const void *value, void *signature)
 Sign digest value. More...
 
int(* verify )(void *ctx, struct digest_algorithm *digest, const void *value, const void *signature, size_t signature_len)
 Verify signed digest value. More...
 
void(* final )(void *ctx)
 Finalise algorithm. More...
 
int(* match )(const void *private_key, size_t private_key_len, const void *public_key, size_t public_key_len)
 Check that public key matches private key. More...
 

Detailed Description

A public key algorithm.

Definition at line 94 of file crypto.h.

Field Documentation

◆ name

const char* pubkey_algorithm::name

Algorithm name.

Definition at line 96 of file crypto.h.

Referenced by tls_select_cipher(), and tls_send_certificate_verify().

◆ ctxsize

size_t pubkey_algorithm::ctxsize

◆ init

int( * pubkey_algorithm::init) (void *ctx, const void *key, size_t key_len)

Initialise algorithm.

Parameters
ctxContext
keyKey
key_lenLength of key
Return values
rcReturn status code

Definition at line 106 of file crypto.h.

Referenced by pubkey_init().

◆ max_len

size_t( * pubkey_algorithm::max_len) (void *ctx)

Calculate maximum output length.

Parameters
ctxContext
Return values
max_lenMaximum output length

Definition at line 112 of file crypto.h.

Referenced by pubkey_max_len(), and tls_send_client_key_exchange().

◆ encrypt

int( * pubkey_algorithm::encrypt) (void *ctx, const void *data, size_t len, void *out)

Encrypt.

Parameters
ctxContext
plaintextPlaintext
plaintext_lenLength of plaintext
ciphertextCiphertext
Return values
ciphertext_lenLength of ciphertext, or negative error

Definition at line 121 of file crypto.h.

Referenced by pubkey_encrypt().

◆ decrypt

int( * pubkey_algorithm::decrypt) (void *ctx, const void *data, size_t len, void *out)

Decrypt.

Parameters
ctxContext
ciphertextCiphertext
ciphertext_lenCiphertext length
plaintextPlaintext
Return values
plaintext_lenPlaintext length, or negative error

Definition at line 131 of file crypto.h.

Referenced by pubkey_decrypt().

◆ sign

int( * pubkey_algorithm::sign) (void *ctx, struct digest_algorithm *digest, const void *value, void *signature)

Sign digest value.

Parameters
ctxContext
digestDigest algorithm
valueDigest value
signatureSignature
Return values
signature_lenSignature length, or negative error

Definition at line 141 of file crypto.h.

Referenced by pubkey_sign().

◆ verify

int( * pubkey_algorithm::verify) (void *ctx, struct digest_algorithm *digest, const void *value, const void *signature, size_t signature_len)

Verify signed digest value.

Parameters
ctxContext
digestDigest algorithm
valueDigest value
signatureSignature
signature_lenSignature length
Return values
rcReturn status code

Definition at line 152 of file crypto.h.

Referenced by pubkey_verify().

◆ final

void( * pubkey_algorithm::final) (void *ctx)

Finalise algorithm.

Parameters
ctxContext

Definition at line 159 of file crypto.h.

Referenced by pubkey_final().

◆ match

int( * pubkey_algorithm::match) (const void *private_key, size_t private_key_len, const void *public_key, size_t public_key_len)

Check that public key matches private key.

Parameters
private_keyPrivate key
private_key_lenPrivate key length
public_keyPublic key
public_key_lenPublic key length
Return values
rcReturn status code

Definition at line 168 of file crypto.h.

Referenced by pubkey_match().


The documentation for this struct was generated from the following file: