Coverage Report

Created: 2025-06-13 06:56

/src/openssl/crypto/rc2/rc2_ecb.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 1995-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
 * RC2 low level APIs are deprecated for public use, but still ok for internal
12
 * use.
13
 */
14
#include "internal/deprecated.h"
15
16
#include <openssl/rc2.h>
17
#include "rc2_local.h"
18
#include <openssl/opensslv.h>
19
20
/*-
21
 * RC2 as implemented frm a posting from
22
 * Newsgroups: sci.crypt
23
 * Subject: Specification for Ron Rivests Cipher No.2
24
 * Message-ID: <4fk39f$f70@net.auckland.ac.nz>
25
 * Date: 11 Feb 1996 06:45:03 GMT
26
 */
27
28
void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks,
29
                     int encrypt)
30
0
{
31
0
    unsigned long l, d[2];
32
33
0
    c2l(in, l);
34
0
    d[0] = l;
35
0
    c2l(in, l);
36
0
    d[1] = l;
37
0
    if (encrypt)
38
0
        RC2_encrypt(d, ks);
39
0
    else
40
0
        RC2_decrypt(d, ks);
41
0
    l = d[0];
42
0
    l2c(l, out);
43
0
    l = d[1];
44
0
    l2c(l, out);
45
0
    l = d[0] = d[1] = 0;
46
0
}