]>
Commit | Line | Data |
---|---|---|
21dcbebc RS |
1 | /* |
2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. | |
0f113f3e | 3 | * |
21dcbebc RS |
4 | * Licensed under the OpenSSL license (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 | |
58964a49 RE |
8 | */ |
9 | ||
10 | #ifndef HEADER_RC5_H | |
0f113f3e | 11 | # define HEADER_RC5_H |
58964a49 | 12 | |
3c27208f | 13 | # include <openssl/opensslconf.h> |
f1185145 | 14 | |
3c27208f RS |
15 | # ifndef OPENSSL_NO_RC5 |
16 | # ifdef __cplusplus | |
58964a49 | 17 | extern "C" { |
0f113f3e | 18 | # endif |
f5d7a031 | 19 | |
0f113f3e MC |
20 | # define RC5_ENCRYPT 1 |
21 | # define RC5_DECRYPT 0 | |
58964a49 | 22 | |
0f113f3e | 23 | # define RC5_32_INT unsigned int |
58964a49 | 24 | |
0f113f3e MC |
25 | # define RC5_32_BLOCK 8 |
26 | # define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ | |
58964a49 | 27 | |
0f113f3e MC |
28 | /* |
29 | * This are the only values supported. Tweak the code if you want more The | |
30 | * most supported modes will be RC5-32/12/16 RC5-32/16/8 | |
58964a49 | 31 | */ |
0f113f3e MC |
32 | # define RC5_8_ROUNDS 8 |
33 | # define RC5_12_ROUNDS 12 | |
34 | # define RC5_16_ROUNDS 16 | |
58964a49 | 35 | |
0f113f3e MC |
36 | typedef struct rc5_key_st { |
37 | /* Number of rounds */ | |
38 | int rounds; | |
39 | RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; | |
40 | } RC5_32_KEY; | |
58964a49 | 41 | |
1921eaad | 42 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, |
0f113f3e MC |
43 | int rounds); |
44 | void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, | |
45 | RC5_32_KEY *key, int enc); | |
46 | void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); | |
47 | void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); | |
1921eaad | 48 | void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, |
0f113f3e MC |
49 | long length, RC5_32_KEY *ks, unsigned char *iv, |
50 | int enc); | |
1921eaad | 51 | void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
0f113f3e MC |
52 | long length, RC5_32_KEY *schedule, |
53 | unsigned char *ivec, int *num, int enc); | |
1921eaad | 54 | void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, |
0f113f3e MC |
55 | long length, RC5_32_KEY *schedule, |
56 | unsigned char *ivec, int *num); | |
58964a49 | 57 | |
3c27208f | 58 | # ifdef __cplusplus |
58964a49 | 59 | } |
3c27208f RS |
60 | # endif |
61 | # endif | |
58964a49 RE |
62 | |
63 | #endif |