| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "BF_ENCRYPT 3SSL" |
| 58 |
.TH BF_ENCRYPT 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
BF_set_key, BF_encrypt, BF_decrypt, BF_ecb_encrypt, BF_cbc_encrypt, |
| 65 |
BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options \- Blowfish encryption |
| 66 |
.SH SYNOPSIS |
| 67 |
.IX Header "SYNOPSIS" |
| 68 |
.Vb 1 |
| 69 |
\& #include <openssl/blowfish.h> |
| 70 |
.Ve |
| 71 |
.PP |
| 72 |
The following functions have been deprecated since OpenSSL 3.0, and can be |
| 73 |
hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value, |
| 74 |
see \fBopenssl_user_macros\fR\|(7): |
| 75 |
.PP |
| 76 |
.Vb 1 |
| 77 |
\& void BF_set_key(BF_KEY *key, int len, const unsigned char *data); |
| 78 |
\& |
| 79 |
\& void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, |
| 80 |
\& BF_KEY *key, int enc); |
| 81 |
\& void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, |
| 82 |
\& long length, BF_KEY *schedule, |
| 83 |
\& unsigned char *ivec, int enc); |
| 84 |
\& void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
| 85 |
\& long length, BF_KEY *schedule, |
| 86 |
\& unsigned char *ivec, int *num, int enc); |
| 87 |
\& void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, |
| 88 |
\& long length, BF_KEY *schedule, |
| 89 |
\& unsigned char *ivec, int *num); |
| 90 |
\& const char *BF_options(void); |
| 91 |
\& |
| 92 |
\& void BF_encrypt(BF_LONG *data, const BF_KEY *key); |
| 93 |
\& void BF_decrypt(BF_LONG *data, const BF_KEY *key); |
| 94 |
.Ve |
| 95 |
.SH DESCRIPTION |
| 96 |
.IX Header "DESCRIPTION" |
| 97 |
All of the functions described on this page are deprecated. Applications should |
| 98 |
instead use \fBEVP_EncryptInit_ex\fR\|(3), \fBEVP_EncryptUpdate\fR\|(3) and |
| 99 |
\&\fBEVP_EncryptFinal_ex\fR\|(3) or the equivalently named decrypt functions. |
| 100 |
.PP |
| 101 |
This library implements the Blowfish cipher, which was invented and described |
| 102 |
by Counterpane (see http://www.counterpane.com/blowfish.html ). |
| 103 |
.PP |
| 104 |
Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data. |
| 105 |
It uses a variable size key, but typically, 128 bit (16 byte) keys are |
| 106 |
considered good for strong encryption. Blowfish can be used in the same |
| 107 |
modes as DES (see \fBdes_modes\fR\|(7)). Blowfish is currently one |
| 108 |
of the faster block ciphers. It is quite a bit faster than DES, and much |
| 109 |
faster than IDEA or RC2. |
| 110 |
.PP |
| 111 |
Blowfish consists of a key setup phase and the actual encryption or decryption |
| 112 |
phase. |
| 113 |
.PP |
| 114 |
\&\fBBF_set_key()\fR sets up the \fBBF_KEY\fR \fBkey\fR using the \fBlen\fR bytes long key |
| 115 |
at \fBdata\fR. |
| 116 |
.PP |
| 117 |
\&\fBBF_ecb_encrypt()\fR is the basic Blowfish encryption and decryption function. |
| 118 |
It encrypts or decrypts the first 64 bits of \fBin\fR using the key \fBkey\fR, |
| 119 |
putting the result in \fBout\fR. \fBenc\fR decides if encryption (\fBBF_ENCRYPT\fR) |
| 120 |
or decryption (\fBBF_DECRYPT\fR) shall be performed. The vector pointed at by |
| 121 |
\&\fBin\fR and \fBout\fR must be 64 bits in length, no less. If they are larger, |
| 122 |
everything after the first 64 bits is ignored. |
| 123 |
.PP |
| 124 |
The mode functions \fBBF_cbc_encrypt()\fR, \fBBF_cfb64_encrypt()\fR and \fBBF_ofb64_encrypt()\fR |
| 125 |
all operate on variable length data. They all take an initialization vector |
| 126 |
\&\fBivec\fR which needs to be passed along into the next call of the same function |
| 127 |
for the same message. \fBivec\fR may be initialized with anything, but the |
| 128 |
recipient needs to know what it was initialized with, or it won't be able |
| 129 |
to decrypt. Some programs and protocols simplify this, like SSH, where |
| 130 |
\&\fBivec\fR is simply initialized to zero. |
| 131 |
\&\fBBF_cbc_encrypt()\fR operates on data that is a multiple of 8 bytes long, while |
| 132 |
\&\fBBF_cfb64_encrypt()\fR and \fBBF_ofb64_encrypt()\fR are used to encrypt a variable |
| 133 |
number of bytes (the amount does not have to be an exact multiple of 8). The |
| 134 |
purpose of the latter two is to simulate stream ciphers, and therefore, they |
| 135 |
need the parameter \fBnum\fR, which is a pointer to an integer where the current |
| 136 |
offset in \fBivec\fR is stored between calls. This integer must be initialized |
| 137 |
to zero when \fBivec\fR is initialized. |
| 138 |
.PP |
| 139 |
\&\fBBF_cbc_encrypt()\fR is the Cipher Block Chaining function for Blowfish. It |
| 140 |
encrypts or decrypts the 64 bits chunks of \fBin\fR using the key \fBschedule\fR, |
| 141 |
putting the result in \fBout\fR. \fBenc\fR decides if encryption (BF_ENCRYPT) or |
| 142 |
decryption (BF_DECRYPT) shall be performed. \fBivec\fR must point at an 8 byte |
| 143 |
long initialization vector. |
| 144 |
.PP |
| 145 |
\&\fBBF_cfb64_encrypt()\fR is the CFB mode for Blowfish with 64 bit feedback. |
| 146 |
It encrypts or decrypts the bytes in \fBin\fR using the key \fBschedule\fR, |
| 147 |
putting the result in \fBout\fR. \fBenc\fR decides if encryption (\fBBF_ENCRYPT\fR) |
| 148 |
or decryption (\fBBF_DECRYPT\fR) shall be performed. \fBivec\fR must point at an |
| 149 |
8 byte long initialization vector. \fBnum\fR must point at an integer which must |
| 150 |
be initially zero. |
| 151 |
.PP |
| 152 |
\&\fBBF_ofb64_encrypt()\fR is the OFB mode for Blowfish with 64 bit feedback. |
| 153 |
It uses the same parameters as \fBBF_cfb64_encrypt()\fR, which must be initialized |
| 154 |
the same way. |
| 155 |
.PP |
| 156 |
\&\fBBF_encrypt()\fR and \fBBF_decrypt()\fR are the lowest level functions for Blowfish |
| 157 |
encryption. They encrypt/decrypt the first 64 bits of the vector pointed by |
| 158 |
\&\fBdata\fR, using the key \fBkey\fR. These functions should not be used unless you |
| 159 |
implement 'modes' of Blowfish. The alternative is to use \fBBF_ecb_encrypt()\fR. |
| 160 |
If you still want to use these functions, you should be aware that they take |
| 161 |
each 32\-bit chunk in host-byte order, which is little-endian on little-endian |
| 162 |
platforms and big-endian on big-endian ones. |
| 163 |
.SH "RETURN VALUES" |
| 164 |
.IX Header "RETURN VALUES" |
| 165 |
None of the functions presented here return any value. |
| 166 |
.SH NOTE |
| 167 |
.IX Header "NOTE" |
| 168 |
Applications should use the higher level functions |
| 169 |
\&\fBEVP_EncryptInit\fR\|(3) etc. instead of calling these |
| 170 |
functions directly. |
| 171 |
.SH "SEE ALSO" |
| 172 |
.IX Header "SEE ALSO" |
| 173 |
\&\fBEVP_EncryptInit\fR\|(3), |
| 174 |
\&\fBdes_modes\fR\|(7) |
| 175 |
.SH HISTORY |
| 176 |
.IX Header "HISTORY" |
| 177 |
All of these functions were deprecated in OpenSSL 3.0. |
| 178 |
.SH COPYRIGHT |
| 179 |
.IX Header "COPYRIGHT" |
| 180 |
Copyright 2000\-2020 The OpenSSL Project Authors. All Rights Reserved. |
| 181 |
.PP |
| 182 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 183 |
this file except in compliance with the License. You can obtain a copy |
| 184 |
in the file LICENSE in the source distribution or at |
| 185 |
<https://www.openssl.org/source/license.html>. |