|
iPXE
|
Cipher-block chaining. More...
#include <ipxe/crypto.h>Go to the source code of this file.
Macros | |
| #define | cbc_context_t(blocksize, ctxsize) |
| A cipher-block chaining mode context. | |
| #define | CBC_CIPHER(_cbc_name, _cbc_cipher, _raw_cipher, _raw_context, _blocksize) |
| Create a cipher-block chaining mode of behaviour of an existing cipher. | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| int | cbc_setkey (struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen) |
| Set key. | |
| int | cbc_setiv (struct cipher_algorithm *cipher, void *ctx, const void *iv, size_t ivlen) |
| Set initialisation vector. | |
| void | cbc_encrypt (struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len) |
| Encrypt data. | |
| void | cbc_decrypt (struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len) |
| Decrypt data. | |
Cipher-block chaining.
Definition in file cbc.h.
| #define cbc_context_t | ( | blocksize, | |
| ctxsize ) |
A cipher-block chaining mode context.
Definition at line 16 of file cbc.h.
Referenced by cbc_decrypt(), cbc_encrypt(), cbc_setiv(), and cbc_setkey().
| #define CBC_CIPHER | ( | _cbc_name, | |
| _cbc_cipher, | |||
| _raw_cipher, | |||
| _raw_context, | |||
| _blocksize ) |
Create a cipher-block chaining mode of behaviour of an existing cipher.
| _cbc_name | Name for the new CBC cipher |
| _cbc_cipher | New cipher algorithm |
| _raw_cipher | Underlying cipher algorithm |
| _raw_context | Context structure for the underlying cipher |
| _blocksize | Cipher block size |
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
extern |
Set key.
| rc | Return status code |
Definition at line 48 of file cbc.c.
References cipher_algorithm::blocksize, cbc_context_t, cipher_setkey(), ctx, cipher_algorithm::ctxsize, key, and cipher_algorithm::priv.
|
extern |
Set initialisation vector.
| cipher | Cipher algorithm |
| ctx | Context |
| iv | Initialisation vector |
| ivlen | Initialisation vector length |
| rc | Return status code |
Definition at line 67 of file cbc.c.
References cipher_algorithm::blocksize, cbc_context_t, ctx, cipher_algorithm::ctxsize, ENOTSUP, iv, and memcpy().
|
extern |
Encrypt data.
| cipher | Cipher algorithm |
| ctx | Context |
| src | Data to encrypt |
| dst | Buffer for encrypted data |
| len | Length of data |
Definition at line 111 of file cbc.c.
References assert, cipher_algorithm::blocksize, cbc_context_t, cbc_xor(), cipher_encrypt, ctx, cipher_algorithm::ctxsize, len, memcpy(), cipher_algorithm::priv, and src.
|
extern |
Decrypt data.
| cipher | Cipher algorithm |
| ctx | Context |
| src | Data to decrypt |
| dst | Buffer for decrypted data |
| len | Length of data |
Definition at line 140 of file cbc.c.
References assert, cipher_algorithm::blocksize, cbc_context_t, cbc_xor(), cipher_decrypt, ctx, cipher_algorithm::ctxsize, len, memcpy(), cipher_algorithm::priv, and src.