2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (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
10 #include <openssl/blowfish.h>
13 void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
14 const BF_KEY *schedule, unsigned char *ivec, int encrypt)
16 register BF_LONG tin0, tin1;
17 register BF_LONG tout0, tout1, xor0, xor1;
18 register long l = length;
25 for (l -= 8; l >= 0; l -= 8) {
32 BF_encrypt(tin, schedule);
39 n2ln(in, tin0, tin1, l + 8);
44 BF_encrypt(tin, schedule);
56 for (l -= 8; l >= 0; l -= 8) {
61 BF_decrypt(tin, schedule);
62 tout0 = tin[0] ^ xor0;
63 tout1 = tin[1] ^ xor1;
74 BF_decrypt(tin, schedule);
75 tout0 = tin[0] ^ xor0;
76 tout1 = tin[1] ^ xor1;
77 l2nn(tout0, tout1, out, l + 8);
84 tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0;