cipher: replace init args with a implementation-specific params struct
This allows for more flexibility in the future. While at it, do note that the RFC and draft implementations are followed. In particular, in XChaCha20, hardcode the high word of the counter to 0. This commit breaks ChaCha20-Poly1305. It'll be fixed in a subsequent commit. stash
This commit is contained in:
parent
b26a9c7274
commit
623dd16dc2
5 changed files with 52 additions and 111 deletions
12
lilcrypto.h
12
lilcrypto.h
|
@ -147,22 +147,18 @@ struct lc_cipher_ctx;
|
|||
struct lc_cipher_impl;
|
||||
|
||||
|
||||
int lc_cipher_encrypt_init(struct lc_cipher_ctx *, const uint8_t *, size_t,
|
||||
const uint8_t *, size_t);
|
||||
int lc_cipher_encrypt_init(struct lc_cipher_ctx *, const void *);
|
||||
int lc_cipher_encrypt_update(struct lc_cipher_ctx *, uint8_t *, size_t *,
|
||||
const uint8_t *, size_t);
|
||||
int lc_cipher_encrypt_final(struct lc_cipher_ctx *, uint8_t *, size_t *);
|
||||
int lc_cipher_encrypt(const struct lc_cipher_impl *, uint8_t *, size_t *,
|
||||
const uint8_t *, size_t, const uint8_t *, size_t, const uint8_t *,
|
||||
size_t);
|
||||
int lc_cipher_decrypt_init(struct lc_cipher_ctx *, const uint8_t *, size_t,
|
||||
const uint8_t *, size_t);
|
||||
const void *, const uint8_t *, size_t);
|
||||
int lc_cipher_decrypt_init(struct lc_cipher_ctx *, const void *);
|
||||
int lc_cipher_decrypt_update(struct lc_cipher_ctx *, uint8_t *, size_t *,
|
||||
const uint8_t *, size_t);
|
||||
int lc_cipher_decrypt_final(struct lc_cipher_ctx *, uint8_t *, size_t *);
|
||||
int lc_cipher_decrypt(const struct lc_cipher_impl *, uint8_t *, size_t *,
|
||||
const uint8_t *, size_t, const uint8_t *, size_t, const uint8_t *,
|
||||
size_t);
|
||||
const void *, const uint8_t *, size_t);
|
||||
|
||||
struct lc_cipher_ctx *lc_cipher_ctx_new(const struct lc_cipher_impl *);
|
||||
void lc_cipher_ctx_free(struct lc_cipher_ctx *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue