Coverage Report

Created: 2025-06-22 06:56

/src/openssl/providers/implementations/ciphers/cipher_rc4_hw.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2019-2020 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
/*
11
 * RC4 low level APIs are deprecated for public use, but still ok for internal
12
 * use.
13
 */
14
#include "internal/deprecated.h"
15
16
#include "cipher_rc4.h"
17
18
static int cipher_hw_rc4_initkey(PROV_CIPHER_CTX *ctx,
19
                                 const unsigned char *key, size_t keylen)
20
0
{
21
0
    PROV_RC4_CTX *rctx =  (PROV_RC4_CTX *)ctx;
22
23
0
    RC4_set_key(&rctx->ks.ks, keylen, key);
24
0
    return 1;
25
0
}
26
27
static int cipher_hw_rc4_cipher(PROV_CIPHER_CTX *ctx, unsigned char *out,
28
                                const unsigned char *in, size_t len)
29
0
{
30
0
    PROV_RC4_CTX *rctx =  (PROV_RC4_CTX *)ctx;
31
32
0
    RC4(&rctx->ks.ks, len, in, out);
33
0
    return 1;
34
0
}
35
36
static const PROV_CIPHER_HW rc4_hw = {
37
    cipher_hw_rc4_initkey,
38
    cipher_hw_rc4_cipher
39
};
40
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc4(size_t keybits)
41
0
{
42
0
    return &rc4_hw;
43
0
}
44