1/*
2 * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include "include/crypto/chacha.h"
11#include "prov/ciphercommon.h"
12
13typedef struct {
14 PROV_CIPHER_CTX base; /* must be first */
15 union {
16 OSSL_UNION_ALIGN;
17 unsigned int d[CHACHA_KEY_SIZE / 4];
18 } key;
19 unsigned int counter[CHACHA_CTR_SIZE / 4];
20 unsigned char buf[CHACHA_BLK_SIZE];
21 unsigned int partial_len;
22} PROV_CHACHA20_CTX;
23
24typedef struct prov_cipher_hw_chacha20_st {
25 PROV_CIPHER_HW base; /* must be first */
26 int (*initiv)(PROV_CIPHER_CTX *ctx);
27
28} PROV_CIPHER_HW_CHACHA20;
29
30const PROV_CIPHER_HW *PROV_CIPHER_HW_chacha20(size_t keybits);
31
32OSSL_OP_cipher_encrypt_init_fn chacha20_einit;
33OSSL_OP_cipher_decrypt_init_fn chacha20_dinit;
34void chacha20_initctx(PROV_CHACHA20_CTX *ctx);
35