1 | /*
|
---|
2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
---|
3 | *
|
---|
4 | * Licensed under the OpenSSL license (the "License"). You may not use
|
---|
5 | * this file except in compliance with the License. You can obtain a copy
|
---|
6 | * in the file LICENSE in the source distribution or at
|
---|
7 | * https://www.openssl.org/source/license.html
|
---|
8 | */
|
---|
9 |
|
---|
10 | /* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */
|
---|
11 | /*-
|
---|
12 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
---|
13 | * unrestricted use provided that this legend is included on all tape
|
---|
14 | * media and as a part of the software program in whole or part. Users
|
---|
15 | * may copy or modify Sun RPC without charge, but are not authorized
|
---|
16 | * to license or distribute it to anyone else except as part of a product or
|
---|
17 | * program developed by the user.
|
---|
18 | *
|
---|
19 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
---|
20 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
---|
21 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
---|
22 | *
|
---|
23 | * Sun RPC is provided with no support and without any obligation on the
|
---|
24 | * part of Sun Microsystems, Inc. to assist in its use, correction,
|
---|
25 | * modification or enhancement.
|
---|
26 | *
|
---|
27 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
---|
28 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
---|
29 | * OR ANY PART THEREOF.
|
---|
30 | *
|
---|
31 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
---|
32 | * or profits or other special, indirect and consequential damages, even if
|
---|
33 | * Sun has been advised of the possibility of such damages.
|
---|
34 | *
|
---|
35 | * Sun Microsystems, Inc.
|
---|
36 | * 2550 Garcia Avenue
|
---|
37 | * Mountain View, California 94043
|
---|
38 | */
|
---|
39 | /*
|
---|
40 | * Generic DES driver interface
|
---|
41 | * Keep this file hardware independent!
|
---|
42 | * Copyright (c) 1986 by Sun Microsystems, Inc.
|
---|
43 | */
|
---|
44 |
|
---|
45 | #define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
|
---|
46 | #define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
|
---|
47 |
|
---|
48 | enum desdir { ENCRYPT, DECRYPT };
|
---|
49 | enum desmode { CBC, ECB };
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * parameters to ioctl call
|
---|
53 | */
|
---|
54 | struct desparams {
|
---|
55 | unsigned char des_key[8]; /* key (with low bit parity) */
|
---|
56 | enum desdir des_dir; /* direction */
|
---|
57 | enum desmode des_mode; /* mode */
|
---|
58 | unsigned char des_ivec[8]; /* input vector */
|
---|
59 | unsigned des_len; /* number of bytes to crypt */
|
---|
60 | union {
|
---|
61 | unsigned char UDES_data[DES_QUICKLEN];
|
---|
62 | unsigned char *UDES_buf;
|
---|
63 | } UDES;
|
---|
64 | #define des_data UDES.UDES_data /* direct data here if quick */
|
---|
65 | #define des_buf UDES.UDES_buf /* otherwise, pointer to data */
|
---|
66 | };
|
---|
67 |
|
---|
68 | /*
|
---|
69 | * Encrypt an arbitrary sized buffer
|
---|
70 | */
|
---|
71 | #define DESIOCBLOCK _IOWR('d', 6, struct desparams)
|
---|
72 |
|
---|
73 | /*
|
---|
74 | * Encrypt of small amount of data, quickly
|
---|
75 | */
|
---|
76 | #define DESIOCQUICK _IOWR('d', 7, struct desparams)
|
---|