xref: /freebsd-src/crypto/openssl/providers/implementations/ciphers/cipher_rc4_hmac_md5.h (revision aa7957345732816fb0ba8308798d2f79f45597f9)
1b077aed3SPierre Pronchery /*
2*aa795734SPierre Pronchery  * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
3b077aed3SPierre Pronchery  *
4b077aed3SPierre Pronchery  * Licensed under the Apache License 2.0 (the "License").  You may not use
5b077aed3SPierre Pronchery  * this file except in compliance with the License.  You can obtain a copy
6b077aed3SPierre Pronchery  * in the file LICENSE in the source distribution or at
7b077aed3SPierre Pronchery  * https://www.openssl.org/source/license.html
8b077aed3SPierre Pronchery  */
9b077aed3SPierre Pronchery 
10b077aed3SPierre Pronchery #include <openssl/rc4.h>
11b077aed3SPierre Pronchery #include <openssl/md5.h>
12b077aed3SPierre Pronchery #include "prov/ciphercommon.h"
13b077aed3SPierre Pronchery 
14b077aed3SPierre Pronchery typedef struct prov_rc4_hmac_md5_ctx_st {
15b077aed3SPierre Pronchery     PROV_CIPHER_CTX base;      /* Must be first */
16b077aed3SPierre Pronchery     union {
17b077aed3SPierre Pronchery         OSSL_UNION_ALIGN;
18b077aed3SPierre Pronchery         RC4_KEY ks;
19b077aed3SPierre Pronchery     } ks;
20b077aed3SPierre Pronchery     MD5_CTX head, tail, md;
21b077aed3SPierre Pronchery     size_t payload_length;
22b077aed3SPierre Pronchery     size_t tls_aad_pad_sz;
23b077aed3SPierre Pronchery } PROV_RC4_HMAC_MD5_CTX;
24b077aed3SPierre Pronchery 
25b077aed3SPierre Pronchery typedef struct prov_cipher_hw_rc4_hmac_md5_st {
26b077aed3SPierre Pronchery     PROV_CIPHER_HW base; /* Must be first */
27b077aed3SPierre Pronchery     int (*tls_init)(PROV_CIPHER_CTX *ctx, unsigned char *aad, size_t aad_len);
28b077aed3SPierre Pronchery     void (*init_mackey)(PROV_CIPHER_CTX *ctx, const unsigned char *key,
29b077aed3SPierre Pronchery                         size_t len);
30b077aed3SPierre Pronchery 
31b077aed3SPierre Pronchery } PROV_CIPHER_HW_RC4_HMAC_MD5;
32b077aed3SPierre Pronchery 
33b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc4_hmac_md5(size_t keybits);
34b077aed3SPierre Pronchery 
35b077aed3SPierre Pronchery void rc4_md5_enc(RC4_KEY *key, const void *in0, void *out,
36b077aed3SPierre Pronchery                  MD5_CTX *ctx, const void *inp, size_t blocks);
37