#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
|
| BFCODEC_API C_BLOWFISH * | bfcodec_init (void) |
| | Allocate and initialise a Blowfish codec with pi-derived P and S boxes.
|
| |
| BFCODEC_API void | bfcodec_expand_key (C_BLOWFISH *blf, const uint8_t *key, size_t key_len) |
| | Expand key into the codec state (XOR P with key bytes, then expand via encrypt).
|
| |
| BFCODEC_API void | bfcodec_decrypt (C_BLOWFISH *blf, uint8_t *data, size_t len, const uint8_t iv[8]) |
| | Decrypt data in place using CBC with the given 8-byte IV.
|
| |
| BFCODEC_API void | bfcodec_encrypt (C_BLOWFISH *blf, uint8_t *data, size_t len, const uint8_t iv[8]) |
| | Encrypt data in place using CBC with the given 8-byte IV.
|
| |
◆ bfcodec_decrypt()
| BFCODEC_API void bfcodec_decrypt |
( |
C_BLOWFISH * |
blf, |
|
|
uint8_t * |
data, |
|
|
size_t |
len, |
|
|
const uint8_t |
iv[8] |
|
) |
| |
Decrypt data in place using CBC with the given 8-byte IV.
- Parameters
-
| blf | Codec instance with key already expanded. |
| data | Buffer to decrypt in place. |
| len | Length of data in bytes; must be a multiple of 8. |
| iv | Initialisation vector; exactly 8 bytes. |
◆ bfcodec_encrypt()
| BFCODEC_API void bfcodec_encrypt |
( |
C_BLOWFISH * |
blf, |
|
|
uint8_t * |
data, |
|
|
size_t |
len, |
|
|
const uint8_t |
iv[8] |
|
) |
| |
Encrypt data in place using CBC with the given 8-byte IV.
- Parameters
-
| blf | Codec instance with key already expanded. |
| data | Buffer to encrypt in place. |
| len | Length of data in bytes; must be a multiple of 8. |
| iv | Initialisation vector; exactly 8 bytes. |
◆ bfcodec_expand_key()
| BFCODEC_API void bfcodec_expand_key |
( |
C_BLOWFISH * |
blf, |
|
|
const uint8_t * |
key, |
|
|
size_t |
key_len |
|
) |
| |
Expand key into the codec state (XOR P with key bytes, then expand via encrypt).
- Parameters
-
| blf | Codec instance from bfcodec_init(). |
| key | Key bytes; key_len may be any positive length. |
| key_len | Length of key in bytes; key bytes are used big-endian in 32-bit chunks. |
◆ bfcodec_init()
Allocate and initialise a Blowfish codec with pi-derived P and S boxes.
- Returns
- A new codec instance, or NULL on allocation failure.