]>
Commit | Line | Data |
---|---|---|
d2e9e320 | 1 | /* |
a2371fa9 | 2 | * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. |
d02b48c6 | 3 | * |
2d48d5dd | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
d2e9e320 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 | ||
706457b7 | 10 | #include "des_local.h" |
ec577822 | 11 | #include <openssl/opensslv.h> |
d420ac2c | 12 | #include <openssl/bio.h> |
d02b48c6 | 13 | |
d02b48c6 | 14 | |
c2e4f17c | 15 | const char *DES_options(void) |
0f113f3e MC |
16 | { |
17 | static int init = 1; | |
a2371fa9 | 18 | static char buf[12]; |
d02b48c6 | 19 | |
0f113f3e | 20 | if (init) { |
0f113f3e | 21 | if (sizeof(DES_LONG) != sizeof(long)) |
a2371fa9 | 22 | OPENSSL_strlcpy(buf, "des(int)", sizeof(buf)); |
0f113f3e | 23 | else |
a2371fa9 | 24 | OPENSSL_strlcpy(buf, "des(long)", sizeof(buf)); |
0f113f3e MC |
25 | init = 0; |
26 | } | |
a2371fa9 | 27 | return buf; |
0f113f3e | 28 | } |
d02b48c6 | 29 | |
c2e4f17c | 30 | void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, |
0f113f3e MC |
31 | DES_key_schedule *ks, int enc) |
32 | { | |
33 | register DES_LONG l; | |
34 | DES_LONG ll[2]; | |
35 | const unsigned char *in = &(*input)[0]; | |
36 | unsigned char *out = &(*output)[0]; | |
d02b48c6 | 37 | |
0f113f3e MC |
38 | c2l(in, l); |
39 | ll[0] = l; | |
40 | c2l(in, l); | |
41 | ll[1] = l; | |
42 | DES_encrypt1(ll, ks, enc); | |
43 | l = ll[0]; | |
44 | l2c(l, out); | |
45 | l = ll[1]; | |
46 | l2c(l, out); | |
47 | l = ll[0] = ll[1] = 0; | |
48 | } |