Branch data Line data Source code
1 : : /* crypto-null.c --- NULL crypto functions
2 : : * Copyright (C) 2002, 2003, 2004, 2007 Simon Josefsson
3 : : *
4 : : * This file is part of Shishi.
5 : : *
6 : : * Shishi is free software; you can redistribute it and/or modify it
7 : : * under the terms of the GNU General Public License as published by
8 : : * the Free Software Foundation; either version 3 of the License, or
9 : : * (at your option) any later version.
10 : : *
11 : : * Shishi is distributed in the hope that it will be useful, but
12 : : * WITHOUT ANY WARRANTY; without even the implied warranty of
13 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : : * GNU General Public License for more details.
15 : : *
16 : : * You should have received a copy of the GNU General Public License
17 : : * along with Shishi; if not, see http://www.gnu.org/licenses or write
18 : : * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19 : : * Floor, Boston, MA 02110-1301, USA
20 : : *
21 : : */
22 : :
23 : : #include "internal.h"
24 : :
25 : : #include "crypto.h"
26 : :
27 : : static int
28 : 0 : null_encrypt (Shishi * handle,
29 : : Shishi_key * key,
30 : : int keyusage,
31 : : const char *iv, size_t ivlen,
32 : : char **ivout, size_t * ivoutlen,
33 : : const char *in, size_t inlen, char **out, size_t * outlen)
34 : : {
35 : 0 : *outlen = inlen;
36 : 0 : *out = xmalloc (*outlen);
37 : 0 : memcpy (*out, in, inlen);
38 : :
39 [ # # ]: 0 : if (ivout)
40 : 0 : *ivout = NULL;
41 [ # # ]: 0 : if (ivoutlen)
42 : 0 : *ivoutlen = 0;
43 : :
44 : 0 : return SHISHI_OK;
45 : : }
46 : :
47 : : static int
48 : 0 : null_decrypt (Shishi * handle,
49 : : Shishi_key * key,
50 : : int keyusage,
51 : : const char *iv, size_t ivlen,
52 : : char **ivout, size_t * ivoutlen,
53 : : const char *in, size_t inlen, char **out, size_t * outlen)
54 : : {
55 : 0 : *outlen = inlen;
56 : 0 : *out = xmalloc (*outlen);
57 : 0 : memcpy (*out, in, inlen);
58 : :
59 [ # # ]: 0 : if (ivout)
60 : 0 : *ivout = NULL;
61 [ # # ]: 0 : if (ivoutlen)
62 : 0 : *ivoutlen = 0;
63 : :
64 : 0 : return SHISHI_OK;
65 : : }
66 : :
67 : : static int
68 : 0 : null_random_to_key (Shishi * handle,
69 : : const char *rnd, size_t rndlen, Shishi_key * outkey)
70 : : {
71 : 0 : return SHISHI_OK;
72 : : }
73 : :
74 : : static int
75 : 0 : null_string_to_key (Shishi * handle,
76 : : const char *password, size_t passwordlen,
77 : : const char *salt, size_t saltlen,
78 : : const char *parameter, Shishi_key * outkey)
79 : : {
80 : 0 : return SHISHI_OK;
81 : : }
82 : :
83 : : cipherinfo null_info = {
84 : : SHISHI_NULL,
85 : : "NULL",
86 : : 1,
87 : : 0,
88 : : 0,
89 : : 0,
90 : : SHISHI_RSA_MD5,
91 : : null_random_to_key,
92 : : null_string_to_key,
93 : : null_encrypt,
94 : : null_decrypt
95 : : };
|