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