/src/openssl/crypto/des/ecb_enc.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
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 |
8 | | */ |
9 | | |
10 | | #include "des_locl.h" |
11 | | #include <openssl/opensslv.h> |
12 | | #include <openssl/bio.h> |
13 | | |
14 | | |
15 | | const char *DES_options(void) |
16 | 0 | { |
17 | 0 | static int init = 1; |
18 | 0 | static char buf[12]; |
19 | 0 |
|
20 | 0 | if (init) { |
21 | 0 | if (sizeof(DES_LONG) != sizeof(long)) |
22 | 0 | OPENSSL_strlcpy(buf, "des(int)", sizeof(buf)); |
23 | 0 | else |
24 | 0 | OPENSSL_strlcpy(buf, "des(long)", sizeof(buf)); |
25 | 0 | init = 0; |
26 | 0 | } |
27 | 0 | return buf; |
28 | 0 | } |
29 | | |
30 | | void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, |
31 | | DES_key_schedule *ks, int enc) |
32 | 0 | { |
33 | 0 | register DES_LONG l; |
34 | 0 | DES_LONG ll[2]; |
35 | 0 | const unsigned char *in = &(*input)[0]; |
36 | 0 | unsigned char *out = &(*output)[0]; |
37 | 0 |
|
38 | 0 | c2l(in, l); |
39 | 0 | ll[0] = l; |
40 | 0 | c2l(in, l); |
41 | 0 | ll[1] = l; |
42 | 0 | DES_encrypt1(ll, ks, enc); |
43 | 0 | l = ll[0]; |
44 | 0 | l2c(l, out); |
45 | 0 | l = ll[1]; |
46 | 0 | l2c(l, out); |
47 | 0 | l = ll[0] = ll[1] = 0; |
48 | 0 | } |