1BF_ENCRYPT(3ossl)                   OpenSSL                  BF_ENCRYPT(3ossl)
2
3
4

NAME

6       BF_set_key, BF_encrypt, BF_decrypt, BF_ecb_encrypt, BF_cbc_encrypt,
7       BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption
8

SYNOPSIS

10        #include <openssl/blowfish.h>
11
12       The following functions have been deprecated since OpenSSL 3.0, and can
13       be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
14       version value, see openssl_user_macros(7):
15
16        void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
17
18        void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
19                            BF_KEY *key, int enc);
20        void BF_cbc_encrypt(const unsigned char *in, unsigned char *out,
21                            long length, BF_KEY *schedule,
22                            unsigned char *ivec, int enc);
23        void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
24                              long length, BF_KEY *schedule,
25                              unsigned char *ivec, int *num, int enc);
26        void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
27                              long length, BF_KEY *schedule,
28                              unsigned char *ivec, int *num);
29        const char *BF_options(void);
30
31        void BF_encrypt(BF_LONG *data, const BF_KEY *key);
32        void BF_decrypt(BF_LONG *data, const BF_KEY *key);
33

DESCRIPTION

35       All of the functions described on this page are deprecated.
36       Applications should instead use EVP_EncryptInit_ex(3),
37       EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) or the equivalently
38       named decrypt functions.
39
40       This library implements the Blowfish cipher, which was invented and
41       described by Counterpane (see http://www.counterpane.com/blowfish.html
42       ).
43
44       Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of
45       data.  It uses a variable size key, but typically, 128 bit (16 byte)
46       keys are considered good for strong encryption.  Blowfish can be used
47       in the same modes as DES (see des_modes(7)).  Blowfish is currently one
48       of the faster block ciphers.  It is quite a bit faster than DES, and
49       much faster than IDEA or RC2.
50
51       Blowfish consists of a key setup phase and the actual encryption or
52       decryption phase.
53
54       BF_set_key() sets up the BF_KEY key using the len bytes long key at
55       data.
56
57       BF_ecb_encrypt() is the basic Blowfish encryption and decryption
58       function.  It encrypts or decrypts the first 64 bits of in using the
59       key key, putting the result in out.  enc decides if encryption
60       (BF_ENCRYPT) or decryption (BF_DECRYPT) shall be performed.  The vector
61       pointed at by in and out must be 64 bits in length, no less.  If they
62       are larger, everything after the first 64 bits is ignored.
63
64       The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and
65       BF_ofb64_encrypt() all operate on variable length data.  They all take
66       an initialization vector ivec which needs to be passed along into the
67       next call of the same function for the same message.  ivec may be
68       initialized with anything, but the recipient needs to know what it was
69       initialized with, or it won't be able to decrypt.  Some programs and
70       protocols simplify this, like SSH, where ivec is simply initialized to
71       zero.  BF_cbc_encrypt() operates on data that is a multiple of 8 bytes
72       long, while BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to
73       encrypt a variable number of bytes (the amount does not have to be an
74       exact multiple of 8).  The purpose of the latter two is to simulate
75       stream ciphers, and therefore, they need the parameter num, which is a
76       pointer to an integer where the current offset in ivec is stored
77       between calls.  This integer must be initialized to zero when ivec is
78       initialized.
79
80       BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish.
81       It encrypts or decrypts the 64 bits chunks of in using the key
82       schedule, putting the result in out.  enc decides if encryption
83       (BF_ENCRYPT) or decryption (BF_DECRYPT) shall be performed.  ivec must
84       point at an 8 byte long initialization vector.
85
86       BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback.
87       It encrypts or decrypts the bytes in in using the key schedule, putting
88       the result in out.  enc decides if encryption (BF_ENCRYPT) or
89       decryption (BF_DECRYPT) shall be performed.  ivec must point at an 8
90       byte long initialization vector. num must point at an integer which
91       must be initially zero.
92
93       BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback.
94       It uses the same parameters as BF_cfb64_encrypt(), which must be
95       initialized the same way.
96
97       BF_encrypt() and BF_decrypt() are the lowest level functions for
98       Blowfish encryption.  They encrypt/decrypt the first 64 bits of the
99       vector pointed by data, using the key key.  These functions should not
100       be used unless you implement 'modes' of Blowfish.  The alternative is
101       to use BF_ecb_encrypt().  If you still want to use these functions, you
102       should be aware that they take each 32-bit chunk in host-byte order,
103       which is little-endian on little-endian platforms and big-endian on
104       big-endian ones.
105

RETURN VALUES

107       None of the functions presented here return any value.
108

NOTE

110       Applications should use the higher level functions EVP_EncryptInit(3)
111       etc. instead of calling these functions directly.
112

SEE ALSO

114       EVP_EncryptInit(3), des_modes(7)
115

HISTORY

117       All of these functions were deprecated in OpenSSL 3.0.
118
120       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
121
122       Licensed under the Apache License 2.0 (the "License").  You may not use
123       this file except in compliance with the License.  You can obtain a copy
124       in the file LICENSE in the source distribution or at
125       <https://www.openssl.org/source/license.html>.
126
127
128
1293.1.1                             2023-08-31                 BF_ENCRYPT(3ossl)
Impressum