summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/conf/cnf_save.c104
-rw-r--r--src/lib/libcrypto/conf/test.c97
-rw-r--r--src/lib/libcrypto/dh/p1024.c92
-rw-r--r--src/lib/libcrypto/dh/p192.c80
-rw-r--r--src/lib/libcrypto/dh/p512.c85
-rw-r--r--src/lib/libcrypto/dsa/dsagen.c111
-rw-r--r--src/lib/libcrypto/evp/evp_pbe.c24
-rw-r--r--src/lib/libcrypto/evp/p5_crpt2.c11
-rw-r--r--src/lib/libcrypto/lhash/lh_test.c88
-rw-r--r--src/lib/libcrypto/md4/md4.c125
-rw-r--r--src/lib/libcrypto/md5/md5.c125
-rw-r--r--src/lib/libcrypto/mdc2/mdc2dgst.c21
-rw-r--r--src/lib/libcrypto/o_time.c50
-rw-r--r--src/lib/libcrypto/objects/obj_xref.c28
-rw-r--r--src/lib/libcrypto/pkcs7/dec.c248
-rw-r--r--src/lib/libcrypto/pkcs7/enc.c174
-rw-r--r--src/lib/libcrypto/pkcs7/sign.c151
-rw-r--r--src/lib/libcrypto/pkcs7/verify.c260
-rw-r--r--src/lib/libcrypto/rc5/rc5speed.c201
-rw-r--r--src/lib/libcrypto/rc5/rc5test.c384
-rw-r--r--src/lib/libcrypto/ripemd/rmd160.c125
-rw-r--r--src/lib/libcrypto/x509v3/tabtest.c92
-rw-r--r--src/lib/libcrypto/x509v3/v3conf.c131
-rw-r--r--src/lib/libcrypto/x509v3/v3prin.c100
-rw-r--r--src/lib/libssl/src/crypto/conf/cnf_save.c104
-rw-r--r--src/lib/libssl/src/crypto/conf/test.c97
-rw-r--r--src/lib/libssl/src/crypto/dh/p1024.c92
-rw-r--r--src/lib/libssl/src/crypto/dh/p192.c80
-rw-r--r--src/lib/libssl/src/crypto/dh/p512.c85
-rw-r--r--src/lib/libssl/src/crypto/dsa/dsagen.c111
-rw-r--r--src/lib/libssl/src/crypto/evp/evp_pbe.c24
-rw-r--r--src/lib/libssl/src/crypto/evp/p5_crpt2.c11
-rw-r--r--src/lib/libssl/src/crypto/lhash/lh_test.c88
-rw-r--r--src/lib/libssl/src/crypto/md4/md4.c125
-rw-r--r--src/lib/libssl/src/crypto/md5/md5.c125
-rw-r--r--src/lib/libssl/src/crypto/mdc2/mdc2dgst.c21
-rw-r--r--src/lib/libssl/src/crypto/o_time.c50
-rw-r--r--src/lib/libssl/src/crypto/objects/obj_xref.c28
-rw-r--r--src/lib/libssl/src/crypto/pkcs7/dec.c248
-rw-r--r--src/lib/libssl/src/crypto/pkcs7/enc.c174
-rw-r--r--src/lib/libssl/src/crypto/pkcs7/sign.c151
-rw-r--r--src/lib/libssl/src/crypto/pkcs7/verify.c260
-rw-r--r--src/lib/libssl/src/crypto/rc5/rc5speed.c201
-rw-r--r--src/lib/libssl/src/crypto/rc5/rc5test.c384
-rw-r--r--src/lib/libssl/src/crypto/ripemd/rmd160.c125
-rw-r--r--src/lib/libssl/src/crypto/x509v3/tabtest.c92
-rw-r--r--src/lib/libssl/src/crypto/x509v3/v3conf.c131
-rw-r--r--src/lib/libssl/src/crypto/x509v3/v3prin.c100
48 files changed, 0 insertions, 5814 deletions
diff --git a/src/lib/libcrypto/conf/cnf_save.c b/src/lib/libcrypto/conf/cnf_save.c
deleted file mode 100644
index 46d71e5e43..0000000000
--- a/src/lib/libcrypto/conf/cnf_save.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* crypto/conf/cnf_save.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/conf.h>
61
62static void print_conf(CONF_VALUE *cv);
63static IMPLEMENT_LHASH_DOALL_FN(print_conf, CONF_VALUE *);
64
65main()
66{
67 LHASH *conf;
68 long l;
69
70 conf = CONF_load(NULL, "../../apps/openssl.cnf", &l);
71 if (conf == NULL) {
72 fprintf(stderr, "error loading config, line %ld\n", l);
73 exit(1);
74 }
75
76 lh_doall(conf, LHASH_DOALL_FN(print_conf));
77}
78
79static void
80print_conf(CONF_VALUE *cv)
81{
82 int i;
83 CONF_VALUE *v;
84 char *section;
85 char *name;
86 char *value;
87 STACK *s;
88
89 /* If it is a single entry, return */
90 if (cv->name != NULL)
91 return;
92
93 printf("[ %s ]\n", cv->section);
94 s = (STACK *)cv->value;
95
96 for (i = 0; i < sk_num(s); i++) {
97 v = (CONF_VALUE *)sk_value(s, i);
98 section = (v->section == NULL) ? "None" : v->section;
99 name = (v->name == NULL) ? "None" : v->name;
100 value = (v->value == NULL) ? "None" : v->value;
101 printf("%s=%s\n", name, value);
102 }
103 printf("\n");
104}
diff --git a/src/lib/libcrypto/conf/test.c b/src/lib/libcrypto/conf/test.c
deleted file mode 100644
index c22071152c..0000000000
--- a/src/lib/libcrypto/conf/test.c
+++ /dev/null
@@ -1,97 +0,0 @@
1/* crypto/conf/test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/conf.h>
62#include <openssl/err.h>
63
64main()
65{
66 LHASH *conf;
67 long eline;
68 char *s, *s2;
69
70#ifdef USE_WIN32
71 CONF_set_default_method(CONF_WIN32);
72#endif
73 conf = CONF_load(NULL, "ssleay.cnf", &eline);
74 if (conf == NULL) {
75 ERR_load_crypto_strings();
76 printf("unable to load configuration, line %ld\n", eline);
77 ERR_print_errors_fp(stderr);
78 exit(1);
79 }
80 lh_stats(conf, stdout);
81 lh_node_stats(conf, stdout);
82 lh_node_usage_stats(conf, stdout);
83
84 s = CONF_get_string(conf,NULL, "init2");
85 printf("init2=%s\n", (s == NULL) ? "NULL" : s);
86
87 s = CONF_get_string(conf, NULL, "cipher1");
88 printf("cipher1=%s\n", (s == NULL) ? "NULL" : s);
89
90 s = CONF_get_string(conf, "s_client", "cipher1");
91 printf("s_client:cipher1=%s\n", (s == NULL) ? "NULL" : s);
92
93 printf("---------------------------- DUMP ------------------------\n");
94 CONF_dump_fp(conf, stdout);
95
96 exit(0);
97}
diff --git a/src/lib/libcrypto/dh/p1024.c b/src/lib/libcrypto/dh/p1024.c
deleted file mode 100644
index 368ceca4eb..0000000000
--- a/src/lib/libcrypto/dh/p1024.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/* crypto/dh/p1024.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={0x97,0xF6,0x42,0x61,0xCA,0xB5,0x05,0xDD,
66 0x28,0x28,0xE1,0x3F,0x1D,0x68,0xB6,0xD3,
67 0xDB,0xD0,0xF3,0x13,0x04,0x7F,0x40,0xE8,
68 0x56,0xDA,0x58,0xCB,0x13,0xB8,0xA1,0xBF,
69 0x2B,0x78,0x3A,0x4C,0x6D,0x59,0xD5,0xF9,
70 0x2A,0xFC,0x6C,0xFF,0x3D,0x69,0x3F,0x78,
71 0xB2,0x3D,0x4F,0x31,0x60,0xA9,0x50,0x2E,
72 0x3E,0xFA,0xF7,0xAB,0x5E,0x1A,0xD5,0xA6,
73 0x5E,0x55,0x43,0x13,0x82,0x8D,0xA8,0x3B,
74 0x9F,0xF2,0xD9,0x41,0xDE,0xE9,0x56,0x89,
75 0xFA,0xDA,0xEA,0x09,0x36,0xAD,0xDF,0x19,
76 0x71,0xFE,0x63,0x5B,0x20,0xAF,0x47,0x03,
77 0x64,0x60,0x3C,0x2D,0xE0,0x59,0xF5,0x4B,
78 0x65,0x0A,0xD8,0xFA,0x0C,0xF7,0x01,0x21,
79 0xC7,0x47,0x99,0xD7,0x58,0x71,0x32,0xBE,
80 0x9B,0x99,0x9B,0xB9,0xB7,0x87,0xE8,0xAB,
81 };
82
83main()
84 {
85 DH *dh;
86
87 dh=DH_new();
88 dh->p=BN_bin2bn(data,sizeof(data),NULL);
89 dh->g=BN_new();
90 BN_set_word(dh->g,2);
91 PEM_write_DHparams(stdout,dh);
92 }
diff --git a/src/lib/libcrypto/dh/p192.c b/src/lib/libcrypto/dh/p192.c
deleted file mode 100644
index 7bdf40410e..0000000000
--- a/src/lib/libcrypto/dh/p192.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/* crypto/dh/p192.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={
660xD4,0xA0,0xBA,0x02,0x50,0xB6,0xFD,0x2E,
670xC6,0x26,0xE7,0xEF,0xD6,0x37,0xDF,0x76,
680xC7,0x16,0xE2,0x2D,0x09,0x44,0xB8,0x8B,
69 };
70
71main()
72 {
73 DH *dh;
74
75 dh=DH_new();
76 dh->p=BN_bin2bn(data,sizeof(data),NULL);
77 dh->g=BN_new();
78 BN_set_word(dh->g,3);
79 PEM_write_DHparams(stdout,dh);
80 }
diff --git a/src/lib/libcrypto/dh/p512.c b/src/lib/libcrypto/dh/p512.c
deleted file mode 100644
index a9b6aa83f0..0000000000
--- a/src/lib/libcrypto/dh/p512.c
+++ /dev/null
@@ -1,85 +0,0 @@
1/* crypto/dh/p512.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={
660xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,
670xD0,0xE4,0xAF,0x75,0x6F,0x4C,0xCA,0x92,
680xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F,
690xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,
700x57,0x46,0x50,0xD3,0x69,0x99,0xDB,0x29,
710xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12,
720xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,
730xD8,0x00,0x3E,0x7C,0x47,0x74,0xE8,0x33,
74 };
75
76main()
77 {
78 DH *dh;
79
80 dh=DH_new();
81 dh->p=BN_bin2bn(data,sizeof(data),NULL);
82 dh->g=BN_new();
83 BN_set_word(dh->g,2);
84 PEM_write_DHparams(stdout,dh);
85 }
diff --git a/src/lib/libcrypto/dsa/dsagen.c b/src/lib/libcrypto/dsa/dsagen.c
deleted file mode 100644
index 1b6a1cca0f..0000000000
--- a/src/lib/libcrypto/dsa/dsagen.c
+++ /dev/null
@@ -1,111 +0,0 @@
1/* crypto/dsa/dsagen.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/dsa.h>
61
62#define TEST
63#define GENUINE_DSA
64
65#ifdef GENUINE_DSA
66#define LAST_VALUE 0xbd
67#else
68#define LAST_VALUE 0xd3
69#endif
70
71#ifdef TEST
72unsigned char seed[20]={
73 0xd5,0x01,0x4e,0x4b,
74 0x60,0xef,0x2b,0xa8,
75 0xb6,0x21,0x1b,0x40,
76 0x62,0xba,0x32,0x24,
77 0xe0,0x42,0x7d,LAST_VALUE};
78#endif
79
80int cb(int p, int n)
81 {
82 char c='*';
83
84 if (p == 0) c='.';
85 if (p == 1) c='+';
86 if (p == 2) c='*';
87 if (p == 3) c='\n';
88 printf("%c",c);
89 fflush(stdout);
90 }
91
92main()
93 {
94 int i;
95 BIGNUM *n;
96 BN_CTX *ctx;
97 unsigned char seed_buf[20];
98 DSA *dsa;
99 int counter,h;
100 BIO *bio_err=NULL;
101
102 if (bio_err == NULL)
103 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
104
105 memcpy(seed_buf,seed,20);
106 dsa=DSA_generate_parameters(1024,seed,20,&counter,&h,cb,bio_err);
107
108 if (dsa == NULL)
109 DSA_print(bio_err,dsa,0);
110 }
111
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c
index 779c1592da..dc8b5f51fc 100644
--- a/src/lib/libcrypto/evp/evp_pbe.c
+++ b/src/lib/libcrypto/evp/evp_pbe.c
@@ -111,30 +111,6 @@ static const EVP_PBE_CTL builtin_pbe[] = {
111 {EVP_PBE_TYPE_PRF, NID_id_HMACGostR3411_94, -1, NID_id_GostR3411_94, 0}, 111 {EVP_PBE_TYPE_PRF, NID_id_HMACGostR3411_94, -1, NID_id_GostR3411_94, 0},
112}; 112};
113 113
114#ifdef TEST
115int
116main(int argc, char **argv)
117{
118 int i, nid_md, nid_cipher;
119 EVP_PBE_CTL *tpbe, *tpbe2;
120 /*OpenSSL_add_all_algorithms();*/
121
122 for (i = 0; i < sizeof(builtin_pbe) / sizeof(EVP_PBE_CTL); i++) {
123 tpbe = builtin_pbe + i;
124 fprintf(stderr, "%d %d %s ", tpbe->pbe_type, tpbe->pbe_nid,
125 OBJ_nid2sn(tpbe->pbe_nid));
126 if (EVP_PBE_find(tpbe->pbe_type, tpbe->pbe_nid,
127 &nid_cipher , &nid_md, 0))
128 fprintf(stderr, "Found %s %s\n",
129 OBJ_nid2sn(nid_cipher), OBJ_nid2sn(nid_md));
130 else
131 fprintf(stderr, "Find ERROR!!\n");
132 }
133
134 return 0;
135}
136#endif
137
138int 114int
139EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, 115EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
140 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de) 116 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)
diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c
index c276cd28b8..ca68ac0d94 100644
--- a/src/lib/libcrypto/evp/p5_crpt2.c
+++ b/src/lib/libcrypto/evp/p5_crpt2.c
@@ -166,17 +166,6 @@ PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, const unsigned char *salt,
166 EVP_sha1(), keylen, out); 166 EVP_sha1(), keylen, out);
167} 167}
168 168
169#ifdef DO_TEST
170main()
171{
172 unsigned char out[4];
173 unsigned char salt[] = {0x12, 0x34, 0x56, 0x78};
174 PKCS5_PBKDF2_HMAC_SHA1("password", -1, salt, 4, 5, 4, out);
175 fprintf(stderr, "Out %02X %02X %02X %02X\n",
176 out[0], out[1], out[2], out[3]);
177}
178#endif
179
180/* Now the key derivation function itself. This is a bit evil because 169/* Now the key derivation function itself. This is a bit evil because
181 * it has to check the ASN1 parameters are valid: and there are quite a 170 * it has to check the ASN1 parameters are valid: and there are quite a
182 * few of them... 171 * few of them...
diff --git a/src/lib/libcrypto/lhash/lh_test.c b/src/lib/libcrypto/lhash/lh_test.c
deleted file mode 100644
index 6167be383f..0000000000
--- a/src/lib/libcrypto/lhash/lh_test.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/* crypto/lhash/lh_test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <openssl/lhash.h>
63
64main()
65{
66 LHASH *conf;
67 char buf[256];
68 int i;
69
70 conf = lh_new(lh_strhash, strcmp);
71 for (;;) {
72 char *p;
73
74 buf[0] = '\0';
75 fgets(buf, 256, stdin);
76 if (buf[0] == '\0')
77 break;
78 i = strlen(buf);
79 p = malloc(i + 1);
80 memcpy(p, buf, i + 1);
81 lh_insert(conf, p);
82 }
83
84 lh_node_stats(conf, stdout);
85 lh_stats(conf, stdout);
86 lh_node_usage_stats(conf, stdout);
87 exit(0);
88}
diff --git a/src/lib/libcrypto/md4/md4.c b/src/lib/libcrypto/md4/md4.c
deleted file mode 100644
index 1b78f667f1..0000000000
--- a/src/lib/libcrypto/md4/md4.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/* crypto/md4/md4.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <unistd.h>
60#include <stdio.h>
61#include <stdlib.h>
62#include <openssl/md4.h>
63
64#define BUFSIZE 1024*16
65
66void do_fp(FILE *f);
67void pt(unsigned char *md);
68
69int main(int argc, char **argv)
70 {
71 int i,err=0;
72 FILE *IN;
73
74 if (argc == 1)
75 {
76 do_fp(stdin);
77 }
78 else
79 {
80 for (i=1; i<argc; i++)
81 {
82 IN=fopen(argv[i],"r");
83 if (IN == NULL)
84 {
85 perror(argv[i]);
86 err++;
87 continue;
88 }
89 printf("MD4(%s)= ",argv[i]);
90 do_fp(IN);
91 fclose(IN);
92 }
93 }
94 exit(err);
95 }
96
97void do_fp(FILE *f)
98 {
99 MD4_CTX c;
100 unsigned char md[MD4_DIGEST_LENGTH];
101 int fd;
102 int i;
103 static unsigned char buf[BUFSIZE];
104
105 fd=fileno(f);
106 MD4_Init(&c);
107 for (;;)
108 {
109 i=read(fd,buf,sizeof buf);
110 if (i <= 0) break;
111 MD4_Update(&c,buf,(unsigned long)i);
112 }
113 MD4_Final(&(md[0]),&c);
114 pt(md);
115 }
116
117void pt(unsigned char *md)
118 {
119 int i;
120
121 for (i=0; i<MD4_DIGEST_LENGTH; i++)
122 printf("%02x",md[i]);
123 printf("\n");
124 }
125
diff --git a/src/lib/libcrypto/md5/md5.c b/src/lib/libcrypto/md5/md5.c
deleted file mode 100644
index 3f6ec0791e..0000000000
--- a/src/lib/libcrypto/md5/md5.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/* crypto/md5/md5.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <unistd.h>
60#include <stdio.h>
61#include <stdlib.h>
62#include <openssl/md5.h>
63
64#define BUFSIZE 1024*16
65
66void do_fp(FILE *f);
67void pt(unsigned char *md);
68
69int main(int argc, char **argv)
70 {
71 int i,err=0;
72 FILE *IN;
73
74 if (argc == 1)
75 {
76 do_fp(stdin);
77 }
78 else
79 {
80 for (i=1; i<argc; i++)
81 {
82 IN=fopen(argv[i],"r");
83 if (IN == NULL)
84 {
85 perror(argv[i]);
86 err++;
87 continue;
88 }
89 printf("MD5(%s)= ",argv[i]);
90 do_fp(IN);
91 fclose(IN);
92 }
93 }
94 exit(err);
95 }
96
97void do_fp(FILE *f)
98 {
99 MD5_CTX c;
100 unsigned char md[MD5_DIGEST_LENGTH];
101 int fd;
102 int i;
103 static unsigned char buf[BUFSIZE];
104
105 fd=fileno(f);
106 MD5_Init(&c);
107 for (;;)
108 {
109 i=read(fd,buf,BUFSIZE);
110 if (i <= 0) break;
111 MD5_Update(&c,buf,(unsigned long)i);
112 }
113 MD5_Final(&(md[0]),&c);
114 pt(md);
115 }
116
117void pt(unsigned char *md)
118 {
119 int i;
120
121 for (i=0; i<MD5_DIGEST_LENGTH; i++)
122 printf("%02x",md[i]);
123 printf("\n");
124 }
125
diff --git a/src/lib/libcrypto/mdc2/mdc2dgst.c b/src/lib/libcrypto/mdc2/mdc2dgst.c
index 302f9ab9a8..d6ce1451a1 100644
--- a/src/lib/libcrypto/mdc2/mdc2dgst.c
+++ b/src/lib/libcrypto/mdc2/mdc2dgst.c
@@ -177,24 +177,3 @@ int MDC2_Final(unsigned char *md, MDC2_CTX *c)
177 memcpy(&(md[MDC2_BLOCK]),(char *)c->hh,MDC2_BLOCK); 177 memcpy(&(md[MDC2_BLOCK]),(char *)c->hh,MDC2_BLOCK);
178 return 1; 178 return 1;
179 } 179 }
180
181#undef TEST
182
183#ifdef TEST
184main()
185 {
186 unsigned char md[MDC2_DIGEST_LENGTH];
187 int i;
188 MDC2_CTX c;
189 static char *text="Now is the time for all ";
190
191 MDC2_Init(&c);
192 MDC2_Update(&c,text,strlen(text));
193 MDC2_Final(&(md[0]),&c);
194
195 for (i=0; i<MDC2_DIGEST_LENGTH; i++)
196 printf("%02X",md[i]);
197 printf("\n");
198 }
199
200#endif
diff --git a/src/lib/libcrypto/o_time.c b/src/lib/libcrypto/o_time.c
index 45bfce742e..a963b0d120 100644
--- a/src/lib/libcrypto/o_time.c
+++ b/src/lib/libcrypto/o_time.c
@@ -159,53 +159,3 @@ julian_to_date(long jd, int *y, int *m, int *d)
159 *m = j + 2 - (12 * L); 159 *m = j + 2 - (12 * L);
160 *y = 100 * (n - 49) + i + L; 160 *y = 100 * (n - 49) + i + L;
161} 161}
162
163#ifdef OPENSSL_TIME_TEST
164
165#include <stdio.h>
166
167/* Time checking test code. Check times are identical for a wide range of
168 * offsets. This should be run on a machine with 64 bit time_t or it will
169 * trigger the very errors the routines fix.
170 */
171
172int
173main(int argc, char **argv)
174{
175 long offset;
176 for (offset = 0; offset < 1000000; offset++) {
177 check_time(offset);
178 check_time(-offset);
179 check_time(offset * 1000);
180 check_time(-offset * 1000);
181 }
182}
183
184int
185check_time(long offset)
186{
187 struct tm tm1, tm2;
188 time_t t1, t2;
189 time(&t1);
190 t2 = t1 + offset;
191 gmtime_r(&t2, &tm2);
192 gmtime_r(&t1, &tm1);
193 OPENSSL_gmtime_adj(&tm1, 0, offset);
194 if ((tm1.tm_year == tm2.tm_year) &&
195 (tm1.tm_mon == tm2.tm_mon) &&
196 (tm1.tm_mday == tm2.tm_mday) &&
197 (tm1.tm_hour == tm2.tm_hour) &&
198 (tm1.tm_min == tm2.tm_min) &&
199 (tm1.tm_sec == tm2.tm_sec))
200 return 1;
201 fprintf(stderr, "TIME ERROR!!\n");
202 fprintf(stderr, "Time1: %d/%d/%d, %d:%02d:%02d\n",
203 tm2.tm_mday, tm2.tm_mon + 1, tm2.tm_year + 1900,
204 tm2.tm_hour, tm2.tm_min, tm2.tm_sec);
205 fprintf(stderr, "Time2: %d/%d/%d, %d:%02d:%02d\n",
206 tm1.tm_mday, tm1.tm_mon + 1, tm1.tm_year + 1900,
207 tm1.tm_hour, tm1.tm_min, tm1.tm_sec);
208 return 0;
209}
210
211#endif
diff --git a/src/lib/libcrypto/objects/obj_xref.c b/src/lib/libcrypto/objects/obj_xref.c
index 2c1631e773..34cfeeb92c 100644
--- a/src/lib/libcrypto/objects/obj_xref.c
+++ b/src/lib/libcrypto/objects/obj_xref.c
@@ -203,31 +203,3 @@ OBJ_sigid_free(void)
203 sigx_app = NULL; 203 sigx_app = NULL;
204 } 204 }
205} 205}
206
207#ifdef OBJ_XREF_TEST
208
209main()
210{
211 int n1, n2, n3;
212
213 int i, rv;
214#ifdef OBJ_XREF_TEST2
215 for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) {
216 OBJ_add_sigid(sigoid_srt[i][0], sigoid_srt[i][1],
217 sigoid_srt[i][2]);
218 }
219#endif
220
221 for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) {
222 n1 = sigoid_srt[i][0];
223 rv = OBJ_find_sigid_algs(n1, &n2, &n3);
224 printf("Forward: %d, %s %s %s\n", rv,
225 OBJ_nid2ln(n1), OBJ_nid2ln(n2), OBJ_nid2ln(n3));
226 n1 = 0;
227 rv = OBJ_find_sigid_by_algs(&n1, n2, n3);
228 printf("Reverse: %d, %s %s %s\n", rv,
229 OBJ_nid2ln(n1), OBJ_nid2ln(n2), OBJ_nid2ln(n3));
230 }
231}
232
233#endif
diff --git a/src/lib/libcrypto/pkcs7/dec.c b/src/lib/libcrypto/pkcs7/dec.c
deleted file mode 100644
index 6752ec568a..0000000000
--- a/src/lib/libcrypto/pkcs7/dec.c
+++ /dev/null
@@ -1,248 +0,0 @@
1/* crypto/pkcs7/verify.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <stdlib.h>
60#include <string.h>
61#include <openssl/bio.h>
62#include <openssl/x509.h>
63#include <openssl/pem.h>
64#include <openssl/err.h>
65#include <openssl/asn1.h>
66
67int verify_callback(int ok, X509_STORE_CTX *ctx);
68
69BIO *bio_err=NULL;
70
71int main(argc,argv)
72int argc;
73char *argv[];
74 {
75 char *keyfile=NULL;
76 BIO *in;
77 EVP_PKEY *pkey;
78 X509 *x509;
79 PKCS7 *p7;
80 PKCS7_SIGNER_INFO *si;
81 X509_STORE_CTX cert_ctx;
82 X509_STORE *cert_store=NULL;
83 BIO *data,*detached=NULL,*p7bio=NULL;
84 char buf[1024*4];
85 unsigned char *pp;
86 int i,printit=0;
87 STACK_OF(PKCS7_SIGNER_INFO) *sk;
88
89 OpenSSL_add_all_algorithms();
90 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
91
92 data=BIO_new(BIO_s_file());
93 pp=NULL;
94 while (argc > 1)
95 {
96 argc--;
97 argv++;
98 if (strcmp(argv[0],"-p") == 0)
99 {
100 printit=1;
101 }
102 else if ((strcmp(argv[0],"-k") == 0) && (argc >= 2)) {
103 keyfile = argv[1];
104 argc-=1;
105 argv+=1;
106 } else if ((strcmp(argv[0],"-d") == 0) && (argc >= 2))
107 {
108 detached=BIO_new(BIO_s_file());
109 if (!BIO_read_filename(detached,argv[1]))
110 goto err;
111 argc-=1;
112 argv+=1;
113 }
114 else break;
115 }
116
117 if (!BIO_read_filename(data,argv[0])) goto err;
118
119 if(!keyfile) {
120 fprintf(stderr, "No private key file specified\n");
121 goto err;
122 }
123
124 if ((in=BIO_new_file(keyfile,"r")) == NULL) goto err;
125 if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err;
126 BIO_reset(in);
127 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL)
128 goto err;
129 BIO_free(in);
130
131 if (pp == NULL)
132 BIO_set_fp(data,stdin,BIO_NOCLOSE);
133
134
135 /* Load the PKCS7 object from a file */
136 if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err;
137
138
139
140 /* This stuff is being setup for certificate verification.
141 * When using SSL, it could be replaced with a
142 * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */
143 cert_store=X509_STORE_new();
144 X509_STORE_set_default_paths(cert_store);
145 X509_STORE_load_locations(cert_store,NULL,"../../certs");
146 X509_STORE_set_verify_cb_func(cert_store,verify_callback);
147
148 ERR_clear_error();
149
150 /* We need to process the data */
151 /* We cannot support detached encryption */
152 p7bio=PKCS7_dataDecode(p7,pkey,detached,x509);
153
154 if (p7bio == NULL)
155 {
156 printf("problems decoding\n");
157 goto err;
158 }
159
160 /* We now have to 'read' from p7bio to calculate digests etc. */
161 for (;;)
162 {
163 i=BIO_read(p7bio,buf,sizeof(buf));
164 /* print it? */
165 if (i <= 0) break;
166 fwrite(buf,1, i, stdout);
167 }
168
169 /* We can now verify signatures */
170 sk=PKCS7_get_signer_info(p7);
171 if (sk == NULL)
172 {
173 fprintf(stderr, "there are no signatures on this data\n");
174 }
175 else
176 {
177 /* Ok, first we need to, for each subject entry,
178 * see if we can verify */
179 ERR_clear_error();
180 for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++)
181 {
182 si=sk_PKCS7_SIGNER_INFO_value(sk,i);
183 i=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si);
184 if (i <= 0)
185 goto err;
186 else
187 fprintf(stderr,"Signature verified\n");
188 }
189 }
190 X509_STORE_free(cert_store);
191
192 exit(0);
193err:
194 ERR_load_crypto_strings();
195 ERR_print_errors_fp(stderr);
196 exit(1);
197 }
198
199/* should be X509 * but we can just have them as char *. */
200int verify_callback(int ok, X509_STORE_CTX *ctx)
201 {
202 char buf[256];
203 X509 *err_cert;
204 int err,depth;
205
206 err_cert=X509_STORE_CTX_get_current_cert(ctx);
207 err= X509_STORE_CTX_get_error(ctx);
208 depth= X509_STORE_CTX_get_error_depth(ctx);
209
210 X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
211 BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
212 if (!ok)
213 {
214 BIO_printf(bio_err,"verify error:num=%d:%s\n",err,
215 X509_verify_cert_error_string(err));
216 if (depth < 6)
217 {
218 ok=1;
219 X509_STORE_CTX_set_error(ctx,X509_V_OK);
220 }
221 else
222 {
223 ok=0;
224 X509_STORE_CTX_set_error(ctx,X509_V_ERR_CERT_CHAIN_TOO_LONG);
225 }
226 }
227 switch (ctx->error)
228 {
229 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
230 X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256);
231 BIO_printf(bio_err,"issuer= %s\n",buf);
232 break;
233 case X509_V_ERR_CERT_NOT_YET_VALID:
234 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
235 BIO_printf(bio_err,"notBefore=");
236 ASN1_UTCTIME_print(bio_err,X509_get_notBefore(ctx->current_cert));
237 BIO_printf(bio_err,"\n");
238 break;
239 case X509_V_ERR_CERT_HAS_EXPIRED:
240 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
241 BIO_printf(bio_err,"notAfter=");
242 ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ctx->current_cert));
243 BIO_printf(bio_err,"\n");
244 break;
245 }
246 BIO_printf(bio_err,"verify return:%d\n",ok);
247 return(ok);
248 }
diff --git a/src/lib/libcrypto/pkcs7/enc.c b/src/lib/libcrypto/pkcs7/enc.c
deleted file mode 100644
index 7417f8a4e0..0000000000
--- a/src/lib/libcrypto/pkcs7/enc.c
+++ /dev/null
@@ -1,174 +0,0 @@
1/* crypto/pkcs7/enc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/x509.h>
62#include <openssl/pem.h>
63#include <openssl/err.h>
64
65int main(argc,argv)
66int argc;
67char *argv[];
68 {
69 X509 *x509;
70 PKCS7 *p7;
71 BIO *in;
72 BIO *data,*p7bio;
73 char buf[1024*4];
74 int i;
75 int nodetach=1;
76 char *keyfile = NULL;
77 const EVP_CIPHER *cipher=NULL;
78 STACK_OF(X509) *recips=NULL;
79
80 OpenSSL_add_all_algorithms();
81
82 data=BIO_new(BIO_s_file());
83 while(argc > 1)
84 {
85 if (strcmp(argv[1],"-nd") == 0)
86 {
87 nodetach=1;
88 argv++; argc--;
89 }
90 else if ((strcmp(argv[1],"-c") == 0) && (argc >= 2)) {
91 if(!(cipher = EVP_get_cipherbyname(argv[2]))) {
92 fprintf(stderr, "Unknown cipher %s\n", argv[2]);
93 goto err;
94 }
95 argc-=2;
96 argv+=2;
97 } else if ((strcmp(argv[1],"-k") == 0) && (argc >= 2)) {
98 keyfile = argv[2];
99 argc-=2;
100 argv+=2;
101 if (!(in=BIO_new_file(keyfile,"r"))) goto err;
102 if (!(x509=PEM_read_bio_X509(in,NULL,NULL,NULL)))
103 goto err;
104 if(!recips) recips = sk_X509_new_null();
105 sk_X509_push(recips, x509);
106 BIO_free(in);
107 } else break;
108 }
109
110 if(!recips) {
111 fprintf(stderr, "No recipients\n");
112 goto err;
113 }
114
115 if (!BIO_read_filename(data,argv[1])) goto err;
116
117 p7=PKCS7_new();
118#if 0
119 BIO_reset(in);
120 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL)) == NULL) goto err;
121 BIO_free(in);
122 PKCS7_set_type(p7,NID_pkcs7_signedAndEnveloped);
123
124 if (PKCS7_add_signature(p7,x509,pkey,EVP_sha1()) == NULL) goto err;
125 /* we may want to add more */
126 PKCS7_add_certificate(p7,x509);
127#else
128 PKCS7_set_type(p7,NID_pkcs7_enveloped);
129#endif
130 if(!cipher) {
131#ifndef OPENSSL_NO_DES
132 cipher = EVP_des_ede3_cbc();
133#else
134 fprintf(stderr, "No cipher selected\n");
135 goto err;
136#endif
137 }
138
139 if (!PKCS7_set_cipher(p7,cipher)) goto err;
140 for(i = 0; i < sk_X509_num(recips); i++) {
141 if (!PKCS7_add_recipient(p7,sk_X509_value(recips, i))) goto err;
142 }
143 sk_X509_pop_free(recips, X509_free);
144
145 /* Set the content of the signed to 'data' */
146 /* PKCS7_content_new(p7,NID_pkcs7_data); not used in envelope */
147
148 /* could be used, but not in this version :-)
149 if (!nodetach) PKCS7_set_detached(p7,1);
150 */
151
152 if ((p7bio=PKCS7_dataInit(p7,NULL)) == NULL) goto err;
153
154 for (;;)
155 {
156 i=BIO_read(data,buf,sizeof(buf));
157 if (i <= 0) break;
158 BIO_write(p7bio,buf,i);
159 }
160 BIO_flush(p7bio);
161
162 if (!PKCS7_dataFinal(p7,p7bio)) goto err;
163 BIO_free(p7bio);
164
165 PEM_write_PKCS7(stdout,p7);
166 PKCS7_free(p7);
167
168 exit(0);
169err:
170 ERR_load_crypto_strings();
171 ERR_print_errors_fp(stderr);
172 exit(1);
173 }
174
diff --git a/src/lib/libcrypto/pkcs7/sign.c b/src/lib/libcrypto/pkcs7/sign.c
deleted file mode 100644
index 43168514f9..0000000000
--- a/src/lib/libcrypto/pkcs7/sign.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/* crypto/pkcs7/sign.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/x509.h>
62#include <openssl/pem.h>
63#include <openssl/err.h>
64
65int main(argc,argv)
66int argc;
67char *argv[];
68 {
69 X509 *x509;
70 EVP_PKEY *pkey;
71 PKCS7 *p7;
72 PKCS7_SIGNER_INFO *si;
73 BIO *in;
74 BIO *data,*p7bio;
75 char buf[1024*4];
76 int i;
77 int nodetach=0;
78
79#ifndef OPENSSL_NO_MD5
80 EVP_add_digest(EVP_md5());
81#endif
82#ifndef OPENSSL_NO_SHA1
83 EVP_add_digest(EVP_sha1());
84#endif
85#ifndef OPENSSL_NO_MDC2
86 EVP_add_digest(EVP_mdc2());
87#endif
88
89 data=BIO_new(BIO_s_file());
90again:
91 if (argc > 1)
92 {
93 if (strcmp(argv[1],"-nd") == 0)
94 {
95 nodetach=1;
96 argv++; argc--;
97 goto again;
98 }
99 if (!BIO_read_filename(data,argv[1]))
100 goto err;
101 }
102 else
103 BIO_set_fp(data,stdin,BIO_NOCLOSE);
104
105 if ((in=BIO_new_file("server.pem","r")) == NULL) goto err;
106 if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err;
107 BIO_reset(in);
108 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL) goto err;
109 BIO_free(in);
110
111 p7=PKCS7_new();
112 PKCS7_set_type(p7,NID_pkcs7_signed);
113
114 si=PKCS7_add_signature(p7,x509,pkey,EVP_sha1());
115 if (si == NULL) goto err;
116
117 /* If you do this then you get signing time automatically added */
118 PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT,
119 OBJ_nid2obj(NID_pkcs7_data));
120
121 /* we may want to add more */
122 PKCS7_add_certificate(p7,x509);
123
124 /* Set the content of the signed to 'data' */
125 PKCS7_content_new(p7,NID_pkcs7_data);
126
127 if (!nodetach)
128 PKCS7_set_detached(p7,1);
129
130 if ((p7bio=PKCS7_dataInit(p7,NULL)) == NULL) goto err;
131
132 for (;;)
133 {
134 i=BIO_read(data,buf,sizeof(buf));
135 if (i <= 0) break;
136 BIO_write(p7bio,buf,i);
137 }
138
139 if (!PKCS7_dataFinal(p7,p7bio)) goto err;
140 BIO_free(p7bio);
141
142 PEM_write_PKCS7(stdout,p7);
143 PKCS7_free(p7);
144
145 exit(0);
146err:
147 ERR_load_crypto_strings();
148 ERR_print_errors_fp(stderr);
149 exit(1);
150 }
151
diff --git a/src/lib/libcrypto/pkcs7/verify.c b/src/lib/libcrypto/pkcs7/verify.c
deleted file mode 100644
index 414f985dc2..0000000000
--- a/src/lib/libcrypto/pkcs7/verify.c
+++ /dev/null
@@ -1,260 +0,0 @@
1/* crypto/pkcs7/verify.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/asn1.h>
62#include <openssl/x509.h>
63#include <openssl/pem.h>
64#include <openssl/err.h>
65#include "example.h"
66
67int verify_callback(int ok, X509_STORE_CTX *ctx);
68
69BIO *bio_err=NULL;
70BIO *bio_out=NULL;
71
72int main(argc,argv)
73int argc;
74char *argv[];
75 {
76 PKCS7 *p7;
77 PKCS7_SIGNER_INFO *si;
78 X509_STORE_CTX cert_ctx;
79 X509_STORE *cert_store=NULL;
80 BIO *data,*detached=NULL,*p7bio=NULL;
81 char buf[1024*4];
82 char *pp;
83 int i,printit=0;
84 STACK_OF(PKCS7_SIGNER_INFO) *sk;
85
86 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
87 bio_out=BIO_new_fp(stdout,BIO_NOCLOSE);
88#ifndef OPENSSL_NO_MD5
89 EVP_add_digest(EVP_md5());
90#endif
91#ifndef OPENSSL_NO_SHA1
92 EVP_add_digest(EVP_sha1());
93#endif
94#ifndef OPENSSL_NO_MDC2
95 EVP_add_digest(EVP_mdc2());
96#endif
97
98 data=BIO_new(BIO_s_file());
99
100 pp=NULL;
101 while (argc > 1)
102 {
103 argc--;
104 argv++;
105 if (strcmp(argv[0],"-p") == 0)
106 {
107 printit=1;
108 }
109 else if ((strcmp(argv[0],"-d") == 0) && (argc >= 2))
110 {
111 detached=BIO_new(BIO_s_file());
112 if (!BIO_read_filename(detached,argv[1]))
113 goto err;
114 argc--;
115 argv++;
116 }
117 else
118 {
119 pp=argv[0];
120 if (!BIO_read_filename(data,argv[0]))
121 goto err;
122 }
123 }
124
125 if (pp == NULL)
126 BIO_set_fp(data,stdin,BIO_NOCLOSE);
127
128
129 /* Load the PKCS7 object from a file */
130 if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err;
131
132 /* This stuff is being setup for certificate verification.
133 * When using SSL, it could be replaced with a
134 * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */
135 cert_store=X509_STORE_new();
136 X509_STORE_set_default_paths(cert_store);
137 X509_STORE_load_locations(cert_store,NULL,"../../certs");
138 X509_STORE_set_verify_cb_func(cert_store,verify_callback);
139
140 ERR_clear_error();
141
142 /* We need to process the data */
143 if ((PKCS7_get_detached(p7) || detached))
144 {
145 if (detached == NULL)
146 {
147 printf("no data to verify the signature on\n");
148 exit(1);
149 }
150 else
151 p7bio=PKCS7_dataInit(p7,detached);
152 }
153 else
154 {
155 p7bio=PKCS7_dataInit(p7,NULL);
156 }
157
158 /* We now have to 'read' from p7bio to calculate digests etc. */
159 for (;;)
160 {
161 i=BIO_read(p7bio,buf,sizeof(buf));
162 /* print it? */
163 if (i <= 0) break;
164 }
165
166 /* We can now verify signatures */
167 sk=PKCS7_get_signer_info(p7);
168 if (sk == NULL)
169 {
170 printf("there are no signatures on this data\n");
171 exit(1);
172 }
173
174 /* Ok, first we need to, for each subject entry, see if we can verify */
175 for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++)
176 {
177 ASN1_UTCTIME *tm;
178 char *str1,*str2;
179 int rc;
180
181 si=sk_PKCS7_SIGNER_INFO_value(sk,i);
182 rc=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si);
183 if (rc <= 0)
184 goto err;
185 printf("signer info\n");
186 if ((tm=get_signed_time(si)) != NULL)
187 {
188 BIO_printf(bio_out,"Signed time:");
189 ASN1_UTCTIME_print(bio_out,tm);
190 ASN1_UTCTIME_free(tm);
191 BIO_printf(bio_out,"\n");
192 }
193 if (get_signed_seq2string(si,&str1,&str2))
194 {
195 BIO_printf(bio_out,"String 1 is %s\n",str1);
196 BIO_printf(bio_out,"String 2 is %s\n",str2);
197 }
198
199 }
200
201 X509_STORE_free(cert_store);
202
203 printf("done\n");
204 exit(0);
205err:
206 ERR_load_crypto_strings();
207 ERR_print_errors_fp(stderr);
208 exit(1);
209 }
210
211/* should be X509 * but we can just have them as char *. */
212int verify_callback(int ok, X509_STORE_CTX *ctx)
213 {
214 char buf[256];
215 X509 *err_cert;
216 int err,depth;
217
218 err_cert=X509_STORE_CTX_get_current_cert(ctx);
219 err= X509_STORE_CTX_get_error(ctx);
220 depth= X509_STORE_CTX_get_error_depth(ctx);
221
222 X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
223 BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
224 if (!ok)
225 {
226 BIO_printf(bio_err,"verify error:num=%d:%s\n",err,
227 X509_verify_cert_error_string(err));
228 if (depth < 6)
229 {
230 ok=1;
231 X509_STORE_CTX_set_error(ctx,X509_V_OK);
232 }
233 else
234 {
235 ok=0;
236 X509_STORE_CTX_set_error(ctx,X509_V_ERR_CERT_CHAIN_TOO_LONG);
237 }
238 }
239 switch (ctx->error)
240 {
241 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
242 X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256);
243 BIO_printf(bio_err,"issuer= %s\n",buf);
244 break;
245 case X509_V_ERR_CERT_NOT_YET_VALID:
246 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
247 BIO_printf(bio_err,"notBefore=");
248 ASN1_UTCTIME_print(bio_err,X509_get_notBefore(ctx->current_cert));
249 BIO_printf(bio_err,"\n");
250 break;
251 case X509_V_ERR_CERT_HAS_EXPIRED:
252 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
253 BIO_printf(bio_err,"notAfter=");
254 ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ctx->current_cert));
255 BIO_printf(bio_err,"\n");
256 break;
257 }
258 BIO_printf(bio_err,"verify return:%d\n",ok);
259 return(ok);
260 }
diff --git a/src/lib/libcrypto/rc5/rc5speed.c b/src/lib/libcrypto/rc5/rc5speed.c
deleted file mode 100644
index b5a8c285da..0000000000
--- a/src/lib/libcrypto/rc5/rc5speed.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/* crypto/rc5/rc5speed.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#include <sys/types.h>
63#include <sys/times.h>
64
65#include <signal.h>
66#include <stdio.h>
67#include <stdlib.h>
68#include <time.h>
69#include <unistd.h>
70
71#include <openssl/rc5.h>
72
73#define HZ ((double)CLK_TCK)
74
75#define BUFSIZE ((long)1024)
76long run=0;
77
78double Time_F(int s);
79
80void sig_done(int sig);
81void sig_done(int sig)
82 {
83 signal(SIGALRM,sig_done);
84 run=0;
85 }
86
87#define START 0
88#define STOP 1
89
90double Time_F(int s)
91 {
92 double ret;
93 static struct tms tstart,tend;
94
95 if (s == START)
96 {
97 times(&tstart);
98 return(0);
99 }
100 else
101 {
102 times(&tend);
103 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
104 return((ret == 0.0)?1e-6:ret);
105 }
106 }
107
108int main(int argc, char **argv)
109 {
110 long count;
111 static unsigned char buf[BUFSIZE];
112 static unsigned char key[] ={
113 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
114 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
115 };
116 RC5_32_KEY sch;
117 double a,b,c,d;
118#ifndef SIGALRM
119 long ca,cb,cc;
120#endif
121
122#ifndef TIMES
123 printf("To get the most accurate results, try to run this\n");
124 printf("program when this computer is idle.\n");
125#endif
126
127#ifndef SIGALRM
128 printf("First we calculate the approximate speed ...\n");
129 RC5_32_set_key(&sch,16,key,12);
130 count=10;
131 do {
132 long i;
133 unsigned long data[2];
134
135 count*=2;
136 Time_F(START);
137 for (i=count; i; i--)
138 RC5_32_encrypt(data,&sch);
139 d=Time_F(STOP);
140 } while (d < 3.0);
141 ca=count/512;
142 cb=count;
143 cc=count*8/BUFSIZE+1;
144 printf("Doing RC5_32_set_key %ld times\n",ca);
145#define COND(d) (count != (d))
146#define COUNT(d) (d)
147#else
148#define COND(c) (run)
149#define COUNT(d) (count)
150 signal(SIGALRM,sig_done);
151 printf("Doing RC5_32_set_key for 10 seconds\n");
152 alarm(10);
153#endif
154
155 Time_F(START);
156 for (count=0,run=1; COND(ca); count+=4)
157 {
158 RC5_32_set_key(&sch,16,key,12);
159 RC5_32_set_key(&sch,16,key,12);
160 RC5_32_set_key(&sch,16,key,12);
161 RC5_32_set_key(&sch,16,key,12);
162 }
163 d=Time_F(STOP);
164 printf("%ld RC5_32_set_key's in %.2f seconds\n",count,d);
165 a=((double)COUNT(ca))/d;
166
167 printf("Doing RC5_32_encrypt's for 10 seconds\n");
168 alarm(10);
169
170 Time_F(START);
171 for (count=0,run=1; COND(cb); count+=4)
172 {
173 unsigned long data[2];
174
175 RC5_32_encrypt(data,&sch);
176 RC5_32_encrypt(data,&sch);
177 RC5_32_encrypt(data,&sch);
178 RC5_32_encrypt(data,&sch);
179 }
180 d=Time_F(STOP);
181 printf("%ld RC5_32_encrypt's in %.2f second\n",count,d);
182 b=((double)COUNT(cb)*8)/d;
183
184 printf("Doing RC5_32_cbc_encrypt on %ld byte blocks for 10 seconds\n",
185 BUFSIZE);
186 alarm(10);
187
188 Time_F(START);
189 for (count=0,run=1; COND(cc); count++)
190 RC5_32_cbc_encrypt(buf,buf,BUFSIZE,&sch,
191 &(key[0]),RC5_ENCRYPT);
192 d=Time_F(STOP);
193 printf("%ld RC5_32_cbc_encrypt's of %ld byte blocks in %.2f second\n",
194 count,BUFSIZE,d);
195 c=((double)COUNT(cc)*BUFSIZE)/d;
196
197 printf("RC5_32/12/16 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
198 printf("RC5_32/12/16 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
199 printf("RC5_32/12/16 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
200 exit(0);
201 }
diff --git a/src/lib/libcrypto/rc5/rc5test.c b/src/lib/libcrypto/rc5/rc5test.c
deleted file mode 100644
index 1a0260ee1d..0000000000
--- a/src/lib/libcrypto/rc5/rc5test.c
+++ /dev/null
@@ -1,384 +0,0 @@
1/* crypto/rc5/rc5test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* This has been a quickly hacked 'ideatest.c'. When I add tests for other
60 * RC5 modes, more of the code will be uncommented. */
61
62#include <stdio.h>
63#include <string.h>
64#include <stdlib.h>
65
66#ifdef OPENSSL_NO_RC5
67int main(int argc, char *argv[])
68{
69 printf("No RC5 support\n");
70 return(0);
71}
72#else
73#include <openssl/rc5.h>
74
75static unsigned char RC5key[5][16]={
76 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
77 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
78 {0x91,0x5f,0x46,0x19,0xbe,0x41,0xb2,0x51,
79 0x63,0x55,0xa5,0x01,0x10,0xa9,0xce,0x91},
80 {0x78,0x33,0x48,0xe7,0x5a,0xeb,0x0f,0x2f,
81 0xd7,0xb1,0x69,0xbb,0x8d,0xc1,0x67,0x87},
82 {0xdc,0x49,0xdb,0x13,0x75,0xa5,0x58,0x4f,
83 0x64,0x85,0xb4,0x13,0xb5,0xf1,0x2b,0xaf},
84 {0x52,0x69,0xf1,0x49,0xd4,0x1b,0xa0,0x15,
85 0x24,0x97,0x57,0x4d,0x7f,0x15,0x31,0x25},
86 };
87
88static unsigned char RC5plain[5][8]={
89 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
90 {0x21,0xA5,0xDB,0xEE,0x15,0x4B,0x8F,0x6D},
91 {0xF7,0xC0,0x13,0xAC,0x5B,0x2B,0x89,0x52},
92 {0x2F,0x42,0xB3,0xB7,0x03,0x69,0xFC,0x92},
93 {0x65,0xC1,0x78,0xB2,0x84,0xD1,0x97,0xCC},
94 };
95
96static unsigned char RC5cipher[5][8]={
97 {0x21,0xA5,0xDB,0xEE,0x15,0x4B,0x8F,0x6D},
98 {0xF7,0xC0,0x13,0xAC,0x5B,0x2B,0x89,0x52},
99 {0x2F,0x42,0xB3,0xB7,0x03,0x69,0xFC,0x92},
100 {0x65,0xC1,0x78,0xB2,0x84,0xD1,0x97,0xCC},
101 {0xEB,0x44,0xE4,0x15,0xDA,0x31,0x98,0x24},
102 };
103
104#define RC5_CBC_NUM 27
105static unsigned char rc5_cbc_cipher[RC5_CBC_NUM][8]={
106 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1e},
107 {0x79,0x7b,0xba,0x4d,0x78,0x11,0x1d,0x1e},
108 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1f},
109 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1f},
110 {0x8b,0x9d,0xed,0x91,0xce,0x77,0x94,0xa6},
111 {0x2f,0x75,0x9f,0xe7,0xad,0x86,0xa3,0x78},
112 {0xdc,0xa2,0x69,0x4b,0xf4,0x0e,0x07,0x88},
113 {0xdc,0xa2,0x69,0x4b,0xf4,0x0e,0x07,0x88},
114 {0xdc,0xfe,0x09,0x85,0x77,0xec,0xa5,0xff},
115 {0x96,0x46,0xfb,0x77,0x63,0x8f,0x9c,0xa8},
116 {0xb2,0xb3,0x20,0x9d,0xb6,0x59,0x4d,0xa4},
117 {0x54,0x5f,0x7f,0x32,0xa5,0xfc,0x38,0x36},
118 {0x82,0x85,0xe7,0xc1,0xb5,0xbc,0x74,0x02},
119 {0xfc,0x58,0x6f,0x92,0xf7,0x08,0x09,0x34},
120 {0xcf,0x27,0x0e,0xf9,0x71,0x7f,0xf7,0xc4},
121 {0xe4,0x93,0xf1,0xc1,0xbb,0x4d,0x6e,0x8c},
122 {0x5c,0x4c,0x04,0x1e,0x0f,0x21,0x7a,0xc3},
123 {0x92,0x1f,0x12,0x48,0x53,0x73,0xb4,0xf7},
124 {0x5b,0xa0,0xca,0x6b,0xbe,0x7f,0x5f,0xad},
125 {0xc5,0x33,0x77,0x1c,0xd0,0x11,0x0e,0x63},
126 {0x29,0x4d,0xdb,0x46,0xb3,0x27,0x8d,0x60},
127 {0xda,0xd6,0xbd,0xa9,0xdf,0xe8,0xf7,0xe8},
128 {0x97,0xe0,0x78,0x78,0x37,0xed,0x31,0x7f},
129 {0x78,0x75,0xdb,0xf6,0x73,0x8c,0x64,0x78},
130 {0x8f,0x34,0xc3,0xc6,0x81,0xc9,0x96,0x95},
131 {0x7c,0xb3,0xf1,0xdf,0x34,0xf9,0x48,0x11},
132 {0x7f,0xd1,0xa0,0x23,0xa5,0xbb,0xa2,0x17},
133 };
134
135static unsigned char rc5_cbc_key[RC5_CBC_NUM][17]={
136 { 1,0x00},
137 { 1,0x00},
138 { 1,0x00},
139 { 1,0x00},
140 { 1,0x00},
141 { 1,0x11},
142 { 1,0x00},
143 { 4,0x00,0x00,0x00,0x00},
144 { 1,0x00},
145 { 1,0x00},
146 { 1,0x00},
147 { 1,0x00},
148 { 4,0x01,0x02,0x03,0x04},
149 { 4,0x01,0x02,0x03,0x04},
150 { 4,0x01,0x02,0x03,0x04},
151 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
152 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
153 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
154 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
155 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
156 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
157 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
158 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
159 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
160 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
161 { 5,0x01,0x02,0x03,0x04,0x05},
162 { 5,0x01,0x02,0x03,0x04,0x05},
163 { 5,0x01,0x02,0x03,0x04,0x05},
164 { 5,0x01,0x02,0x03,0x04,0x05},
165 { 5,0x01,0x02,0x03,0x04,0x05},
166 };
167
168static unsigned char rc5_cbc_plain[RC5_CBC_NUM][8]={
169 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
170 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
171 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
172 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
173 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
174 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
175 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
176 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
177 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
178 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
179 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
180 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
181 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
182 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
183 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
184 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
185 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
186 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
187 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
188 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
189 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
190 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
191 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
192 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
193 {0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},
194 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
195 {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x01},
196 };
197
198static int rc5_cbc_rounds[RC5_CBC_NUM]={
199 0, 0, 0, 0, 0, 1, 2, 2,
200 8, 8,12,16, 8,12,16,12,
201 8,12,16, 8,12,16,12, 8,
202 8, 8, 8,
203 };
204
205static unsigned char rc5_cbc_iv[RC5_CBC_NUM][8]={
206 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
207 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
208 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
209 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
210 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
211 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
212 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
213 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
214 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
215 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
216 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
217 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
218 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
219 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
220 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
221 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
222 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
223 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
224 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
225 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
226 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
227 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
228 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
229 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
230 {0x78,0x75,0xdb,0xf6,0x73,0x8c,0x64,0x78},
231 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
232 {0x7c,0xb3,0xf1,0xdf,0x34,0xf9,0x48,0x11},
233 };
234
235int main(int argc, char *argv[])
236 {
237 int i,n,err=0;
238 RC5_32_KEY key;
239 unsigned char buf[8],buf2[8],ivb[8];
240
241 for (n=0; n<5; n++)
242 {
243 RC5_32_set_key(&key,16,&(RC5key[n][0]),12);
244
245 RC5_32_ecb_encrypt(&(RC5plain[n][0]),buf,&key,RC5_ENCRYPT);
246 if (memcmp(&(RC5cipher[n][0]),buf,8) != 0)
247 {
248 printf("ecb RC5 error encrypting (%d)\n",n+1);
249 printf("got :");
250 for (i=0; i<8; i++)
251 printf("%02X ",buf[i]);
252 printf("\n");
253 printf("expected:");
254 for (i=0; i<8; i++)
255 printf("%02X ",RC5cipher[n][i]);
256 err=20;
257 printf("\n");
258 }
259
260 RC5_32_ecb_encrypt(buf,buf2,&key,RC5_DECRYPT);
261 if (memcmp(&(RC5plain[n][0]),buf2,8) != 0)
262 {
263 printf("ecb RC5 error decrypting (%d)\n",n+1);
264 printf("got :");
265 for (i=0; i<8; i++)
266 printf("%02X ",buf2[i]);
267 printf("\n");
268 printf("expected:");
269 for (i=0; i<8; i++)
270 printf("%02X ",RC5plain[n][i]);
271 printf("\n");
272 err=3;
273 }
274 }
275 if (err == 0) printf("ecb RC5 ok\n");
276
277 for (n=0; n<RC5_CBC_NUM; n++)
278 {
279 i=rc5_cbc_rounds[n];
280 if (i < 8) continue;
281
282 RC5_32_set_key(&key,rc5_cbc_key[n][0],&(rc5_cbc_key[n][1]),i);
283
284 memcpy(ivb,&(rc5_cbc_iv[n][0]),8);
285 RC5_32_cbc_encrypt(&(rc5_cbc_plain[n][0]),buf,8,
286 &key,&(ivb[0]),RC5_ENCRYPT);
287
288 if (memcmp(&(rc5_cbc_cipher[n][0]),buf,8) != 0)
289 {
290 printf("cbc RC5 error encrypting (%d)\n",n+1);
291 printf("got :");
292 for (i=0; i<8; i++)
293 printf("%02X ",buf[i]);
294 printf("\n");
295 printf("expected:");
296 for (i=0; i<8; i++)
297 printf("%02X ",rc5_cbc_cipher[n][i]);
298 err=30;
299 printf("\n");
300 }
301
302 memcpy(ivb,&(rc5_cbc_iv[n][0]),8);
303 RC5_32_cbc_encrypt(buf,buf2,8,
304 &key,&(ivb[0]),RC5_DECRYPT);
305 if (memcmp(&(rc5_cbc_plain[n][0]),buf2,8) != 0)
306 {
307 printf("cbc RC5 error decrypting (%d)\n",n+1);
308 printf("got :");
309 for (i=0; i<8; i++)
310 printf("%02X ",buf2[i]);
311 printf("\n");
312 printf("expected:");
313 for (i=0; i<8; i++)
314 printf("%02X ",rc5_cbc_plain[n][i]);
315 printf("\n");
316 err=3;
317 }
318 }
319 if (err == 0) printf("cbc RC5 ok\n");
320
321 EXIT(err);
322 return(err);
323 }
324
325#ifdef undef
326static int cfb64_test(unsigned char *cfb_cipher)
327 {
328 IDEA_KEY_SCHEDULE eks,dks;
329 int err=0,i,n;
330
331 idea_set_encrypt_key(cfb_key,&eks);
332 idea_set_decrypt_key(&eks,&dks);
333 memcpy(cfb_tmp,cfb_iv,8);
334 n=0;
335 idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks,
336 cfb_tmp,&n,IDEA_ENCRYPT);
337 idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
338 (long)CFB_TEST_SIZE-12,&eks,
339 cfb_tmp,&n,IDEA_ENCRYPT);
340 if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0)
341 {
342 err=1;
343 printf("idea_cfb64_encrypt encrypt error\n");
344 for (i=0; i<CFB_TEST_SIZE; i+=8)
345 printf("%s\n",pt(&(cfb_buf1[i])));
346 }
347 memcpy(cfb_tmp,cfb_iv,8);
348 n=0;
349 idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks,
350 cfb_tmp,&n,IDEA_DECRYPT);
351 idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
352 (long)CFB_TEST_SIZE-17,&dks,
353 cfb_tmp,&n,IDEA_DECRYPT);
354 if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0)
355 {
356 err=1;
357 printf("idea_cfb_encrypt decrypt error\n");
358 for (i=0; i<24; i+=8)
359 printf("%s\n",pt(&(cfb_buf2[i])));
360 }
361 return(err);
362 }
363
364static char *pt(unsigned char *p)
365 {
366 static char bufs[10][20];
367 static int bnum=0;
368 char *ret;
369 int i;
370 static char *f="0123456789ABCDEF";
371
372 ret= &(bufs[bnum++][0]);
373 bnum%=10;
374 for (i=0; i<8; i++)
375 {
376 ret[i*2]=f[(p[i]>>4)&0xf];
377 ret[i*2+1]=f[p[i]&0xf];
378 }
379 ret[16]='\0';
380 return(ret);
381 }
382
383#endif
384#endif
diff --git a/src/lib/libcrypto/ripemd/rmd160.c b/src/lib/libcrypto/ripemd/rmd160.c
deleted file mode 100644
index d0bc59d03c..0000000000
--- a/src/lib/libcrypto/ripemd/rmd160.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/* crypto/ripemd/rmd160.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <unistd.h>
60#include <stdio.h>
61#include <stdlib.h>
62#include <openssl/ripemd.h>
63
64#define BUFSIZE 1024*16
65
66void do_fp(FILE *f);
67void pt(unsigned char *md);
68
69int main(int argc, char **argv)
70 {
71 int i,err=0;
72 FILE *IN;
73
74 if (argc == 1)
75 {
76 do_fp(stdin);
77 }
78 else
79 {
80 for (i=1; i<argc; i++)
81 {
82 IN=fopen(argv[i],"r");
83 if (IN == NULL)
84 {
85 perror(argv[i]);
86 err++;
87 continue;
88 }
89 printf("RIPEMD160(%s)= ",argv[i]);
90 do_fp(IN);
91 fclose(IN);
92 }
93 }
94 exit(err);
95 }
96
97void do_fp(FILE *f)
98 {
99 RIPEMD160_CTX c;
100 unsigned char md[RIPEMD160_DIGEST_LENGTH];
101 int fd;
102 int i;
103 static unsigned char buf[BUFSIZE];
104
105 fd=fileno(f);
106 RIPEMD160_Init(&c);
107 for (;;)
108 {
109 i=read(fd,buf,BUFSIZE);
110 if (i <= 0) break;
111 RIPEMD160_Update(&c,buf,(unsigned long)i);
112 }
113 RIPEMD160_Final(&(md[0]),&c);
114 pt(md);
115 }
116
117void pt(unsigned char *md)
118 {
119 int i;
120
121 for (i=0; i<RIPEMD160_DIGEST_LENGTH; i++)
122 printf("%02x",md[i]);
123 printf("\n");
124 }
125
diff --git a/src/lib/libcrypto/x509v3/tabtest.c b/src/lib/libcrypto/x509v3/tabtest.c
deleted file mode 100644
index 6b8a211e5d..0000000000
--- a/src/lib/libcrypto/x509v3/tabtest.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/* tabtest.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59/* Simple program to check the ext_dat.h is correct and print out
60 * problems if it is not.
61 */
62
63#include <stdio.h>
64
65#include <openssl/x509v3.h>
66
67#include "ext_dat.h"
68
69main()
70{
71 int i, prev = -1, bad = 0;
72 X509V3_EXT_METHOD **tmp;
73
74 i = sizeof(standard_exts) / sizeof(X509V3_EXT_METHOD *);
75 if (i != STANDARD_EXTENSION_COUNT)
76 fprintf(stderr, "Extension number invalid expecting %d\n", i);
77 tmp = standard_exts;
78 for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) {
79 if ((*tmp)->ext_nid < prev)
80 bad = 1;
81 prev = (*tmp)->ext_nid;
82
83 }
84 if (bad) {
85 tmp = standard_exts;
86 fprintf(stderr, "Extensions out of order!\n");
87 for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++)
88 printf("%d : %s\n", (*tmp)->ext_nid,
89 OBJ_nid2sn((*tmp)->ext_nid));
90 } else
91 fprintf(stderr, "Order OK\n");
92}
diff --git a/src/lib/libcrypto/x509v3/v3conf.c b/src/lib/libcrypto/x509v3/v3conf.c
deleted file mode 100644
index cfa5fce75c..0000000000
--- a/src/lib/libcrypto/x509v3/v3conf.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/* v3conf.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stdio.h>
61#include "cryptlib.h"
62#include <openssl/asn1.h>
63#include <openssl/conf.h>
64#include <openssl/x509.h>
65#include <openssl/x509v3.h>
66
67/* Test application to add extensions from a config file */
68
69int
70main(int argc, char **argv)
71{
72 LHASH *conf;
73 X509 *cert;
74 FILE *inf;
75 char *conf_file;
76 int i;
77 int count;
78 X509_EXTENSION *ext;
79
80 X509V3_add_standard_extensions();
81 ERR_load_crypto_strings();
82 if (!argv[1]) {
83 fprintf(stderr, "Usage: v3conf cert.pem [file.cnf]\n");
84 exit(1);
85 }
86 conf_file = argv[2];
87 if (!conf_file)
88 conf_file = "test.cnf";
89 conf = CONF_load(NULL, "test.cnf", NULL);
90 if (!conf) {
91 fprintf(stderr, "Error opening Config file %s\n", conf_file);
92 ERR_print_errors_fp(stderr);
93 exit(1);
94 }
95
96 inf = fopen(argv[1], "r");
97 if (!inf) {
98 fprintf(stderr, "Can't open certificate file %s\n", argv[1]);
99 exit(1);
100 }
101 cert = PEM_read_X509(inf, NULL, NULL);
102 if (!cert) {
103 fprintf(stderr, "Error reading certificate file %s\n", argv[1]);
104 exit(1);
105 }
106 fclose(inf);
107
108 sk_pop_free(cert->cert_info->extensions, X509_EXTENSION_free);
109 cert->cert_info->extensions = NULL;
110
111 if (!X509V3_EXT_add_conf(conf, NULL, "test_section", cert)) {
112 fprintf(stderr, "Error adding extensions\n");
113 ERR_print_errors_fp(stderr);
114 exit(1);
115 }
116
117 count = X509_get_ext_count(cert);
118 printf("%d extensions\n", count);
119 for (i = 0; i < count; i++) {
120 ext = X509_get_ext(cert, i);
121 printf("%s", OBJ_nid2ln(OBJ_obj2nid(ext->object)));
122 if (ext->critical)
123 printf(",critical:\n");
124 else
125 printf(":\n");
126 X509V3_EXT_print_fp(stdout, ext, 0, 0);
127 printf("\n");
128
129 }
130 return 0;
131}
diff --git a/src/lib/libcrypto/x509v3/v3prin.c b/src/lib/libcrypto/x509v3/v3prin.c
deleted file mode 100644
index da701de132..0000000000
--- a/src/lib/libcrypto/x509v3/v3prin.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/* v3prin.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include <openssl/asn1.h>
61#include <openssl/conf.h>
62#include <openssl/x509.h>
63#include <openssl/x509v3.h>
64
65int
66main(int argc, char **argv)
67{
68 X509 *cert;
69 FILE *inf;
70 int i, count;
71 X509_EXTENSION *ext;
72
73 X509V3_add_standard_extensions();
74 ERR_load_crypto_strings();
75 if (!argv[1]) {
76 fprintf(stderr, "Usage v3prin cert.pem\n");
77 exit(1);
78 }
79 if (!(inf = fopen(argv[1], "r"))) {
80 fprintf(stderr, "Can't open %s\n", argv[1]);
81 exit(1);
82 }
83 if (!(cert = PEM_read_X509(inf, NULL, NULL))) {
84 fprintf(stderr, "Can't read certificate %s\n", argv[1]);
85 ERR_print_errors_fp(stderr);
86 exit(1);
87 }
88 fclose(inf);
89 count = X509_get_ext_count(cert);
90 printf("%d extensions\n", count);
91 for (i = 0; i < count; i++) {
92 ext = X509_get_ext(cert, i);
93 printf("%s\n", OBJ_nid2ln(OBJ_obj2nid(ext->object)));
94 if (!X509V3_EXT_print_fp(stdout, ext, 0, 0))
95 ERR_print_errors_fp(stderr);
96 printf("\n");
97
98 }
99 return 0;
100}
diff --git a/src/lib/libssl/src/crypto/conf/cnf_save.c b/src/lib/libssl/src/crypto/conf/cnf_save.c
deleted file mode 100644
index 46d71e5e43..0000000000
--- a/src/lib/libssl/src/crypto/conf/cnf_save.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* crypto/conf/cnf_save.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/conf.h>
61
62static void print_conf(CONF_VALUE *cv);
63static IMPLEMENT_LHASH_DOALL_FN(print_conf, CONF_VALUE *);
64
65main()
66{
67 LHASH *conf;
68 long l;
69
70 conf = CONF_load(NULL, "../../apps/openssl.cnf", &l);
71 if (conf == NULL) {
72 fprintf(stderr, "error loading config, line %ld\n", l);
73 exit(1);
74 }
75
76 lh_doall(conf, LHASH_DOALL_FN(print_conf));
77}
78
79static void
80print_conf(CONF_VALUE *cv)
81{
82 int i;
83 CONF_VALUE *v;
84 char *section;
85 char *name;
86 char *value;
87 STACK *s;
88
89 /* If it is a single entry, return */
90 if (cv->name != NULL)
91 return;
92
93 printf("[ %s ]\n", cv->section);
94 s = (STACK *)cv->value;
95
96 for (i = 0; i < sk_num(s); i++) {
97 v = (CONF_VALUE *)sk_value(s, i);
98 section = (v->section == NULL) ? "None" : v->section;
99 name = (v->name == NULL) ? "None" : v->name;
100 value = (v->value == NULL) ? "None" : v->value;
101 printf("%s=%s\n", name, value);
102 }
103 printf("\n");
104}
diff --git a/src/lib/libssl/src/crypto/conf/test.c b/src/lib/libssl/src/crypto/conf/test.c
deleted file mode 100644
index c22071152c..0000000000
--- a/src/lib/libssl/src/crypto/conf/test.c
+++ /dev/null
@@ -1,97 +0,0 @@
1/* crypto/conf/test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/conf.h>
62#include <openssl/err.h>
63
64main()
65{
66 LHASH *conf;
67 long eline;
68 char *s, *s2;
69
70#ifdef USE_WIN32
71 CONF_set_default_method(CONF_WIN32);
72#endif
73 conf = CONF_load(NULL, "ssleay.cnf", &eline);
74 if (conf == NULL) {
75 ERR_load_crypto_strings();
76 printf("unable to load configuration, line %ld\n", eline);
77 ERR_print_errors_fp(stderr);
78 exit(1);
79 }
80 lh_stats(conf, stdout);
81 lh_node_stats(conf, stdout);
82 lh_node_usage_stats(conf, stdout);
83
84 s = CONF_get_string(conf,NULL, "init2");
85 printf("init2=%s\n", (s == NULL) ? "NULL" : s);
86
87 s = CONF_get_string(conf, NULL, "cipher1");
88 printf("cipher1=%s\n", (s == NULL) ? "NULL" : s);
89
90 s = CONF_get_string(conf, "s_client", "cipher1");
91 printf("s_client:cipher1=%s\n", (s == NULL) ? "NULL" : s);
92
93 printf("---------------------------- DUMP ------------------------\n");
94 CONF_dump_fp(conf, stdout);
95
96 exit(0);
97}
diff --git a/src/lib/libssl/src/crypto/dh/p1024.c b/src/lib/libssl/src/crypto/dh/p1024.c
deleted file mode 100644
index 368ceca4eb..0000000000
--- a/src/lib/libssl/src/crypto/dh/p1024.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/* crypto/dh/p1024.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={0x97,0xF6,0x42,0x61,0xCA,0xB5,0x05,0xDD,
66 0x28,0x28,0xE1,0x3F,0x1D,0x68,0xB6,0xD3,
67 0xDB,0xD0,0xF3,0x13,0x04,0x7F,0x40,0xE8,
68 0x56,0xDA,0x58,0xCB,0x13,0xB8,0xA1,0xBF,
69 0x2B,0x78,0x3A,0x4C,0x6D,0x59,0xD5,0xF9,
70 0x2A,0xFC,0x6C,0xFF,0x3D,0x69,0x3F,0x78,
71 0xB2,0x3D,0x4F,0x31,0x60,0xA9,0x50,0x2E,
72 0x3E,0xFA,0xF7,0xAB,0x5E,0x1A,0xD5,0xA6,
73 0x5E,0x55,0x43,0x13,0x82,0x8D,0xA8,0x3B,
74 0x9F,0xF2,0xD9,0x41,0xDE,0xE9,0x56,0x89,
75 0xFA,0xDA,0xEA,0x09,0x36,0xAD,0xDF,0x19,
76 0x71,0xFE,0x63,0x5B,0x20,0xAF,0x47,0x03,
77 0x64,0x60,0x3C,0x2D,0xE0,0x59,0xF5,0x4B,
78 0x65,0x0A,0xD8,0xFA,0x0C,0xF7,0x01,0x21,
79 0xC7,0x47,0x99,0xD7,0x58,0x71,0x32,0xBE,
80 0x9B,0x99,0x9B,0xB9,0xB7,0x87,0xE8,0xAB,
81 };
82
83main()
84 {
85 DH *dh;
86
87 dh=DH_new();
88 dh->p=BN_bin2bn(data,sizeof(data),NULL);
89 dh->g=BN_new();
90 BN_set_word(dh->g,2);
91 PEM_write_DHparams(stdout,dh);
92 }
diff --git a/src/lib/libssl/src/crypto/dh/p192.c b/src/lib/libssl/src/crypto/dh/p192.c
deleted file mode 100644
index 7bdf40410e..0000000000
--- a/src/lib/libssl/src/crypto/dh/p192.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/* crypto/dh/p192.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={
660xD4,0xA0,0xBA,0x02,0x50,0xB6,0xFD,0x2E,
670xC6,0x26,0xE7,0xEF,0xD6,0x37,0xDF,0x76,
680xC7,0x16,0xE2,0x2D,0x09,0x44,0xB8,0x8B,
69 };
70
71main()
72 {
73 DH *dh;
74
75 dh=DH_new();
76 dh->p=BN_bin2bn(data,sizeof(data),NULL);
77 dh->g=BN_new();
78 BN_set_word(dh->g,3);
79 PEM_write_DHparams(stdout,dh);
80 }
diff --git a/src/lib/libssl/src/crypto/dh/p512.c b/src/lib/libssl/src/crypto/dh/p512.c
deleted file mode 100644
index a9b6aa83f0..0000000000
--- a/src/lib/libssl/src/crypto/dh/p512.c
+++ /dev/null
@@ -1,85 +0,0 @@
1/* crypto/dh/p512.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={
660xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,
670xD0,0xE4,0xAF,0x75,0x6F,0x4C,0xCA,0x92,
680xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F,
690xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,
700x57,0x46,0x50,0xD3,0x69,0x99,0xDB,0x29,
710xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12,
720xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,
730xD8,0x00,0x3E,0x7C,0x47,0x74,0xE8,0x33,
74 };
75
76main()
77 {
78 DH *dh;
79
80 dh=DH_new();
81 dh->p=BN_bin2bn(data,sizeof(data),NULL);
82 dh->g=BN_new();
83 BN_set_word(dh->g,2);
84 PEM_write_DHparams(stdout,dh);
85 }
diff --git a/src/lib/libssl/src/crypto/dsa/dsagen.c b/src/lib/libssl/src/crypto/dsa/dsagen.c
deleted file mode 100644
index 1b6a1cca0f..0000000000
--- a/src/lib/libssl/src/crypto/dsa/dsagen.c
+++ /dev/null
@@ -1,111 +0,0 @@
1/* crypto/dsa/dsagen.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/dsa.h>
61
62#define TEST
63#define GENUINE_DSA
64
65#ifdef GENUINE_DSA
66#define LAST_VALUE 0xbd
67#else
68#define LAST_VALUE 0xd3
69#endif
70
71#ifdef TEST
72unsigned char seed[20]={
73 0xd5,0x01,0x4e,0x4b,
74 0x60,0xef,0x2b,0xa8,
75 0xb6,0x21,0x1b,0x40,
76 0x62,0xba,0x32,0x24,
77 0xe0,0x42,0x7d,LAST_VALUE};
78#endif
79
80int cb(int p, int n)
81 {
82 char c='*';
83
84 if (p == 0) c='.';
85 if (p == 1) c='+';
86 if (p == 2) c='*';
87 if (p == 3) c='\n';
88 printf("%c",c);
89 fflush(stdout);
90 }
91
92main()
93 {
94 int i;
95 BIGNUM *n;
96 BN_CTX *ctx;
97 unsigned char seed_buf[20];
98 DSA *dsa;
99 int counter,h;
100 BIO *bio_err=NULL;
101
102 if (bio_err == NULL)
103 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
104
105 memcpy(seed_buf,seed,20);
106 dsa=DSA_generate_parameters(1024,seed,20,&counter,&h,cb,bio_err);
107
108 if (dsa == NULL)
109 DSA_print(bio_err,dsa,0);
110 }
111
diff --git a/src/lib/libssl/src/crypto/evp/evp_pbe.c b/src/lib/libssl/src/crypto/evp/evp_pbe.c
index 779c1592da..dc8b5f51fc 100644
--- a/src/lib/libssl/src/crypto/evp/evp_pbe.c
+++ b/src/lib/libssl/src/crypto/evp/evp_pbe.c
@@ -111,30 +111,6 @@ static const EVP_PBE_CTL builtin_pbe[] = {
111 {EVP_PBE_TYPE_PRF, NID_id_HMACGostR3411_94, -1, NID_id_GostR3411_94, 0}, 111 {EVP_PBE_TYPE_PRF, NID_id_HMACGostR3411_94, -1, NID_id_GostR3411_94, 0},
112}; 112};
113 113
114#ifdef TEST
115int
116main(int argc, char **argv)
117{
118 int i, nid_md, nid_cipher;
119 EVP_PBE_CTL *tpbe, *tpbe2;
120 /*OpenSSL_add_all_algorithms();*/
121
122 for (i = 0; i < sizeof(builtin_pbe) / sizeof(EVP_PBE_CTL); i++) {
123 tpbe = builtin_pbe + i;
124 fprintf(stderr, "%d %d %s ", tpbe->pbe_type, tpbe->pbe_nid,
125 OBJ_nid2sn(tpbe->pbe_nid));
126 if (EVP_PBE_find(tpbe->pbe_type, tpbe->pbe_nid,
127 &nid_cipher , &nid_md, 0))
128 fprintf(stderr, "Found %s %s\n",
129 OBJ_nid2sn(nid_cipher), OBJ_nid2sn(nid_md));
130 else
131 fprintf(stderr, "Find ERROR!!\n");
132 }
133
134 return 0;
135}
136#endif
137
138int 114int
139EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, 115EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
140 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de) 116 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)
diff --git a/src/lib/libssl/src/crypto/evp/p5_crpt2.c b/src/lib/libssl/src/crypto/evp/p5_crpt2.c
index c276cd28b8..ca68ac0d94 100644
--- a/src/lib/libssl/src/crypto/evp/p5_crpt2.c
+++ b/src/lib/libssl/src/crypto/evp/p5_crpt2.c
@@ -166,17 +166,6 @@ PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, const unsigned char *salt,
166 EVP_sha1(), keylen, out); 166 EVP_sha1(), keylen, out);
167} 167}
168 168
169#ifdef DO_TEST
170main()
171{
172 unsigned char out[4];
173 unsigned char salt[] = {0x12, 0x34, 0x56, 0x78};
174 PKCS5_PBKDF2_HMAC_SHA1("password", -1, salt, 4, 5, 4, out);
175 fprintf(stderr, "Out %02X %02X %02X %02X\n",
176 out[0], out[1], out[2], out[3]);
177}
178#endif
179
180/* Now the key derivation function itself. This is a bit evil because 169/* Now the key derivation function itself. This is a bit evil because
181 * it has to check the ASN1 parameters are valid: and there are quite a 170 * it has to check the ASN1 parameters are valid: and there are quite a
182 * few of them... 171 * few of them...
diff --git a/src/lib/libssl/src/crypto/lhash/lh_test.c b/src/lib/libssl/src/crypto/lhash/lh_test.c
deleted file mode 100644
index 6167be383f..0000000000
--- a/src/lib/libssl/src/crypto/lhash/lh_test.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/* crypto/lhash/lh_test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <openssl/lhash.h>
63
64main()
65{
66 LHASH *conf;
67 char buf[256];
68 int i;
69
70 conf = lh_new(lh_strhash, strcmp);
71 for (;;) {
72 char *p;
73
74 buf[0] = '\0';
75 fgets(buf, 256, stdin);
76 if (buf[0] == '\0')
77 break;
78 i = strlen(buf);
79 p = malloc(i + 1);
80 memcpy(p, buf, i + 1);
81 lh_insert(conf, p);
82 }
83
84 lh_node_stats(conf, stdout);
85 lh_stats(conf, stdout);
86 lh_node_usage_stats(conf, stdout);
87 exit(0);
88}
diff --git a/src/lib/libssl/src/crypto/md4/md4.c b/src/lib/libssl/src/crypto/md4/md4.c
deleted file mode 100644
index 1b78f667f1..0000000000
--- a/src/lib/libssl/src/crypto/md4/md4.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/* crypto/md4/md4.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <unistd.h>
60#include <stdio.h>
61#include <stdlib.h>
62#include <openssl/md4.h>
63
64#define BUFSIZE 1024*16
65
66void do_fp(FILE *f);
67void pt(unsigned char *md);
68
69int main(int argc, char **argv)
70 {
71 int i,err=0;
72 FILE *IN;
73
74 if (argc == 1)
75 {
76 do_fp(stdin);
77 }
78 else
79 {
80 for (i=1; i<argc; i++)
81 {
82 IN=fopen(argv[i],"r");
83 if (IN == NULL)
84 {
85 perror(argv[i]);
86 err++;
87 continue;
88 }
89 printf("MD4(%s)= ",argv[i]);
90 do_fp(IN);
91 fclose(IN);
92 }
93 }
94 exit(err);
95 }
96
97void do_fp(FILE *f)
98 {
99 MD4_CTX c;
100 unsigned char md[MD4_DIGEST_LENGTH];
101 int fd;
102 int i;
103 static unsigned char buf[BUFSIZE];
104
105 fd=fileno(f);
106 MD4_Init(&c);
107 for (;;)
108 {
109 i=read(fd,buf,sizeof buf);
110 if (i <= 0) break;
111 MD4_Update(&c,buf,(unsigned long)i);
112 }
113 MD4_Final(&(md[0]),&c);
114 pt(md);
115 }
116
117void pt(unsigned char *md)
118 {
119 int i;
120
121 for (i=0; i<MD4_DIGEST_LENGTH; i++)
122 printf("%02x",md[i]);
123 printf("\n");
124 }
125
diff --git a/src/lib/libssl/src/crypto/md5/md5.c b/src/lib/libssl/src/crypto/md5/md5.c
deleted file mode 100644
index 3f6ec0791e..0000000000
--- a/src/lib/libssl/src/crypto/md5/md5.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/* crypto/md5/md5.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <unistd.h>
60#include <stdio.h>
61#include <stdlib.h>
62#include <openssl/md5.h>
63
64#define BUFSIZE 1024*16
65
66void do_fp(FILE *f);
67void pt(unsigned char *md);
68
69int main(int argc, char **argv)
70 {
71 int i,err=0;
72 FILE *IN;
73
74 if (argc == 1)
75 {
76 do_fp(stdin);
77 }
78 else
79 {
80 for (i=1; i<argc; i++)
81 {
82 IN=fopen(argv[i],"r");
83 if (IN == NULL)
84 {
85 perror(argv[i]);
86 err++;
87 continue;
88 }
89 printf("MD5(%s)= ",argv[i]);
90 do_fp(IN);
91 fclose(IN);
92 }
93 }
94 exit(err);
95 }
96
97void do_fp(FILE *f)
98 {
99 MD5_CTX c;
100 unsigned char md[MD5_DIGEST_LENGTH];
101 int fd;
102 int i;
103 static unsigned char buf[BUFSIZE];
104
105 fd=fileno(f);
106 MD5_Init(&c);
107 for (;;)
108 {
109 i=read(fd,buf,BUFSIZE);
110 if (i <= 0) break;
111 MD5_Update(&c,buf,(unsigned long)i);
112 }
113 MD5_Final(&(md[0]),&c);
114 pt(md);
115 }
116
117void pt(unsigned char *md)
118 {
119 int i;
120
121 for (i=0; i<MD5_DIGEST_LENGTH; i++)
122 printf("%02x",md[i]);
123 printf("\n");
124 }
125
diff --git a/src/lib/libssl/src/crypto/mdc2/mdc2dgst.c b/src/lib/libssl/src/crypto/mdc2/mdc2dgst.c
index 302f9ab9a8..d6ce1451a1 100644
--- a/src/lib/libssl/src/crypto/mdc2/mdc2dgst.c
+++ b/src/lib/libssl/src/crypto/mdc2/mdc2dgst.c
@@ -177,24 +177,3 @@ int MDC2_Final(unsigned char *md, MDC2_CTX *c)
177 memcpy(&(md[MDC2_BLOCK]),(char *)c->hh,MDC2_BLOCK); 177 memcpy(&(md[MDC2_BLOCK]),(char *)c->hh,MDC2_BLOCK);
178 return 1; 178 return 1;
179 } 179 }
180
181#undef TEST
182
183#ifdef TEST
184main()
185 {
186 unsigned char md[MDC2_DIGEST_LENGTH];
187 int i;
188 MDC2_CTX c;
189 static char *text="Now is the time for all ";
190
191 MDC2_Init(&c);
192 MDC2_Update(&c,text,strlen(text));
193 MDC2_Final(&(md[0]),&c);
194
195 for (i=0; i<MDC2_DIGEST_LENGTH; i++)
196 printf("%02X",md[i]);
197 printf("\n");
198 }
199
200#endif
diff --git a/src/lib/libssl/src/crypto/o_time.c b/src/lib/libssl/src/crypto/o_time.c
index 45bfce742e..a963b0d120 100644
--- a/src/lib/libssl/src/crypto/o_time.c
+++ b/src/lib/libssl/src/crypto/o_time.c
@@ -159,53 +159,3 @@ julian_to_date(long jd, int *y, int *m, int *d)
159 *m = j + 2 - (12 * L); 159 *m = j + 2 - (12 * L);
160 *y = 100 * (n - 49) + i + L; 160 *y = 100 * (n - 49) + i + L;
161} 161}
162
163#ifdef OPENSSL_TIME_TEST
164
165#include <stdio.h>
166
167/* Time checking test code. Check times are identical for a wide range of
168 * offsets. This should be run on a machine with 64 bit time_t or it will
169 * trigger the very errors the routines fix.
170 */
171
172int
173main(int argc, char **argv)
174{
175 long offset;
176 for (offset = 0; offset < 1000000; offset++) {
177 check_time(offset);
178 check_time(-offset);
179 check_time(offset * 1000);
180 check_time(-offset * 1000);
181 }
182}
183
184int
185check_time(long offset)
186{
187 struct tm tm1, tm2;
188 time_t t1, t2;
189 time(&t1);
190 t2 = t1 + offset;
191 gmtime_r(&t2, &tm2);
192 gmtime_r(&t1, &tm1);
193 OPENSSL_gmtime_adj(&tm1, 0, offset);
194 if ((tm1.tm_year == tm2.tm_year) &&
195 (tm1.tm_mon == tm2.tm_mon) &&
196 (tm1.tm_mday == tm2.tm_mday) &&
197 (tm1.tm_hour == tm2.tm_hour) &&
198 (tm1.tm_min == tm2.tm_min) &&
199 (tm1.tm_sec == tm2.tm_sec))
200 return 1;
201 fprintf(stderr, "TIME ERROR!!\n");
202 fprintf(stderr, "Time1: %d/%d/%d, %d:%02d:%02d\n",
203 tm2.tm_mday, tm2.tm_mon + 1, tm2.tm_year + 1900,
204 tm2.tm_hour, tm2.tm_min, tm2.tm_sec);
205 fprintf(stderr, "Time2: %d/%d/%d, %d:%02d:%02d\n",
206 tm1.tm_mday, tm1.tm_mon + 1, tm1.tm_year + 1900,
207 tm1.tm_hour, tm1.tm_min, tm1.tm_sec);
208 return 0;
209}
210
211#endif
diff --git a/src/lib/libssl/src/crypto/objects/obj_xref.c b/src/lib/libssl/src/crypto/objects/obj_xref.c
index 2c1631e773..34cfeeb92c 100644
--- a/src/lib/libssl/src/crypto/objects/obj_xref.c
+++ b/src/lib/libssl/src/crypto/objects/obj_xref.c
@@ -203,31 +203,3 @@ OBJ_sigid_free(void)
203 sigx_app = NULL; 203 sigx_app = NULL;
204 } 204 }
205} 205}
206
207#ifdef OBJ_XREF_TEST
208
209main()
210{
211 int n1, n2, n3;
212
213 int i, rv;
214#ifdef OBJ_XREF_TEST2
215 for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) {
216 OBJ_add_sigid(sigoid_srt[i][0], sigoid_srt[i][1],
217 sigoid_srt[i][2]);
218 }
219#endif
220
221 for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) {
222 n1 = sigoid_srt[i][0];
223 rv = OBJ_find_sigid_algs(n1, &n2, &n3);
224 printf("Forward: %d, %s %s %s\n", rv,
225 OBJ_nid2ln(n1), OBJ_nid2ln(n2), OBJ_nid2ln(n3));
226 n1 = 0;
227 rv = OBJ_find_sigid_by_algs(&n1, n2, n3);
228 printf("Reverse: %d, %s %s %s\n", rv,
229 OBJ_nid2ln(n1), OBJ_nid2ln(n2), OBJ_nid2ln(n3));
230 }
231}
232
233#endif
diff --git a/src/lib/libssl/src/crypto/pkcs7/dec.c b/src/lib/libssl/src/crypto/pkcs7/dec.c
deleted file mode 100644
index 6752ec568a..0000000000
--- a/src/lib/libssl/src/crypto/pkcs7/dec.c
+++ /dev/null
@@ -1,248 +0,0 @@
1/* crypto/pkcs7/verify.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <stdlib.h>
60#include <string.h>
61#include <openssl/bio.h>
62#include <openssl/x509.h>
63#include <openssl/pem.h>
64#include <openssl/err.h>
65#include <openssl/asn1.h>
66
67int verify_callback(int ok, X509_STORE_CTX *ctx);
68
69BIO *bio_err=NULL;
70
71int main(argc,argv)
72int argc;
73char *argv[];
74 {
75 char *keyfile=NULL;
76 BIO *in;
77 EVP_PKEY *pkey;
78 X509 *x509;
79 PKCS7 *p7;
80 PKCS7_SIGNER_INFO *si;
81 X509_STORE_CTX cert_ctx;
82 X509_STORE *cert_store=NULL;
83 BIO *data,*detached=NULL,*p7bio=NULL;
84 char buf[1024*4];
85 unsigned char *pp;
86 int i,printit=0;
87 STACK_OF(PKCS7_SIGNER_INFO) *sk;
88
89 OpenSSL_add_all_algorithms();
90 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
91
92 data=BIO_new(BIO_s_file());
93 pp=NULL;
94 while (argc > 1)
95 {
96 argc--;
97 argv++;
98 if (strcmp(argv[0],"-p") == 0)
99 {
100 printit=1;
101 }
102 else if ((strcmp(argv[0],"-k") == 0) && (argc >= 2)) {
103 keyfile = argv[1];
104 argc-=1;
105 argv+=1;
106 } else if ((strcmp(argv[0],"-d") == 0) && (argc >= 2))
107 {
108 detached=BIO_new(BIO_s_file());
109 if (!BIO_read_filename(detached,argv[1]))
110 goto err;
111 argc-=1;
112 argv+=1;
113 }
114 else break;
115 }
116
117 if (!BIO_read_filename(data,argv[0])) goto err;
118
119 if(!keyfile) {
120 fprintf(stderr, "No private key file specified\n");
121 goto err;
122 }
123
124 if ((in=BIO_new_file(keyfile,"r")) == NULL) goto err;
125 if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err;
126 BIO_reset(in);
127 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL)
128 goto err;
129 BIO_free(in);
130
131 if (pp == NULL)
132 BIO_set_fp(data,stdin,BIO_NOCLOSE);
133
134
135 /* Load the PKCS7 object from a file */
136 if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err;
137
138
139
140 /* This stuff is being setup for certificate verification.
141 * When using SSL, it could be replaced with a
142 * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */
143 cert_store=X509_STORE_new();
144 X509_STORE_set_default_paths(cert_store);
145 X509_STORE_load_locations(cert_store,NULL,"../../certs");
146 X509_STORE_set_verify_cb_func(cert_store,verify_callback);
147
148 ERR_clear_error();
149
150 /* We need to process the data */
151 /* We cannot support detached encryption */
152 p7bio=PKCS7_dataDecode(p7,pkey,detached,x509);
153
154 if (p7bio == NULL)
155 {
156 printf("problems decoding\n");
157 goto err;
158 }
159
160 /* We now have to 'read' from p7bio to calculate digests etc. */
161 for (;;)
162 {
163 i=BIO_read(p7bio,buf,sizeof(buf));
164 /* print it? */
165 if (i <= 0) break;
166 fwrite(buf,1, i, stdout);
167 }
168
169 /* We can now verify signatures */
170 sk=PKCS7_get_signer_info(p7);
171 if (sk == NULL)
172 {
173 fprintf(stderr, "there are no signatures on this data\n");
174 }
175 else
176 {
177 /* Ok, first we need to, for each subject entry,
178 * see if we can verify */
179 ERR_clear_error();
180 for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++)
181 {
182 si=sk_PKCS7_SIGNER_INFO_value(sk,i);
183 i=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si);
184 if (i <= 0)
185 goto err;
186 else
187 fprintf(stderr,"Signature verified\n");
188 }
189 }
190 X509_STORE_free(cert_store);
191
192 exit(0);
193err:
194 ERR_load_crypto_strings();
195 ERR_print_errors_fp(stderr);
196 exit(1);
197 }
198
199/* should be X509 * but we can just have them as char *. */
200int verify_callback(int ok, X509_STORE_CTX *ctx)
201 {
202 char buf[256];
203 X509 *err_cert;
204 int err,depth;
205
206 err_cert=X509_STORE_CTX_get_current_cert(ctx);
207 err= X509_STORE_CTX_get_error(ctx);
208 depth= X509_STORE_CTX_get_error_depth(ctx);
209
210 X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
211 BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
212 if (!ok)
213 {
214 BIO_printf(bio_err,"verify error:num=%d:%s\n",err,
215 X509_verify_cert_error_string(err));
216 if (depth < 6)
217 {
218 ok=1;
219 X509_STORE_CTX_set_error(ctx,X509_V_OK);
220 }
221 else
222 {
223 ok=0;
224 X509_STORE_CTX_set_error(ctx,X509_V_ERR_CERT_CHAIN_TOO_LONG);
225 }
226 }
227 switch (ctx->error)
228 {
229 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
230 X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256);
231 BIO_printf(bio_err,"issuer= %s\n",buf);
232 break;
233 case X509_V_ERR_CERT_NOT_YET_VALID:
234 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
235 BIO_printf(bio_err,"notBefore=");
236 ASN1_UTCTIME_print(bio_err,X509_get_notBefore(ctx->current_cert));
237 BIO_printf(bio_err,"\n");
238 break;
239 case X509_V_ERR_CERT_HAS_EXPIRED:
240 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
241 BIO_printf(bio_err,"notAfter=");
242 ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ctx->current_cert));
243 BIO_printf(bio_err,"\n");
244 break;
245 }
246 BIO_printf(bio_err,"verify return:%d\n",ok);
247 return(ok);
248 }
diff --git a/src/lib/libssl/src/crypto/pkcs7/enc.c b/src/lib/libssl/src/crypto/pkcs7/enc.c
deleted file mode 100644
index 7417f8a4e0..0000000000
--- a/src/lib/libssl/src/crypto/pkcs7/enc.c
+++ /dev/null
@@ -1,174 +0,0 @@
1/* crypto/pkcs7/enc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/x509.h>
62#include <openssl/pem.h>
63#include <openssl/err.h>
64
65int main(argc,argv)
66int argc;
67char *argv[];
68 {
69 X509 *x509;
70 PKCS7 *p7;
71 BIO *in;
72 BIO *data,*p7bio;
73 char buf[1024*4];
74 int i;
75 int nodetach=1;
76 char *keyfile = NULL;
77 const EVP_CIPHER *cipher=NULL;
78 STACK_OF(X509) *recips=NULL;
79
80 OpenSSL_add_all_algorithms();
81
82 data=BIO_new(BIO_s_file());
83 while(argc > 1)
84 {
85 if (strcmp(argv[1],"-nd") == 0)
86 {
87 nodetach=1;
88 argv++; argc--;
89 }
90 else if ((strcmp(argv[1],"-c") == 0) && (argc >= 2)) {
91 if(!(cipher = EVP_get_cipherbyname(argv[2]))) {
92 fprintf(stderr, "Unknown cipher %s\n", argv[2]);
93 goto err;
94 }
95 argc-=2;
96 argv+=2;
97 } else if ((strcmp(argv[1],"-k") == 0) && (argc >= 2)) {
98 keyfile = argv[2];
99 argc-=2;
100 argv+=2;
101 if (!(in=BIO_new_file(keyfile,"r"))) goto err;
102 if (!(x509=PEM_read_bio_X509(in,NULL,NULL,NULL)))
103 goto err;
104 if(!recips) recips = sk_X509_new_null();
105 sk_X509_push(recips, x509);
106 BIO_free(in);
107 } else break;
108 }
109
110 if(!recips) {
111 fprintf(stderr, "No recipients\n");
112 goto err;
113 }
114
115 if (!BIO_read_filename(data,argv[1])) goto err;
116
117 p7=PKCS7_new();
118#if 0
119 BIO_reset(in);
120 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL)) == NULL) goto err;
121 BIO_free(in);
122 PKCS7_set_type(p7,NID_pkcs7_signedAndEnveloped);
123
124 if (PKCS7_add_signature(p7,x509,pkey,EVP_sha1()) == NULL) goto err;
125 /* we may want to add more */
126 PKCS7_add_certificate(p7,x509);
127#else
128 PKCS7_set_type(p7,NID_pkcs7_enveloped);
129#endif
130 if(!cipher) {
131#ifndef OPENSSL_NO_DES
132 cipher = EVP_des_ede3_cbc();
133#else
134 fprintf(stderr, "No cipher selected\n");
135 goto err;
136#endif
137 }
138
139 if (!PKCS7_set_cipher(p7,cipher)) goto err;
140 for(i = 0; i < sk_X509_num(recips); i++) {
141 if (!PKCS7_add_recipient(p7,sk_X509_value(recips, i))) goto err;
142 }
143 sk_X509_pop_free(recips, X509_free);
144
145 /* Set the content of the signed to 'data' */
146 /* PKCS7_content_new(p7,NID_pkcs7_data); not used in envelope */
147
148 /* could be used, but not in this version :-)
149 if (!nodetach) PKCS7_set_detached(p7,1);
150 */
151
152 if ((p7bio=PKCS7_dataInit(p7,NULL)) == NULL) goto err;
153
154 for (;;)
155 {
156 i=BIO_read(data,buf,sizeof(buf));
157 if (i <= 0) break;
158 BIO_write(p7bio,buf,i);
159 }
160 BIO_flush(p7bio);
161
162 if (!PKCS7_dataFinal(p7,p7bio)) goto err;
163 BIO_free(p7bio);
164
165 PEM_write_PKCS7(stdout,p7);
166 PKCS7_free(p7);
167
168 exit(0);
169err:
170 ERR_load_crypto_strings();
171 ERR_print_errors_fp(stderr);
172 exit(1);
173 }
174
diff --git a/src/lib/libssl/src/crypto/pkcs7/sign.c b/src/lib/libssl/src/crypto/pkcs7/sign.c
deleted file mode 100644
index 43168514f9..0000000000
--- a/src/lib/libssl/src/crypto/pkcs7/sign.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/* crypto/pkcs7/sign.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/x509.h>
62#include <openssl/pem.h>
63#include <openssl/err.h>
64
65int main(argc,argv)
66int argc;
67char *argv[];
68 {
69 X509 *x509;
70 EVP_PKEY *pkey;
71 PKCS7 *p7;
72 PKCS7_SIGNER_INFO *si;
73 BIO *in;
74 BIO *data,*p7bio;
75 char buf[1024*4];
76 int i;
77 int nodetach=0;
78
79#ifndef OPENSSL_NO_MD5
80 EVP_add_digest(EVP_md5());
81#endif
82#ifndef OPENSSL_NO_SHA1
83 EVP_add_digest(EVP_sha1());
84#endif
85#ifndef OPENSSL_NO_MDC2
86 EVP_add_digest(EVP_mdc2());
87#endif
88
89 data=BIO_new(BIO_s_file());
90again:
91 if (argc > 1)
92 {
93 if (strcmp(argv[1],"-nd") == 0)
94 {
95 nodetach=1;
96 argv++; argc--;
97 goto again;
98 }
99 if (!BIO_read_filename(data,argv[1]))
100 goto err;
101 }
102 else
103 BIO_set_fp(data,stdin,BIO_NOCLOSE);
104
105 if ((in=BIO_new_file("server.pem","r")) == NULL) goto err;
106 if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err;
107 BIO_reset(in);
108 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL) goto err;
109 BIO_free(in);
110
111 p7=PKCS7_new();
112 PKCS7_set_type(p7,NID_pkcs7_signed);
113
114 si=PKCS7_add_signature(p7,x509,pkey,EVP_sha1());
115 if (si == NULL) goto err;
116
117 /* If you do this then you get signing time automatically added */
118 PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT,
119 OBJ_nid2obj(NID_pkcs7_data));
120
121 /* we may want to add more */
122 PKCS7_add_certificate(p7,x509);
123
124 /* Set the content of the signed to 'data' */
125 PKCS7_content_new(p7,NID_pkcs7_data);
126
127 if (!nodetach)
128 PKCS7_set_detached(p7,1);
129
130 if ((p7bio=PKCS7_dataInit(p7,NULL)) == NULL) goto err;
131
132 for (;;)
133 {
134 i=BIO_read(data,buf,sizeof(buf));
135 if (i <= 0) break;
136 BIO_write(p7bio,buf,i);
137 }
138
139 if (!PKCS7_dataFinal(p7,p7bio)) goto err;
140 BIO_free(p7bio);
141
142 PEM_write_PKCS7(stdout,p7);
143 PKCS7_free(p7);
144
145 exit(0);
146err:
147 ERR_load_crypto_strings();
148 ERR_print_errors_fp(stderr);
149 exit(1);
150 }
151
diff --git a/src/lib/libssl/src/crypto/pkcs7/verify.c b/src/lib/libssl/src/crypto/pkcs7/verify.c
deleted file mode 100644
index 414f985dc2..0000000000
--- a/src/lib/libssl/src/crypto/pkcs7/verify.c
+++ /dev/null
@@ -1,260 +0,0 @@
1/* crypto/pkcs7/verify.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/asn1.h>
62#include <openssl/x509.h>
63#include <openssl/pem.h>
64#include <openssl/err.h>
65#include "example.h"
66
67int verify_callback(int ok, X509_STORE_CTX *ctx);
68
69BIO *bio_err=NULL;
70BIO *bio_out=NULL;
71
72int main(argc,argv)
73int argc;
74char *argv[];
75 {
76 PKCS7 *p7;
77 PKCS7_SIGNER_INFO *si;
78 X509_STORE_CTX cert_ctx;
79 X509_STORE *cert_store=NULL;
80 BIO *data,*detached=NULL,*p7bio=NULL;
81 char buf[1024*4];
82 char *pp;
83 int i,printit=0;
84 STACK_OF(PKCS7_SIGNER_INFO) *sk;
85
86 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
87 bio_out=BIO_new_fp(stdout,BIO_NOCLOSE);
88#ifndef OPENSSL_NO_MD5
89 EVP_add_digest(EVP_md5());
90#endif
91#ifndef OPENSSL_NO_SHA1
92 EVP_add_digest(EVP_sha1());
93#endif
94#ifndef OPENSSL_NO_MDC2
95 EVP_add_digest(EVP_mdc2());
96#endif
97
98 data=BIO_new(BIO_s_file());
99
100 pp=NULL;
101 while (argc > 1)
102 {
103 argc--;
104 argv++;
105 if (strcmp(argv[0],"-p") == 0)
106 {
107 printit=1;
108 }
109 else if ((strcmp(argv[0],"-d") == 0) && (argc >= 2))
110 {
111 detached=BIO_new(BIO_s_file());
112 if (!BIO_read_filename(detached,argv[1]))
113 goto err;
114 argc--;
115 argv++;
116 }
117 else
118 {
119 pp=argv[0];
120 if (!BIO_read_filename(data,argv[0]))
121 goto err;
122 }
123 }
124
125 if (pp == NULL)
126 BIO_set_fp(data,stdin,BIO_NOCLOSE);
127
128
129 /* Load the PKCS7 object from a file */
130 if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err;
131
132 /* This stuff is being setup for certificate verification.
133 * When using SSL, it could be replaced with a
134 * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */
135 cert_store=X509_STORE_new();
136 X509_STORE_set_default_paths(cert_store);
137 X509_STORE_load_locations(cert_store,NULL,"../../certs");
138 X509_STORE_set_verify_cb_func(cert_store,verify_callback);
139
140 ERR_clear_error();
141
142 /* We need to process the data */
143 if ((PKCS7_get_detached(p7) || detached))
144 {
145 if (detached == NULL)
146 {
147 printf("no data to verify the signature on\n");
148 exit(1);
149 }
150 else
151 p7bio=PKCS7_dataInit(p7,detached);
152 }
153 else
154 {
155 p7bio=PKCS7_dataInit(p7,NULL);
156 }
157
158 /* We now have to 'read' from p7bio to calculate digests etc. */
159 for (;;)
160 {
161 i=BIO_read(p7bio,buf,sizeof(buf));
162 /* print it? */
163 if (i <= 0) break;
164 }
165
166 /* We can now verify signatures */
167 sk=PKCS7_get_signer_info(p7);
168 if (sk == NULL)
169 {
170 printf("there are no signatures on this data\n");
171 exit(1);
172 }
173
174 /* Ok, first we need to, for each subject entry, see if we can verify */
175 for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++)
176 {
177 ASN1_UTCTIME *tm;
178 char *str1,*str2;
179 int rc;
180
181 si=sk_PKCS7_SIGNER_INFO_value(sk,i);
182 rc=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si);
183 if (rc <= 0)
184 goto err;
185 printf("signer info\n");
186 if ((tm=get_signed_time(si)) != NULL)
187 {
188 BIO_printf(bio_out,"Signed time:");
189 ASN1_UTCTIME_print(bio_out,tm);
190 ASN1_UTCTIME_free(tm);
191 BIO_printf(bio_out,"\n");
192 }
193 if (get_signed_seq2string(si,&str1,&str2))
194 {
195 BIO_printf(bio_out,"String 1 is %s\n",str1);
196 BIO_printf(bio_out,"String 2 is %s\n",str2);
197 }
198
199 }
200
201 X509_STORE_free(cert_store);
202
203 printf("done\n");
204 exit(0);
205err:
206 ERR_load_crypto_strings();
207 ERR_print_errors_fp(stderr);
208 exit(1);
209 }
210
211/* should be X509 * but we can just have them as char *. */
212int verify_callback(int ok, X509_STORE_CTX *ctx)
213 {
214 char buf[256];
215 X509 *err_cert;
216 int err,depth;
217
218 err_cert=X509_STORE_CTX_get_current_cert(ctx);
219 err= X509_STORE_CTX_get_error(ctx);
220 depth= X509_STORE_CTX_get_error_depth(ctx);
221
222 X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
223 BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
224 if (!ok)
225 {
226 BIO_printf(bio_err,"verify error:num=%d:%s\n",err,
227 X509_verify_cert_error_string(err));
228 if (depth < 6)
229 {
230 ok=1;
231 X509_STORE_CTX_set_error(ctx,X509_V_OK);
232 }
233 else
234 {
235 ok=0;
236 X509_STORE_CTX_set_error(ctx,X509_V_ERR_CERT_CHAIN_TOO_LONG);
237 }
238 }
239 switch (ctx->error)
240 {
241 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
242 X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256);
243 BIO_printf(bio_err,"issuer= %s\n",buf);
244 break;
245 case X509_V_ERR_CERT_NOT_YET_VALID:
246 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
247 BIO_printf(bio_err,"notBefore=");
248 ASN1_UTCTIME_print(bio_err,X509_get_notBefore(ctx->current_cert));
249 BIO_printf(bio_err,"\n");
250 break;
251 case X509_V_ERR_CERT_HAS_EXPIRED:
252 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
253 BIO_printf(bio_err,"notAfter=");
254 ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ctx->current_cert));
255 BIO_printf(bio_err,"\n");
256 break;
257 }
258 BIO_printf(bio_err,"verify return:%d\n",ok);
259 return(ok);
260 }
diff --git a/src/lib/libssl/src/crypto/rc5/rc5speed.c b/src/lib/libssl/src/crypto/rc5/rc5speed.c
deleted file mode 100644
index b5a8c285da..0000000000
--- a/src/lib/libssl/src/crypto/rc5/rc5speed.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/* crypto/rc5/rc5speed.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#include <sys/types.h>
63#include <sys/times.h>
64
65#include <signal.h>
66#include <stdio.h>
67#include <stdlib.h>
68#include <time.h>
69#include <unistd.h>
70
71#include <openssl/rc5.h>
72
73#define HZ ((double)CLK_TCK)
74
75#define BUFSIZE ((long)1024)
76long run=0;
77
78double Time_F(int s);
79
80void sig_done(int sig);
81void sig_done(int sig)
82 {
83 signal(SIGALRM,sig_done);
84 run=0;
85 }
86
87#define START 0
88#define STOP 1
89
90double Time_F(int s)
91 {
92 double ret;
93 static struct tms tstart,tend;
94
95 if (s == START)
96 {
97 times(&tstart);
98 return(0);
99 }
100 else
101 {
102 times(&tend);
103 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
104 return((ret == 0.0)?1e-6:ret);
105 }
106 }
107
108int main(int argc, char **argv)
109 {
110 long count;
111 static unsigned char buf[BUFSIZE];
112 static unsigned char key[] ={
113 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
114 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
115 };
116 RC5_32_KEY sch;
117 double a,b,c,d;
118#ifndef SIGALRM
119 long ca,cb,cc;
120#endif
121
122#ifndef TIMES
123 printf("To get the most accurate results, try to run this\n");
124 printf("program when this computer is idle.\n");
125#endif
126
127#ifndef SIGALRM
128 printf("First we calculate the approximate speed ...\n");
129 RC5_32_set_key(&sch,16,key,12);
130 count=10;
131 do {
132 long i;
133 unsigned long data[2];
134
135 count*=2;
136 Time_F(START);
137 for (i=count; i; i--)
138 RC5_32_encrypt(data,&sch);
139 d=Time_F(STOP);
140 } while (d < 3.0);
141 ca=count/512;
142 cb=count;
143 cc=count*8/BUFSIZE+1;
144 printf("Doing RC5_32_set_key %ld times\n",ca);
145#define COND(d) (count != (d))
146#define COUNT(d) (d)
147#else
148#define COND(c) (run)
149#define COUNT(d) (count)
150 signal(SIGALRM,sig_done);
151 printf("Doing RC5_32_set_key for 10 seconds\n");
152 alarm(10);
153#endif
154
155 Time_F(START);
156 for (count=0,run=1; COND(ca); count+=4)
157 {
158 RC5_32_set_key(&sch,16,key,12);
159 RC5_32_set_key(&sch,16,key,12);
160 RC5_32_set_key(&sch,16,key,12);
161 RC5_32_set_key(&sch,16,key,12);
162 }
163 d=Time_F(STOP);
164 printf("%ld RC5_32_set_key's in %.2f seconds\n",count,d);
165 a=((double)COUNT(ca))/d;
166
167 printf("Doing RC5_32_encrypt's for 10 seconds\n");
168 alarm(10);
169
170 Time_F(START);
171 for (count=0,run=1; COND(cb); count+=4)
172 {
173 unsigned long data[2];
174
175 RC5_32_encrypt(data,&sch);
176 RC5_32_encrypt(data,&sch);
177 RC5_32_encrypt(data,&sch);
178 RC5_32_encrypt(data,&sch);
179 }
180 d=Time_F(STOP);
181 printf("%ld RC5_32_encrypt's in %.2f second\n",count,d);
182 b=((double)COUNT(cb)*8)/d;
183
184 printf("Doing RC5_32_cbc_encrypt on %ld byte blocks for 10 seconds\n",
185 BUFSIZE);
186 alarm(10);
187
188 Time_F(START);
189 for (count=0,run=1; COND(cc); count++)
190 RC5_32_cbc_encrypt(buf,buf,BUFSIZE,&sch,
191 &(key[0]),RC5_ENCRYPT);
192 d=Time_F(STOP);
193 printf("%ld RC5_32_cbc_encrypt's of %ld byte blocks in %.2f second\n",
194 count,BUFSIZE,d);
195 c=((double)COUNT(cc)*BUFSIZE)/d;
196
197 printf("RC5_32/12/16 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
198 printf("RC5_32/12/16 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
199 printf("RC5_32/12/16 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
200 exit(0);
201 }
diff --git a/src/lib/libssl/src/crypto/rc5/rc5test.c b/src/lib/libssl/src/crypto/rc5/rc5test.c
deleted file mode 100644
index 1a0260ee1d..0000000000
--- a/src/lib/libssl/src/crypto/rc5/rc5test.c
+++ /dev/null
@@ -1,384 +0,0 @@
1/* crypto/rc5/rc5test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* This has been a quickly hacked 'ideatest.c'. When I add tests for other
60 * RC5 modes, more of the code will be uncommented. */
61
62#include <stdio.h>
63#include <string.h>
64#include <stdlib.h>
65
66#ifdef OPENSSL_NO_RC5
67int main(int argc, char *argv[])
68{
69 printf("No RC5 support\n");
70 return(0);
71}
72#else
73#include <openssl/rc5.h>
74
75static unsigned char RC5key[5][16]={
76 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
77 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
78 {0x91,0x5f,0x46,0x19,0xbe,0x41,0xb2,0x51,
79 0x63,0x55,0xa5,0x01,0x10,0xa9,0xce,0x91},
80 {0x78,0x33,0x48,0xe7,0x5a,0xeb,0x0f,0x2f,
81 0xd7,0xb1,0x69,0xbb,0x8d,0xc1,0x67,0x87},
82 {0xdc,0x49,0xdb,0x13,0x75,0xa5,0x58,0x4f,
83 0x64,0x85,0xb4,0x13,0xb5,0xf1,0x2b,0xaf},
84 {0x52,0x69,0xf1,0x49,0xd4,0x1b,0xa0,0x15,
85 0x24,0x97,0x57,0x4d,0x7f,0x15,0x31,0x25},
86 };
87
88static unsigned char RC5plain[5][8]={
89 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
90 {0x21,0xA5,0xDB,0xEE,0x15,0x4B,0x8F,0x6D},
91 {0xF7,0xC0,0x13,0xAC,0x5B,0x2B,0x89,0x52},
92 {0x2F,0x42,0xB3,0xB7,0x03,0x69,0xFC,0x92},
93 {0x65,0xC1,0x78,0xB2,0x84,0xD1,0x97,0xCC},
94 };
95
96static unsigned char RC5cipher[5][8]={
97 {0x21,0xA5,0xDB,0xEE,0x15,0x4B,0x8F,0x6D},
98 {0xF7,0xC0,0x13,0xAC,0x5B,0x2B,0x89,0x52},
99 {0x2F,0x42,0xB3,0xB7,0x03,0x69,0xFC,0x92},
100 {0x65,0xC1,0x78,0xB2,0x84,0xD1,0x97,0xCC},
101 {0xEB,0x44,0xE4,0x15,0xDA,0x31,0x98,0x24},
102 };
103
104#define RC5_CBC_NUM 27
105static unsigned char rc5_cbc_cipher[RC5_CBC_NUM][8]={
106 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1e},
107 {0x79,0x7b,0xba,0x4d,0x78,0x11,0x1d,0x1e},
108 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1f},
109 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1f},
110 {0x8b,0x9d,0xed,0x91,0xce,0x77,0x94,0xa6},
111 {0x2f,0x75,0x9f,0xe7,0xad,0x86,0xa3,0x78},
112 {0xdc,0xa2,0x69,0x4b,0xf4,0x0e,0x07,0x88},
113 {0xdc,0xa2,0x69,0x4b,0xf4,0x0e,0x07,0x88},
114 {0xdc,0xfe,0x09,0x85,0x77,0xec,0xa5,0xff},
115 {0x96,0x46,0xfb,0x77,0x63,0x8f,0x9c,0xa8},
116 {0xb2,0xb3,0x20,0x9d,0xb6,0x59,0x4d,0xa4},
117 {0x54,0x5f,0x7f,0x32,0xa5,0xfc,0x38,0x36},
118 {0x82,0x85,0xe7,0xc1,0xb5,0xbc,0x74,0x02},
119 {0xfc,0x58,0x6f,0x92,0xf7,0x08,0x09,0x34},
120 {0xcf,0x27,0x0e,0xf9,0x71,0x7f,0xf7,0xc4},
121 {0xe4,0x93,0xf1,0xc1,0xbb,0x4d,0x6e,0x8c},
122 {0x5c,0x4c,0x04,0x1e,0x0f,0x21,0x7a,0xc3},
123 {0x92,0x1f,0x12,0x48,0x53,0x73,0xb4,0xf7},
124 {0x5b,0xa0,0xca,0x6b,0xbe,0x7f,0x5f,0xad},
125 {0xc5,0x33,0x77,0x1c,0xd0,0x11,0x0e,0x63},
126 {0x29,0x4d,0xdb,0x46,0xb3,0x27,0x8d,0x60},
127 {0xda,0xd6,0xbd,0xa9,0xdf,0xe8,0xf7,0xe8},
128 {0x97,0xe0,0x78,0x78,0x37,0xed,0x31,0x7f},
129 {0x78,0x75,0xdb,0xf6,0x73,0x8c,0x64,0x78},
130 {0x8f,0x34,0xc3,0xc6,0x81,0xc9,0x96,0x95},
131 {0x7c,0xb3,0xf1,0xdf,0x34,0xf9,0x48,0x11},
132 {0x7f,0xd1,0xa0,0x23,0xa5,0xbb,0xa2,0x17},
133 };
134
135static unsigned char rc5_cbc_key[RC5_CBC_NUM][17]={
136 { 1,0x00},
137 { 1,0x00},
138 { 1,0x00},
139 { 1,0x00},
140 { 1,0x00},
141 { 1,0x11},
142 { 1,0x00},
143 { 4,0x00,0x00,0x00,0x00},
144 { 1,0x00},
145 { 1,0x00},
146 { 1,0x00},
147 { 1,0x00},
148 { 4,0x01,0x02,0x03,0x04},
149 { 4,0x01,0x02,0x03,0x04},
150 { 4,0x01,0x02,0x03,0x04},
151 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
152 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
153 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
154 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
155 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
156 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
157 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
158 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
159 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
160 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
161 { 5,0x01,0x02,0x03,0x04,0x05},
162 { 5,0x01,0x02,0x03,0x04,0x05},
163 { 5,0x01,0x02,0x03,0x04,0x05},
164 { 5,0x01,0x02,0x03,0x04,0x05},
165 { 5,0x01,0x02,0x03,0x04,0x05},
166 };
167
168static unsigned char rc5_cbc_plain[RC5_CBC_NUM][8]={
169 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
170 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
171 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
172 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
173 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
174 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
175 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
176 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
177 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
178 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
179 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
180 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
181 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
182 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
183 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
184 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
185 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
186 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
187 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
188 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
189 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
190 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
191 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
192 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
193 {0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},
194 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
195 {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x01},
196 };
197
198static int rc5_cbc_rounds[RC5_CBC_NUM]={
199 0, 0, 0, 0, 0, 1, 2, 2,
200 8, 8,12,16, 8,12,16,12,
201 8,12,16, 8,12,16,12, 8,
202 8, 8, 8,
203 };
204
205static unsigned char rc5_cbc_iv[RC5_CBC_NUM][8]={
206 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
207 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
208 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
209 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
210 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
211 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
212 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
213 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
214 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
215 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
216 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
217 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
218 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
219 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
220 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
221 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
222 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
223 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
224 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
225 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
226 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
227 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
228 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
229 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
230 {0x78,0x75,0xdb,0xf6,0x73,0x8c,0x64,0x78},
231 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
232 {0x7c,0xb3,0xf1,0xdf,0x34,0xf9,0x48,0x11},
233 };
234
235int main(int argc, char *argv[])
236 {
237 int i,n,err=0;
238 RC5_32_KEY key;
239 unsigned char buf[8],buf2[8],ivb[8];
240
241 for (n=0; n<5; n++)
242 {
243 RC5_32_set_key(&key,16,&(RC5key[n][0]),12);
244
245 RC5_32_ecb_encrypt(&(RC5plain[n][0]),buf,&key,RC5_ENCRYPT);
246 if (memcmp(&(RC5cipher[n][0]),buf,8) != 0)
247 {
248 printf("ecb RC5 error encrypting (%d)\n",n+1);
249 printf("got :");
250 for (i=0; i<8; i++)
251 printf("%02X ",buf[i]);
252 printf("\n");
253 printf("expected:");
254 for (i=0; i<8; i++)
255 printf("%02X ",RC5cipher[n][i]);
256 err=20;
257 printf("\n");
258 }
259
260 RC5_32_ecb_encrypt(buf,buf2,&key,RC5_DECRYPT);
261 if (memcmp(&(RC5plain[n][0]),buf2,8) != 0)
262 {
263 printf("ecb RC5 error decrypting (%d)\n",n+1);
264 printf("got :");
265 for (i=0; i<8; i++)
266 printf("%02X ",buf2[i]);
267 printf("\n");
268 printf("expected:");
269 for (i=0; i<8; i++)
270 printf("%02X ",RC5plain[n][i]);
271 printf("\n");
272 err=3;
273 }
274 }
275 if (err == 0) printf("ecb RC5 ok\n");
276
277 for (n=0; n<RC5_CBC_NUM; n++)
278 {
279 i=rc5_cbc_rounds[n];
280 if (i < 8) continue;
281
282 RC5_32_set_key(&key,rc5_cbc_key[n][0],&(rc5_cbc_key[n][1]),i);
283
284 memcpy(ivb,&(rc5_cbc_iv[n][0]),8);
285 RC5_32_cbc_encrypt(&(rc5_cbc_plain[n][0]),buf,8,
286 &key,&(ivb[0]),RC5_ENCRYPT);
287
288 if (memcmp(&(rc5_cbc_cipher[n][0]),buf,8) != 0)
289 {
290 printf("cbc RC5 error encrypting (%d)\n",n+1);
291 printf("got :");
292 for (i=0; i<8; i++)
293 printf("%02X ",buf[i]);
294 printf("\n");
295 printf("expected:");
296 for (i=0; i<8; i++)
297 printf("%02X ",rc5_cbc_cipher[n][i]);
298 err=30;
299 printf("\n");
300 }
301
302 memcpy(ivb,&(rc5_cbc_iv[n][0]),8);
303 RC5_32_cbc_encrypt(buf,buf2,8,
304 &key,&(ivb[0]),RC5_DECRYPT);
305 if (memcmp(&(rc5_cbc_plain[n][0]),buf2,8) != 0)
306 {
307 printf("cbc RC5 error decrypting (%d)\n",n+1);
308 printf("got :");
309 for (i=0; i<8; i++)
310 printf("%02X ",buf2[i]);
311 printf("\n");
312 printf("expected:");
313 for (i=0; i<8; i++)
314 printf("%02X ",rc5_cbc_plain[n][i]);
315 printf("\n");
316 err=3;
317 }
318 }
319 if (err == 0) printf("cbc RC5 ok\n");
320
321 EXIT(err);
322 return(err);
323 }
324
325#ifdef undef
326static int cfb64_test(unsigned char *cfb_cipher)
327 {
328 IDEA_KEY_SCHEDULE eks,dks;
329 int err=0,i,n;
330
331 idea_set_encrypt_key(cfb_key,&eks);
332 idea_set_decrypt_key(&eks,&dks);
333 memcpy(cfb_tmp,cfb_iv,8);
334 n=0;
335 idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks,
336 cfb_tmp,&n,IDEA_ENCRYPT);
337 idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
338 (long)CFB_TEST_SIZE-12,&eks,
339 cfb_tmp,&n,IDEA_ENCRYPT);
340 if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0)
341 {
342 err=1;
343 printf("idea_cfb64_encrypt encrypt error\n");
344 for (i=0; i<CFB_TEST_SIZE; i+=8)
345 printf("%s\n",pt(&(cfb_buf1[i])));
346 }
347 memcpy(cfb_tmp,cfb_iv,8);
348 n=0;
349 idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks,
350 cfb_tmp,&n,IDEA_DECRYPT);
351 idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
352 (long)CFB_TEST_SIZE-17,&dks,
353 cfb_tmp,&n,IDEA_DECRYPT);
354 if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0)
355 {
356 err=1;
357 printf("idea_cfb_encrypt decrypt error\n");
358 for (i=0; i<24; i+=8)
359 printf("%s\n",pt(&(cfb_buf2[i])));
360 }
361 return(err);
362 }
363
364static char *pt(unsigned char *p)
365 {
366 static char bufs[10][20];
367 static int bnum=0;
368 char *ret;
369 int i;
370 static char *f="0123456789ABCDEF";
371
372 ret= &(bufs[bnum++][0]);
373 bnum%=10;
374 for (i=0; i<8; i++)
375 {
376 ret[i*2]=f[(p[i]>>4)&0xf];
377 ret[i*2+1]=f[p[i]&0xf];
378 }
379 ret[16]='\0';
380 return(ret);
381 }
382
383#endif
384#endif
diff --git a/src/lib/libssl/src/crypto/ripemd/rmd160.c b/src/lib/libssl/src/crypto/ripemd/rmd160.c
deleted file mode 100644
index d0bc59d03c..0000000000
--- a/src/lib/libssl/src/crypto/ripemd/rmd160.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/* crypto/ripemd/rmd160.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <unistd.h>
60#include <stdio.h>
61#include <stdlib.h>
62#include <openssl/ripemd.h>
63
64#define BUFSIZE 1024*16
65
66void do_fp(FILE *f);
67void pt(unsigned char *md);
68
69int main(int argc, char **argv)
70 {
71 int i,err=0;
72 FILE *IN;
73
74 if (argc == 1)
75 {
76 do_fp(stdin);
77 }
78 else
79 {
80 for (i=1; i<argc; i++)
81 {
82 IN=fopen(argv[i],"r");
83 if (IN == NULL)
84 {
85 perror(argv[i]);
86 err++;
87 continue;
88 }
89 printf("RIPEMD160(%s)= ",argv[i]);
90 do_fp(IN);
91 fclose(IN);
92 }
93 }
94 exit(err);
95 }
96
97void do_fp(FILE *f)
98 {
99 RIPEMD160_CTX c;
100 unsigned char md[RIPEMD160_DIGEST_LENGTH];
101 int fd;
102 int i;
103 static unsigned char buf[BUFSIZE];
104
105 fd=fileno(f);
106 RIPEMD160_Init(&c);
107 for (;;)
108 {
109 i=read(fd,buf,BUFSIZE);
110 if (i <= 0) break;
111 RIPEMD160_Update(&c,buf,(unsigned long)i);
112 }
113 RIPEMD160_Final(&(md[0]),&c);
114 pt(md);
115 }
116
117void pt(unsigned char *md)
118 {
119 int i;
120
121 for (i=0; i<RIPEMD160_DIGEST_LENGTH; i++)
122 printf("%02x",md[i]);
123 printf("\n");
124 }
125
diff --git a/src/lib/libssl/src/crypto/x509v3/tabtest.c b/src/lib/libssl/src/crypto/x509v3/tabtest.c
deleted file mode 100644
index 6b8a211e5d..0000000000
--- a/src/lib/libssl/src/crypto/x509v3/tabtest.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/* tabtest.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59/* Simple program to check the ext_dat.h is correct and print out
60 * problems if it is not.
61 */
62
63#include <stdio.h>
64
65#include <openssl/x509v3.h>
66
67#include "ext_dat.h"
68
69main()
70{
71 int i, prev = -1, bad = 0;
72 X509V3_EXT_METHOD **tmp;
73
74 i = sizeof(standard_exts) / sizeof(X509V3_EXT_METHOD *);
75 if (i != STANDARD_EXTENSION_COUNT)
76 fprintf(stderr, "Extension number invalid expecting %d\n", i);
77 tmp = standard_exts;
78 for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) {
79 if ((*tmp)->ext_nid < prev)
80 bad = 1;
81 prev = (*tmp)->ext_nid;
82
83 }
84 if (bad) {
85 tmp = standard_exts;
86 fprintf(stderr, "Extensions out of order!\n");
87 for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++)
88 printf("%d : %s\n", (*tmp)->ext_nid,
89 OBJ_nid2sn((*tmp)->ext_nid));
90 } else
91 fprintf(stderr, "Order OK\n");
92}
diff --git a/src/lib/libssl/src/crypto/x509v3/v3conf.c b/src/lib/libssl/src/crypto/x509v3/v3conf.c
deleted file mode 100644
index cfa5fce75c..0000000000
--- a/src/lib/libssl/src/crypto/x509v3/v3conf.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/* v3conf.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stdio.h>
61#include "cryptlib.h"
62#include <openssl/asn1.h>
63#include <openssl/conf.h>
64#include <openssl/x509.h>
65#include <openssl/x509v3.h>
66
67/* Test application to add extensions from a config file */
68
69int
70main(int argc, char **argv)
71{
72 LHASH *conf;
73 X509 *cert;
74 FILE *inf;
75 char *conf_file;
76 int i;
77 int count;
78 X509_EXTENSION *ext;
79
80 X509V3_add_standard_extensions();
81 ERR_load_crypto_strings();
82 if (!argv[1]) {
83 fprintf(stderr, "Usage: v3conf cert.pem [file.cnf]\n");
84 exit(1);
85 }
86 conf_file = argv[2];
87 if (!conf_file)
88 conf_file = "test.cnf";
89 conf = CONF_load(NULL, "test.cnf", NULL);
90 if (!conf) {
91 fprintf(stderr, "Error opening Config file %s\n", conf_file);
92 ERR_print_errors_fp(stderr);
93 exit(1);
94 }
95
96 inf = fopen(argv[1], "r");
97 if (!inf) {
98 fprintf(stderr, "Can't open certificate file %s\n", argv[1]);
99 exit(1);
100 }
101 cert = PEM_read_X509(inf, NULL, NULL);
102 if (!cert) {
103 fprintf(stderr, "Error reading certificate file %s\n", argv[1]);
104 exit(1);
105 }
106 fclose(inf);
107
108 sk_pop_free(cert->cert_info->extensions, X509_EXTENSION_free);
109 cert->cert_info->extensions = NULL;
110
111 if (!X509V3_EXT_add_conf(conf, NULL, "test_section", cert)) {
112 fprintf(stderr, "Error adding extensions\n");
113 ERR_print_errors_fp(stderr);
114 exit(1);
115 }
116
117 count = X509_get_ext_count(cert);
118 printf("%d extensions\n", count);
119 for (i = 0; i < count; i++) {
120 ext = X509_get_ext(cert, i);
121 printf("%s", OBJ_nid2ln(OBJ_obj2nid(ext->object)));
122 if (ext->critical)
123 printf(",critical:\n");
124 else
125 printf(":\n");
126 X509V3_EXT_print_fp(stdout, ext, 0, 0);
127 printf("\n");
128
129 }
130 return 0;
131}
diff --git a/src/lib/libssl/src/crypto/x509v3/v3prin.c b/src/lib/libssl/src/crypto/x509v3/v3prin.c
deleted file mode 100644
index da701de132..0000000000
--- a/src/lib/libssl/src/crypto/x509v3/v3prin.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/* v3prin.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include <openssl/asn1.h>
61#include <openssl/conf.h>
62#include <openssl/x509.h>
63#include <openssl/x509v3.h>
64
65int
66main(int argc, char **argv)
67{
68 X509 *cert;
69 FILE *inf;
70 int i, count;
71 X509_EXTENSION *ext;
72
73 X509V3_add_standard_extensions();
74 ERR_load_crypto_strings();
75 if (!argv[1]) {
76 fprintf(stderr, "Usage v3prin cert.pem\n");
77 exit(1);
78 }
79 if (!(inf = fopen(argv[1], "r"))) {
80 fprintf(stderr, "Can't open %s\n", argv[1]);
81 exit(1);
82 }
83 if (!(cert = PEM_read_X509(inf, NULL, NULL))) {
84 fprintf(stderr, "Can't read certificate %s\n", argv[1]);
85 ERR_print_errors_fp(stderr);
86 exit(1);
87 }
88 fclose(inf);
89 count = X509_get_ext_count(cert);
90 printf("%d extensions\n", count);
91 for (i = 0; i < count; i++) {
92 ext = X509_get_ext(cert, i);
93 printf("%s\n", OBJ_nid2ln(OBJ_obj2nid(ext->object)));
94 if (!X509V3_EXT_print_fp(stdout, ext, 0, 0))
95 ERR_print_errors_fp(stderr);
96 printf("\n");
97
98 }
99 return 0;
100}