]>
Commit | Line | Data |
---|---|---|
21dcbebc RS |
1 | /* |
2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. | |
d02b48c6 | 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 | |
d02b48c6 RE |
8 | */ |
9 | ||
10 | #ifndef HEADER_BLOWFISH_H | |
0f113f3e | 11 | # define HEADER_BLOWFISH_H |
d02b48c6 | 12 | |
3c27208f | 13 | # include <openssl/opensslconf.h> |
cf1b7d96 | 14 | |
3c27208f RS |
15 | # ifndef OPENSSL_NO_BF |
16 | # include <openssl/e_os2.h> | |
17 | # ifdef __cplusplus | |
d02b48c6 | 18 | extern "C" { |
0f113f3e | 19 | # endif |
f5d7a031 | 20 | |
0f113f3e MC |
21 | # define BF_ENCRYPT 1 |
22 | # define BF_DECRYPT 0 | |
d02b48c6 | 23 | |
1d97c843 | 24 | /*- |
8cd8a7b7 | 25 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04f8bcf1 | 26 | * ! BF_LONG has to be at least 32 bits wide. ! |
8cd8a7b7 UM |
27 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
28 | */ | |
04f8bcf1 | 29 | # define BF_LONG unsigned int |
d02b48c6 | 30 | |
0f113f3e MC |
31 | # define BF_ROUNDS 16 |
32 | # define BF_BLOCK 8 | |
d02b48c6 | 33 | |
0f113f3e MC |
34 | typedef struct bf_key_st { |
35 | BF_LONG P[BF_ROUNDS + 2]; | |
36 | BF_LONG S[4 * 256]; | |
37 | } BF_KEY; | |
d02b48c6 | 38 | |
6343829a | 39 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); |
cf069401 | 40 | |
0f113f3e MC |
41 | void BF_encrypt(BF_LONG *data, const BF_KEY *key); |
42 | void BF_decrypt(BF_LONG *data, const BF_KEY *key); | |
cf069401 RL |
43 | |
44 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, | |
0f113f3e | 45 | const BF_KEY *key, int enc); |
cf069401 | 46 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
0f113f3e MC |
47 | const BF_KEY *schedule, unsigned char *ivec, int enc); |
48 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |
49 | long length, const BF_KEY *schedule, | |
50 | unsigned char *ivec, int *num, int enc); | |
51 | void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, | |
52 | long length, const BF_KEY *schedule, | |
53 | unsigned char *ivec, int *num); | |
e778802f | 54 | const char *BF_options(void); |
d02b48c6 | 55 | |
3c27208f | 56 | # ifdef __cplusplus |
d02b48c6 | 57 | } |
3c27208f RS |
58 | # endif |
59 | # endif | |
d02b48c6 RE |
60 | |
61 | #endif |