1BF_ENCRYPT(3)                       OpenSSL                      BF_ENCRYPT(3)
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        void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
13
14        void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
15                            BF_KEY *key, int enc);
16        void BF_cbc_encrypt(const unsigned char *in, unsigned char *out,
17                            long length, BF_KEY *schedule,
18                            unsigned char *ivec, int enc);
19        void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
20                              long length, BF_KEY *schedule,
21                              unsigned char *ivec, int *num, int enc);
22        void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
23                              long length, BF_KEY *schedule,
24                              unsigned char *ivec, int *num);
25        const char *BF_options(void);
26
27        void BF_encrypt(BF_LONG *data, const BF_KEY *key);
28        void BF_decrypt(BF_LONG *data, const BF_KEY *key);
29

DESCRIPTION

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

RETURN VALUES

98       None of the functions presented here return any value.
99

NOTE

101       Applications should use the higher level functions EVP_EncryptInit(3)
102       etc. instead of calling these functions directly.
103

SEE ALSO

105       EVP_EncryptInit(3), des_modes(7)
106
108       Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
109
110       Licensed under the OpenSSL license (the "License").  You may not use
111       this file except in compliance with the License.  You can obtain a copy
112       in the file LICENSE in the source distribution or at
113       <https://www.openssl.org/source/license.html>.
114
115
116
1171.1.1q                            2023-02-06                     BF_ENCRYPT(3)
Impressum