iPXE
Data Fields
pubkey_algorithm Struct Reference

A public key algorithm. More...

#include <crypto.h>

Data Fields

const char * name
 Algorithm name.
size_t ctxsize
 Context size.
int(* init )(void *ctx, const void *key, size_t key_len)
 Initialise algorithm.
size_t(* max_len )(void *ctx)
 Calculate maximum output length.
int(* encrypt )(void *ctx, const void *data, size_t len, void *out)
 Encrypt.
int(* decrypt )(void *ctx, const void *data, size_t len, void *out)
 Decrypt.
int(* sign )(void *ctx, struct digest_algorithm *digest, const void *value, void *signature)
 Sign digest value.
int(* verify )(void *ctx, struct digest_algorithm *digest, const void *value, const void *signature, size_t signature_len)
 Verify signed digest value.
void(* final )(void *ctx)
 Finalise algorithm.
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.

Detailed Description

A public key algorithm.

Definition at line 94 of file crypto.h.


Field Documentation

Algorithm name.

Definition at line 96 of file crypto.h.

Referenced by tls_select_cipher(), and tls_send_certificate_verify().

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().

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().

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().

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().

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().

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().

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

Finalise algorithm.

Parameters:
ctxContext

Definition at line 159 of file crypto.h.

Referenced by pubkey_final().

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: