No need for getline.h.
[shishi.git] / lib / crypto-null.c
blob5d758f05ac348fdb7096dd430516f42c81b6bbae
1 /* crypto-null.c --- NULL crypto functions
2 * Copyright (C) 2002, 2003, 2004, 2007 Simon Josefsson
4 * This file is part of Shishi.
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.
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.
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
23 #include "internal.h"
25 #include "crypto.h"
27 static int
28 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)
35 *outlen = inlen;
36 *out = xmalloc (*outlen);
37 memcpy (*out, in, inlen);
39 if (ivout)
40 *ivout = NULL;
41 if (ivoutlen)
42 *ivoutlen = 0;
44 return SHISHI_OK;
47 static int
48 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)
55 *outlen = inlen;
56 *out = xmalloc (*outlen);
57 memcpy (*out, in, inlen);
59 if (ivout)
60 *ivout = NULL;
61 if (ivoutlen)
62 *ivoutlen = 0;
64 return SHISHI_OK;
67 static int
68 null_random_to_key (Shishi * handle,
69 const char *rnd, size_t rndlen, Shishi_key * outkey)
71 return SHISHI_OK;
74 static int
75 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)
80 return SHISHI_OK;
83 cipherinfo null_info = {
84 SHISHI_NULL,
85 "NULL",
90 SHISHI_RSA_MD5,
91 null_random_to_key,
92 null_string_to_key,
93 null_encrypt,
94 null_decrypt