• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
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
8  */
9 
10 #ifndef OPENSSL_HEADER_BLOWFISH_H
11 #define OPENSSL_HEADER_BLOWFISH_H
12 
13 #include <openssl/base.h>
14 
15 #ifdef  __cplusplus
16 extern "C" {
17 #endif
18 
19 
20 #define BF_ENCRYPT 1
21 #define BF_DECRYPT 0
22 
23 #define BF_ROUNDS 16
24 #define BF_BLOCK 8
25 
26 typedef struct bf_key_st {
27   uint32_t P[BF_ROUNDS + 2];
28   uint32_t S[4 * 256];
29 } BF_KEY;
30 
31 OPENSSL_EXPORT void BF_set_key(BF_KEY *key, size_t len, const uint8_t *data);
32 OPENSSL_EXPORT void BF_encrypt(uint32_t *data, const BF_KEY *key);
33 OPENSSL_EXPORT void BF_decrypt(uint32_t *data, const BF_KEY *key);
34 
35 OPENSSL_EXPORT void BF_ecb_encrypt(const uint8_t *in, uint8_t *out,
36                                    const BF_KEY *key, int enc);
37 OPENSSL_EXPORT void BF_cbc_encrypt(const uint8_t *in, uint8_t *out,
38                                    size_t length, const BF_KEY *schedule,
39                                    uint8_t *ivec, int enc);
40 
41 
42 #ifdef  __cplusplus
43 }
44 #endif
45 
46 #endif  // OPENSSL_HEADER_BLOWFISH_H
47