summaryrefslogtreecommitdiff
path: root/cipher-acss.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2004-03-01 02:25:32 +0000
committerColin Watson <cjwatson@debian.org>2004-03-01 02:25:32 +0000
commitea8116a11e3de70036dbc665ccb0d486cf89cac9 (patch)
treed73ccdff78d8608e156465af42e6a1b3527fb2d6 /cipher-acss.c
parente39b311381a5609cc05acf298c42fba196dc524b (diff)
parentf5bda272678ec6dccaa5f29379cf60cb855018e8 (diff)
Merge 3.8p1 to the trunk. This builds and runs, but I haven't tested it
extensively yet. ProtocolKeepAlives is now just a compatibility alias for ServerAliveInterval.
Diffstat (limited to 'cipher-acss.c')
-rw-r--r--cipher-acss.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/cipher-acss.c b/cipher-acss.c
new file mode 100644
index 000000000..3a966a74d
--- /dev/null
+++ b/cipher-acss.c
@@ -0,0 +1,84 @@
1/*
2 * Copyright (c) 2004 The OpenBSD project
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include "includes.h"
18#include <openssl/evp.h>
19
20RCSID("$Id: cipher-acss.c,v 1.2 2004/02/06 04:26:11 dtucker Exp $");
21
22#if !defined(EVP_CTRL_SET_ACSS_MODE) && (OPENSSL_VERSION_NUMBER >= 0x00907000L)
23
24#include "acss.h"
25
26#define data(ctx) ((EVP_ACSS_KEY *)(ctx)->cipher_data)
27
28typedef struct {
29 ACSS_KEY ks;
30} EVP_ACSS_KEY;
31
32#define EVP_CTRL_SET_ACSS_MODE 0xff06
33#define EVP_CTRL_SET_ACSS_SUBKEY 0xff07
34
35static int
36acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
37 const unsigned char *iv, int enc)
38{
39 acss_setkey(&data(ctx)->ks,key,enc,ACSS_DATA);
40 return 1;
41}
42
43static int
44acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
45 unsigned int inl)
46{
47 acss(&data(ctx)->ks,inl,in,out);
48 return 1;
49}
50
51static int
52acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
53{
54 switch(type) {
55 case EVP_CTRL_SET_ACSS_MODE:
56 data(ctx)->ks.mode = arg;
57 return 1;
58 case EVP_CTRL_SET_ACSS_SUBKEY:
59 acss_setsubkey(&data(ctx)->ks,(unsigned char *)ptr);
60 return 1;
61 default:
62 return -1;
63 }
64}
65
66const EVP_CIPHER *
67evp_acss(void)
68{
69 static EVP_CIPHER acss_cipher;
70
71 memset(&acss_cipher, 0, sizeof(EVP_CIPHER));
72
73 acss_cipher.nid = NID_undef;
74 acss_cipher.block_size = 1;
75 acss_cipher.key_len = 5;
76 acss_cipher.init = acss_init_key;
77 acss_cipher.do_cipher = acss_ciph;
78 acss_cipher.ctx_size = sizeof(EVP_ACSS_KEY);
79 acss_cipher.ctrl = acss_ctrl;
80
81 return (&acss_cipher);
82}
83#endif
84