1 | /* -*- c -*- |
---|
2 | * |
---|
3 | * ---------------------------------------------------------------------- |
---|
4 | * TRI's Simple Stream encryption system implementation |
---|
5 | * ---------------------------------------------------------------------- |
---|
6 | * Created : Fri Apr 14 14:20:00 1995 tri |
---|
7 | * Last modified: Wed Jul 12 21:59:05 1995 ylo |
---|
8 | * ---------------------------------------------------------------------- |
---|
9 | * Copyright (c) 1995 |
---|
10 | * Timo J. Rinne <tri@iki.fi> and Cirion oy. |
---|
11 | * |
---|
12 | * Address: Cirion oy, PO-BOX 250, 00121 HELSINKI, Finland |
---|
13 | * |
---|
14 | * Even though this code is copyrighted property of the author, it can |
---|
15 | * still be used for non-commercial purposes under following conditions: |
---|
16 | * |
---|
17 | * 1) This copyright notice is not removed. |
---|
18 | * 2) Source code follows any distribution of the software |
---|
19 | * if possible. |
---|
20 | * 3) Copyright notice above is found in the documentation |
---|
21 | * of the distributed software. |
---|
22 | * |
---|
23 | * For possibility to use this source code for commercial product, |
---|
24 | * please contact address above. |
---|
25 | * |
---|
26 | * Any express or implied warranties are disclaimed. In no event |
---|
27 | * shall the author be liable for any damages caused (directly or |
---|
28 | * otherwise) by the use of this software. |
---|
29 | * |
---|
30 | * Permission granted to Mr. Tatu Ylonen <ylo@cs.hut.fi> to include this |
---|
31 | * code into SSH (Secure Shell). Permission is granted to anyone to |
---|
32 | * use and distribute this code for any purpose as part of that product. |
---|
33 | * ---------------------------------------------------------------------- |
---|
34 | */ |
---|
35 | #ifndef __TSS_H__ |
---|
36 | #define __TSS_H__ 1 |
---|
37 | |
---|
38 | /* |
---|
39 | * TSS_POOL_BYTES has to be 2^n and even multiple of 16. |
---|
40 | * 16k pool (0x4000) is standard and big enough. |
---|
41 | */ |
---|
42 | #define TSS_POOL_BYTES 0x4000 |
---|
43 | #define TSS_POOL_MASK (TSS_POOL_BYTES - 1) |
---|
44 | /* |
---|
45 | * TSS_SALT_BYTES has to be more than 0x10 but it should not be too big. |
---|
46 | * 0x20 is standard and OK. |
---|
47 | */ |
---|
48 | #define TSS_SALT_BYTES 0x20 |
---|
49 | |
---|
50 | struct tss_context { |
---|
51 | unsigned char key[TSS_POOL_BYTES]; |
---|
52 | unsigned char salt[TSS_SALT_BYTES]; |
---|
53 | int keyidx; |
---|
54 | }; |
---|
55 | |
---|
56 | /* |
---|
57 | * Inits TSS context with given key. |
---|
58 | */ |
---|
59 | int TSS_Init(struct tss_context *context, |
---|
60 | const unsigned char *key, |
---|
61 | int keylen); |
---|
62 | |
---|
63 | /* |
---|
64 | * Encrypts (decrypts) one data block within TSS context. |
---|
65 | */ |
---|
66 | int TSS_Encrypt(struct tss_context *context, |
---|
67 | unsigned char *data, |
---|
68 | unsigned int len); |
---|
69 | int TSS_Decrypt(struct tss_context *context, |
---|
70 | unsigned char *data, |
---|
71 | unsigned int len); |
---|
72 | |
---|
73 | #endif /* not __TSS_H__ */ |
---|
74 | |
---|
75 | /* EOF (tss.h) */ |
---|