]> git.ipfire.org Git - thirdparty/openssl.git/blob - include/openssl/blowfish.h
Update source files for deprecation at 3.0
[thirdparty/openssl.git] / include / openssl / blowfish.h
1 /*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (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_BLOWFISH_H
11 # define OPENSSL_BLOWFISH_H
12 # pragma once
13
14 # include <openssl/macros.h>
15 # ifndef OPENSSL_NO_DEPRECATED_3_0
16 # define HEADER_BLOWFISH_H
17 # endif
18
19 # include <openssl/opensslconf.h>
20
21 # ifndef OPENSSL_NO_BF
22 # include <openssl/e_os2.h>
23 # ifdef __cplusplus
24 extern "C" {
25 # endif
26
27 # define BF_ENCRYPT 1
28 # define BF_DECRYPT 0
29
30 /*-
31 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
32 * ! BF_LONG has to be at least 32 bits wide. !
33 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
34 */
35 # define BF_LONG unsigned int
36
37 # define BF_ROUNDS 16
38 # define BF_BLOCK 8
39
40 typedef struct bf_key_st {
41 BF_LONG P[BF_ROUNDS + 2];
42 BF_LONG S[4 * 256];
43 } BF_KEY;
44
45 void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
46
47 void BF_encrypt(BF_LONG *data, const BF_KEY *key);
48 void BF_decrypt(BF_LONG *data, const BF_KEY *key);
49
50 void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
51 const BF_KEY *key, int enc);
52 void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
53 const BF_KEY *schedule, unsigned char *ivec, int enc);
54 void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
55 long length, const BF_KEY *schedule,
56 unsigned char *ivec, int *num, int enc);
57 void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
58 long length, const BF_KEY *schedule,
59 unsigned char *ivec, int *num);
60 const char *BF_options(void);
61
62 # ifdef __cplusplus
63 }
64 # endif
65 # endif
66
67 #endif