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 120 of file crypto.h.

Field Documentation

◆ name

const char* pubkey_algorithm::name

Algorithm name.

Definition at line 122 of file crypto.h.

Referenced by tls_select_cipher(), tls_send_certificate_verify(), and tls_verify_dh_params().

◆ 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 132 of file crypto.h.

◆ 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 138 of file crypto.h.

◆ 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 147 of file crypto.h.

◆ 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 157 of file crypto.h.

◆ 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 167 of file crypto.h.

◆ 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 178 of file crypto.h.

◆ final

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

Finalise algorithm.

Parameters
ctxContext

Definition at line 185 of file crypto.h.

◆ 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 194 of file crypto.h.


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