1193645Ssimon/* crypto/des/ecb_enc.c */
2193645Ssimon/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3193645Ssimon * All rights reserved.
4193645Ssimon *
5193645Ssimon * This package is an SSL implementation written
6193645Ssimon * by Eric Young (eay@cryptsoft.com).
7193645Ssimon * The implementation was written so as to conform with Netscapes SSL.
8296465Sdelphij *
9193645Ssimon * This library is free for commercial and non-commercial use as long as
10193645Ssimon * the following conditions are aheared to.  The following conditions
11193645Ssimon * apply to all code found in this distribution, be it the RC4, RSA,
12193645Ssimon * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
13193645Ssimon * included with this distribution is covered by the same copyright terms
14193645Ssimon * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15296465Sdelphij *
16193645Ssimon * Copyright remains Eric Young's, and as such any Copyright notices in
17193645Ssimon * the code are not to be removed.
18193645Ssimon * If this package is used in a product, Eric Young should be given attribution
19193645Ssimon * as the author of the parts of the library used.
20193645Ssimon * This can be in the form of a textual message at program startup or
21193645Ssimon * in documentation (online or textual) provided with the package.
22296465Sdelphij *
23193645Ssimon * Redistribution and use in source and binary forms, with or without
24193645Ssimon * modification, are permitted provided that the following conditions
25193645Ssimon * are met:
26193645Ssimon * 1. Redistributions of source code must retain the copyright
27193645Ssimon *    notice, this list of conditions and the following disclaimer.
28193645Ssimon * 2. Redistributions in binary form must reproduce the above copyright
29193645Ssimon *    notice, this list of conditions and the following disclaimer in the
30193645Ssimon *    documentation and/or other materials provided with the distribution.
31193645Ssimon * 3. All advertising materials mentioning features or use of this software
32193645Ssimon *    must display the following acknowledgement:
33193645Ssimon *    "This product includes cryptographic software written by
34193645Ssimon *     Eric Young (eay@cryptsoft.com)"
35193645Ssimon *    The word 'cryptographic' can be left out if the rouines from the library
36193645Ssimon *    being used are not cryptographic related :-).
37296465Sdelphij * 4. If you include any Windows specific code (or a derivative thereof) from
38193645Ssimon *    the apps directory (application code) you must include an acknowledgement:
39193645Ssimon *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40296465Sdelphij *
41193645Ssimon * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42193645Ssimon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43193645Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44193645Ssimon * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45193645Ssimon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46193645Ssimon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47193645Ssimon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48193645Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49193645Ssimon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50193645Ssimon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51193645Ssimon * SUCH DAMAGE.
52296465Sdelphij *
53193645Ssimon * The licence and distribution terms for any publically available version or
54193645Ssimon * derivative of this code cannot be changed.  i.e. this code cannot simply be
55193645Ssimon * copied and put under another distribution licence
56193645Ssimon * [including the GNU Public Licence.]
57193645Ssimon */
58193645Ssimon
59193645Ssimon#include "des_locl.h"
60193645Ssimon#include "des_ver.h"
61193645Ssimon#include <openssl/opensslv.h>
62193645Ssimon#include <openssl/bio.h>
63193645Ssimon
64296465SdelphijOPENSSL_GLOBAL const char libdes_version[] = "libdes" OPENSSL_VERSION_PTEXT;
65296465SdelphijOPENSSL_GLOBAL const char DES_version[] = "DES" OPENSSL_VERSION_PTEXT;
66193645Ssimon
67193645Ssimonconst char *DES_options(void)
68296465Sdelphij{
69296465Sdelphij    static int init = 1;
70296465Sdelphij    static char buf[32];
71193645Ssimon
72296465Sdelphij    if (init) {
73296465Sdelphij        const char *ptr, *unroll, *risc, *size;
74193645Ssimon
75193645Ssimon#ifdef DES_PTR
76296465Sdelphij        ptr = "ptr";
77193645Ssimon#else
78296465Sdelphij        ptr = "idx";
79193645Ssimon#endif
80193645Ssimon#if defined(DES_RISC1) || defined(DES_RISC2)
81296465Sdelphij# ifdef DES_RISC1
82296465Sdelphij        risc = "risc1";
83296465Sdelphij# endif
84296465Sdelphij# ifdef DES_RISC2
85296465Sdelphij        risc = "risc2";
86296465Sdelphij# endif
87193645Ssimon#else
88296465Sdelphij        risc = "cisc";
89193645Ssimon#endif
90193645Ssimon#ifdef DES_UNROLL
91296465Sdelphij        unroll = "16";
92193645Ssimon#else
93296465Sdelphij        unroll = "4";
94193645Ssimon#endif
95296465Sdelphij        if (sizeof(DES_LONG) != sizeof(long))
96296465Sdelphij            size = "int";
97296465Sdelphij        else
98296465Sdelphij            size = "long";
99296465Sdelphij        BIO_snprintf(buf, sizeof buf, "des(%s,%s,%s,%s)", ptr, risc, unroll,
100296465Sdelphij                     size);
101296465Sdelphij        init = 0;
102296465Sdelphij    }
103296465Sdelphij    return (buf);
104296465Sdelphij}
105