summaryrefslogtreecommitdiff
path: root/cipher-acss.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher-acss.c')
-rw-r--r--cipher-acss.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/cipher-acss.c b/cipher-acss.c
deleted file mode 100644
index e755f92b9..000000000
--- a/cipher-acss.c
+++ /dev/null
@@ -1,86 +0,0 @@
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
19#include <openssl/evp.h>
20
21#include <string.h>
22
23#if !defined(EVP_CTRL_SET_ACSS_MODE) && (OPENSSL_VERSION_NUMBER >= 0x00907000L)
24
25#include "acss.h"
26#include "openbsd-compat/openssl-compat.h"
27
28#define data(ctx) ((EVP_ACSS_KEY *)(ctx)->cipher_data)
29
30typedef struct {
31 ACSS_KEY ks;
32} EVP_ACSS_KEY;
33
34#define EVP_CTRL_SET_ACSS_MODE 0xff06
35#define EVP_CTRL_SET_ACSS_SUBKEY 0xff07
36
37static int
38acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
39 const unsigned char *iv, int enc)
40{
41 acss_setkey(&data(ctx)->ks,key,enc,ACSS_DATA);
42 return 1;
43}
44
45static int
46acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
47 LIBCRYPTO_EVP_INL_TYPE inl)
48{
49 acss(&data(ctx)->ks,inl,in,out);
50 return 1;
51}
52
53static int
54acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
55{
56 switch(type) {
57 case EVP_CTRL_SET_ACSS_MODE:
58 data(ctx)->ks.mode = arg;
59 return 1;
60 case EVP_CTRL_SET_ACSS_SUBKEY:
61 acss_setsubkey(&data(ctx)->ks,(unsigned char *)ptr);
62 return 1;
63 default:
64 return -1;
65 }
66}
67
68const EVP_CIPHER *
69evp_acss(void)
70{
71 static EVP_CIPHER acss_cipher;
72
73 memset(&acss_cipher, 0, sizeof(EVP_CIPHER));
74
75 acss_cipher.nid = NID_undef;
76 acss_cipher.block_size = 1;
77 acss_cipher.key_len = 5;
78 acss_cipher.init = acss_init_key;
79 acss_cipher.do_cipher = acss_ciph;
80 acss_cipher.ctx_size = sizeof(EVP_ACSS_KEY);
81 acss_cipher.ctrl = acss_ctrl;
82
83 return (&acss_cipher);
84}
85#endif
86