| 6 | // |
| 7 | // https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 |
| 15 | #ifndef OPENSSL_HEADER_BLOWFISH_H |
| 16 | #define OPENSSL_HEADER_BLOWFISH_H |
| 17 |
| 18 | #include <openssl/base.h> // IWYU pragma: export |
| 19 |
| 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 |
| 24 |
| 25 | #define BF_ENCRYPT 1 |
| 26 | #define BF_DECRYPT 0 |
| 27 |
| 28 | #define BF_ROUNDS 16 |
| 29 | #define BF_BLOCK 8 |
| 30 |
| 31 | typedef struct bf_key_st { |
| 32 | uint32_t P[BF_ROUNDS + 2]; |
| 33 | uint32_t S[4 * 256]; |
| 34 | } BF_KEY; |
| 35 |
| 36 | OPENSSL_EXPORT void BF_set_key(BF_KEY *key, size_t len, const uint8_t *data); |
| 37 | OPENSSL_EXPORT void BF_encrypt(uint32_t *data, const BF_KEY *key); |
| 38 | OPENSSL_EXPORT void BF_decrypt(uint32_t *data, const BF_KEY *key); |
| 39 |
| 40 | OPENSSL_EXPORT void BF_ecb_encrypt(const uint8_t *in, uint8_t *out, |
| 41 | const BF_KEY *key, int enc); |
| 42 | OPENSSL_EXPORT void BF_cbc_encrypt(const uint8_t *in, uint8_t *out, |
| 43 | size_t length, const BF_KEY *schedule, |
| 44 | uint8_t *ivec, int enc); |
| 45 |
| 46 |
| 47 | #ifdef __cplusplus |
| 48 | } |
| 49 | #endif |
| 50 |
| 51 | #endif // OPENSSL_HEADER_BLOWFISH_H |
| 52 |