]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/bf/bf_ecb.c
Reorganize local header files
[thirdparty/openssl.git] / crypto / bf / bf_ecb.c
CommitLineData
b1322259
RS
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
0f113f3e 3 *
8b00b7b8 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
b1322259
RS
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
d02b48c6
RE
8 */
9
ec577822 10#include <openssl/blowfish.h>
706457b7 11#include "bf_local.h"
ec577822 12#include <openssl/opensslv.h>
d02b48c6 13
0f113f3e
MC
14/*
15 * Blowfish as implemented from 'Blowfish: Springer-Verlag paper' (From
16 * LECTURE NOTES IN COMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, CAMBRIDGE
17 * SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993)
d02b48c6
RE
18 */
19
6b691a5c 20const char *BF_options(void)
0f113f3e 21{
26a7d938 22 return "blowfish(ptr)";
0f113f3e 23}
d02b48c6 24
cf069401 25void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
26 const BF_KEY *key, int encrypt)
27{
28 BF_LONG l, d[2];
d02b48c6 29
0f113f3e
MC
30 n2l(in, l);
31 d[0] = l;
32 n2l(in, l);
33 d[1] = l;
34 if (encrypt)
35 BF_encrypt(d, key);
36 else
37 BF_decrypt(d, key);
38 l = d[0];
39 l2n(l, out);
40 l = d[1];
41 l2n(l, out);
42 l = d[0] = d[1] = 0;
43}