Fix migration guide mappings for i2o/o2i_ECPublicKey
[openssl.git] / crypto / rc2 / rc2_ecb.c
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 {
31     unsigned long l, d[2];
32
33     c2l(in, l);
34     d[0] = l;
35     c2l(in, l);
36     d[1] = l;
37     if (encrypt)
38         RC2_encrypt(d, ks);
39     else
40         RC2_decrypt(d, ks);
41     l = d[0];
42     l2c(l, out);
43     l = d[1];
44     l2c(l, out);
45     l = d[0] = d[1] = 0;
46 }