iPXE
cipher_algorithm Struct Reference

A cipher algorithm. More...

#include <crypto.h>

Data Fields

const char * name
 Algorithm name.
size_t ctxsize
 Context size.
size_t blocksize
 Block size.
size_t alignsize
 Alignment size.
size_t authsize
 Authentication tag size.
int confidential
 Cipher is capable of providing confidentiality.
int(* setkey )(struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen)
 Set key.
int(* setiv )(struct cipher_algorithm *cipher, void *ctx, const void *iv, size_t ivlen)
 Set initialisation vector.
void(* encrypt )(struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len)
 Encrypt data.
void(* decrypt )(struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len)
 Decrypt data.
void(* auth )(struct cipher_algorithm *cipher, void *ctx, void *auth)
 Generate authentication tag.
void * priv
 Algorithm private data.

Detailed Description

A cipher algorithm.

Definition at line 58 of file crypto.h.

Field Documentation

◆ name

const char* cipher_algorithm::name

Algorithm name.

Definition at line 60 of file crypto.h.

Referenced by peerblk_parse_header(), and tls_select_cipher().

◆ ctxsize

◆ blocksize

◆ alignsize

size_t cipher_algorithm::alignsize

Alignment size.

Every call to encrypt() or decrypt() must begin at a multiple of this offset from the start of the stream. (Equivalently: all but the last call to encrypt() or decrypt() must be for a multiple of this size.)

For ciphers supporting additional data, the main data stream and additional data stream are both considered to begin at offset zero.

Definition at line 80 of file crypto.h.

Referenced by cipher_okx(), and tls_newdata_process_header().

◆ authsize

size_t cipher_algorithm::authsize

◆ confidential

int cipher_algorithm::confidential

Cipher is capable of providing confidentiality.

Definition at line 84 of file crypto.h.

Referenced by cipher_okx().

◆ setkey

int(* cipher_algorithm::setkey) (struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen)

Set key.

Parameters
cipherCipher algorithm
ctxContext
keyKey
keylenKey length
Return values
rcReturn status code

Definition at line 93 of file crypto.h.

Referenced by cipher_setkey().

◆ setiv

int(* cipher_algorithm::setiv) (struct cipher_algorithm *cipher, void *ctx, const void *iv, size_t ivlen)

Set initialisation vector.

Parameters
cipherCipher algorithm
ctxContext
ivInitialisation vector
ivlenInitialisation vector length
Return values
rcReturn status code

Definition at line 103 of file crypto.h.

Referenced by cipher_setiv().

◆ encrypt

void(* cipher_algorithm::encrypt) (struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len)

Encrypt data.

Parameters
cipherCipher algorithm
ctxContext
srcData to encrypt
dstBuffer for encrypted data, or NULL for additional data
lenLength of data
lenis guaranteed to be a multiple of blocksize.

Definition at line 115 of file crypto.h.

Referenced by cipher_encrypt().

◆ decrypt

void(* cipher_algorithm::decrypt) (struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len)

Decrypt data.

Parameters
cipherCipher algorithm
ctxContext
srcData to decrypt
dstBuffer for decrypted data, or NULL for additional data
lenLength of data
lenis guaranteed to be a multiple of blocksize.

Definition at line 127 of file crypto.h.

Referenced by cipher_decrypt().

◆ auth

void(* cipher_algorithm::auth) (struct cipher_algorithm *cipher, void *ctx, void *auth)

Generate authentication tag.

Parameters
cipherCipher algorithm
ctxContext
authAuthentication tag

Definition at line 135 of file crypto.h.

Referenced by cipher_auth(), cipher_decrypt_okx(), cipher_encrypt_okx(), and cms_decrypt().

◆ priv

void* cipher_algorithm::priv

Algorithm private data.

Definition at line 138 of file crypto.h.

Referenced by cbc_decrypt(), cbc_encrypt(), cbc_setkey(), ecb_decrypt(), ecb_encrypt(), ecb_setkey(), gcm_auth(), gcm_process(), and gcm_setkey().


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