jpayne@69
|
1 /*
|
jpayne@69
|
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
jpayne@69
|
3 *
|
jpayne@69
|
4 * Licensed under the OpenSSL license (the "License"). You may not use
|
jpayne@69
|
5 * this file except in compliance with the License. You can obtain a copy
|
jpayne@69
|
6 * in the file LICENSE in the source distribution or at
|
jpayne@69
|
7 * https://www.openssl.org/source/license.html
|
jpayne@69
|
8 */
|
jpayne@69
|
9
|
jpayne@69
|
10 #ifndef HEADER_BLOWFISH_H
|
jpayne@69
|
11 # define HEADER_BLOWFISH_H
|
jpayne@69
|
12
|
jpayne@69
|
13 # include <openssl/opensslconf.h>
|
jpayne@69
|
14
|
jpayne@69
|
15 # ifndef OPENSSL_NO_BF
|
jpayne@69
|
16 # include <openssl/e_os2.h>
|
jpayne@69
|
17 # ifdef __cplusplus
|
jpayne@69
|
18 extern "C" {
|
jpayne@69
|
19 # endif
|
jpayne@69
|
20
|
jpayne@69
|
21 # define BF_ENCRYPT 1
|
jpayne@69
|
22 # define BF_DECRYPT 0
|
jpayne@69
|
23
|
jpayne@69
|
24 /*-
|
jpayne@69
|
25 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
jpayne@69
|
26 * ! BF_LONG has to be at least 32 bits wide. !
|
jpayne@69
|
27 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
jpayne@69
|
28 */
|
jpayne@69
|
29 # define BF_LONG unsigned int
|
jpayne@69
|
30
|
jpayne@69
|
31 # define BF_ROUNDS 16
|
jpayne@69
|
32 # define BF_BLOCK 8
|
jpayne@69
|
33
|
jpayne@69
|
34 typedef struct bf_key_st {
|
jpayne@69
|
35 BF_LONG P[BF_ROUNDS + 2];
|
jpayne@69
|
36 BF_LONG S[4 * 256];
|
jpayne@69
|
37 } BF_KEY;
|
jpayne@69
|
38
|
jpayne@69
|
39 void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
|
jpayne@69
|
40
|
jpayne@69
|
41 void BF_encrypt(BF_LONG *data, const BF_KEY *key);
|
jpayne@69
|
42 void BF_decrypt(BF_LONG *data, const BF_KEY *key);
|
jpayne@69
|
43
|
jpayne@69
|
44 void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
jpayne@69
|
45 const BF_KEY *key, int enc);
|
jpayne@69
|
46 void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
|
jpayne@69
|
47 const BF_KEY *schedule, unsigned char *ivec, int enc);
|
jpayne@69
|
48 void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
jpayne@69
|
49 long length, const BF_KEY *schedule,
|
jpayne@69
|
50 unsigned char *ivec, int *num, int enc);
|
jpayne@69
|
51 void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
jpayne@69
|
52 long length, const BF_KEY *schedule,
|
jpayne@69
|
53 unsigned char *ivec, int *num);
|
jpayne@69
|
54 const char *BF_options(void);
|
jpayne@69
|
55
|
jpayne@69
|
56 # ifdef __cplusplus
|
jpayne@69
|
57 }
|
jpayne@69
|
58 # endif
|
jpayne@69
|
59 # endif
|
jpayne@69
|
60
|
jpayne@69
|
61 #endif
|