diff options
author | markus <> | 2002-09-03 09:21:21 +0000 |
---|---|---|
committer | markus <> | 2002-09-03 09:21:21 +0000 |
commit | 2a403cf17b91db1355403be2649b62a15f65d0b1 (patch) | |
tree | ccb7f731e62b49ca25d700356d1d89a66fce9fde /src/lib/libcrypto/asn1 | |
parent | 0417492a9cd47355e6322690a822134d099084b8 (diff) | |
download | openbsd-2a403cf17b91db1355403be2649b62a15f65d0b1.tar.gz openbsd-2a403cf17b91db1355403be2649b62a15f65d0b1.tar.bz2 openbsd-2a403cf17b91db1355403be2649b62a15f65d0b1.zip |
unused files, not part of OpenSSL 0.9.7
Diffstat (limited to 'src/lib/libcrypto/asn1')
25 files changed, 0 insertions, 3232 deletions
diff --git a/src/lib/libcrypto/asn1/a_bmp.c b/src/lib/libcrypto/asn1/a_bmp.c deleted file mode 100644 index d9ac5a0475..0000000000 --- a/src/lib/libcrypto/asn1/a_bmp.c +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* crypto/asn1/a_bmp.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 "cryptlib.h" | ||
61 | #include <openssl/asn1.h> | ||
62 | |||
63 | ASN1_BMPSTRING *ASN1_BMPSTRING_new(void) | ||
64 | { return M_ASN1_BMPSTRING_new(); } | ||
65 | |||
66 | void ASN1_BMPSTRING_free(ASN1_BMPSTRING *x) | ||
67 | { M_ASN1_BMPSTRING_free(x); } | ||
68 | |||
69 | int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp) | ||
70 | { | ||
71 | return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, | ||
72 | V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL)); | ||
73 | } | ||
74 | |||
75 | ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, unsigned char **pp, | ||
76 | long length) | ||
77 | { | ||
78 | ASN1_BMPSTRING *ret=NULL; | ||
79 | |||
80 | ret=(ASN1_BMPSTRING *)d2i_ASN1_bytes((ASN1_STRING **)a, | ||
81 | pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL); | ||
82 | if (ret == NULL) | ||
83 | { | ||
84 | ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ERR_R_NESTED_ASN1_ERROR); | ||
85 | return(NULL); | ||
86 | } | ||
87 | return(ret); | ||
88 | } | ||
89 | |||
diff --git a/src/lib/libcrypto/asn1/a_null.c b/src/lib/libcrypto/asn1/a_null.c deleted file mode 100644 index 119fd784be..0000000000 --- a/src/lib/libcrypto/asn1/a_null.c +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* a_null.c */ | ||
2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) 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 "cryptlib.h" | ||
61 | #include <openssl/asn1.h> | ||
62 | |||
63 | /* ASN1 functions for NULL type. For compatibility with other ASN1 code | ||
64 | * it returns a pointer to an "ASN1_NULL" structure. The new/free functions | ||
65 | * don't need to do any allocating because nothing is stored in a NULL. | ||
66 | */ | ||
67 | |||
68 | int i2d_ASN1_NULL(ASN1_NULL *a, unsigned char **pp) | ||
69 | { | ||
70 | if(!a) return 0; | ||
71 | if (pp) ASN1_put_object(pp,0,0,V_ASN1_NULL,V_ASN1_UNIVERSAL); | ||
72 | return 2; | ||
73 | } | ||
74 | |||
75 | ASN1_NULL *d2i_ASN1_NULL(ASN1_NULL **a, unsigned char **pp, long length) | ||
76 | { | ||
77 | ASN1_NULL *ret = NULL; | ||
78 | unsigned char *p; | ||
79 | long len; | ||
80 | int inf,tag,xclass; | ||
81 | int i=0; | ||
82 | |||
83 | p= *pp; | ||
84 | inf=ASN1_get_object(&p,&len,&tag,&xclass,length); | ||
85 | if (inf & 0x80) | ||
86 | { | ||
87 | i=ASN1_R_BAD_OBJECT_HEADER; | ||
88 | goto err; | ||
89 | } | ||
90 | |||
91 | if (tag != V_ASN1_NULL) | ||
92 | { | ||
93 | i=ASN1_R_EXPECTING_A_NULL; | ||
94 | goto err; | ||
95 | } | ||
96 | |||
97 | if (len != 0) | ||
98 | { | ||
99 | i=ASN1_R_NULL_IS_WRONG_LENGTH; | ||
100 | goto err; | ||
101 | } | ||
102 | ret=(ASN1_NULL *)1; | ||
103 | if (a != NULL) (*a)=ret; | ||
104 | *pp=p; | ||
105 | return(ret); | ||
106 | err: | ||
107 | ASN1err(ASN1_F_D2I_ASN1_NULL,i); | ||
108 | return(ret); | ||
109 | } | ||
110 | |||
111 | ASN1_NULL *ASN1_NULL_new(void) | ||
112 | { | ||
113 | return (ASN1_NULL *)1; | ||
114 | } | ||
115 | |||
116 | void ASN1_NULL_free(ASN1_NULL *a) | ||
117 | { | ||
118 | return; | ||
119 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_vis.c b/src/lib/libcrypto/asn1/a_vis.c deleted file mode 100644 index 5cfc080bec..0000000000 --- a/src/lib/libcrypto/asn1/a_vis.c +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* crypto/asn1/a_vis.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 "cryptlib.h" | ||
61 | #include <openssl/asn1.h> | ||
62 | |||
63 | ASN1_VISIBLESTRING *ASN1_VISIBLESTRING_new(void) | ||
64 | { return M_ASN1_VISIBLESTRING_new(); } | ||
65 | |||
66 | void ASN1_VISIBLESTRING_free(ASN1_VISIBLESTRING *x) | ||
67 | { M_ASN1_VISIBLESTRING_free(x); } | ||
68 | |||
69 | int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a, unsigned char **pp) | ||
70 | { | ||
71 | return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, | ||
72 | V_ASN1_VISIBLESTRING,V_ASN1_UNIVERSAL)); | ||
73 | } | ||
74 | |||
75 | ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a, | ||
76 | unsigned char **pp, long length) | ||
77 | { | ||
78 | ASN1_VISIBLESTRING *ret=NULL; | ||
79 | |||
80 | ret=(ASN1_VISIBLESTRING *)d2i_ASN1_bytes((ASN1_STRING **)a, | ||
81 | pp,length,V_ASN1_VISIBLESTRING,V_ASN1_UNIVERSAL); | ||
82 | if (ret == NULL) | ||
83 | { | ||
84 | ASN1err(ASN1_F_D2I_ASN1_VISIBLESTRING,ERR_R_NESTED_ASN1_ERROR); | ||
85 | return(NULL); | ||
86 | } | ||
87 | return(ret); | ||
88 | } | ||
89 | |||
diff --git a/src/lib/libcrypto/asn1/d2i_dhp.c b/src/lib/libcrypto/asn1/d2i_dhp.c deleted file mode 100644 index 635ae829db..0000000000 --- a/src/lib/libcrypto/asn1/d2i_dhp.c +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /* crypto/asn1/d2i_dhp.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 | #ifndef NO_DH | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/dh.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/asn1_mac.h> | ||
66 | |||
67 | DH *d2i_DHparams(DH **a, unsigned char **pp, long length) | ||
68 | { | ||
69 | int i=ERR_R_NESTED_ASN1_ERROR; | ||
70 | ASN1_INTEGER *bs=NULL; | ||
71 | long v=0; | ||
72 | M_ASN1_D2I_vars(a,DH *,DH_new); | ||
73 | |||
74 | M_ASN1_D2I_Init(); | ||
75 | M_ASN1_D2I_start_sequence(); | ||
76 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
77 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; | ||
78 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
79 | if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; | ||
80 | |||
81 | if (!M_ASN1_D2I_end_sequence()) | ||
82 | { | ||
83 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
84 | for (i=0; i<bs->length; i++) | ||
85 | v=(v<<8)|(bs->data[i]); | ||
86 | ret->length=(int)v; | ||
87 | } | ||
88 | |||
89 | M_ASN1_BIT_STRING_free(bs); | ||
90 | |||
91 | M_ASN1_D2I_Finish_2(a); | ||
92 | |||
93 | err_bn: | ||
94 | i=ERR_R_BN_LIB; | ||
95 | err: | ||
96 | ASN1err(ASN1_F_D2I_DHPARAMS,i); | ||
97 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) DH_free(ret); | ||
98 | if (bs != NULL) M_ASN1_BIT_STRING_free(bs); | ||
99 | return(NULL); | ||
100 | } | ||
101 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/d2i_dsap.c b/src/lib/libcrypto/asn1/d2i_dsap.c deleted file mode 100644 index 9d4dea6145..0000000000 --- a/src/lib/libcrypto/asn1/d2i_dsap.c +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* crypto/asn1/d2i_dsap.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 | #ifndef NO_DSA | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/dsa.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/asn1_mac.h> | ||
66 | |||
67 | #ifndef NO_NEG_PUBKEY_BUG | ||
68 | #define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER | ||
69 | #endif | ||
70 | |||
71 | DSA *d2i_DSAparams(DSA **a, unsigned char **pp, long length) | ||
72 | { | ||
73 | int i=ERR_R_NESTED_ASN1_ERROR; | ||
74 | ASN1_INTEGER *bs=NULL; | ||
75 | M_ASN1_D2I_vars(a,DSA *,DSA_new); | ||
76 | |||
77 | M_ASN1_D2I_Init(); | ||
78 | M_ASN1_D2I_start_sequence(); | ||
79 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
80 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; | ||
81 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
82 | if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; | ||
83 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
84 | if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; | ||
85 | |||
86 | M_ASN1_BIT_STRING_free(bs); | ||
87 | |||
88 | M_ASN1_D2I_Finish_2(a); | ||
89 | |||
90 | err_bn: | ||
91 | i=ERR_R_BN_LIB; | ||
92 | err: | ||
93 | ASN1err(ASN1_F_D2I_DSAPARAMS,i); | ||
94 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); | ||
95 | if (bs != NULL) M_ASN1_BIT_STRING_free(bs); | ||
96 | return(NULL); | ||
97 | } | ||
98 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/d2i_r_pr.c b/src/lib/libcrypto/asn1/d2i_r_pr.c deleted file mode 100644 index 6c8a45f821..0000000000 --- a/src/lib/libcrypto/asn1/d2i_r_pr.c +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* crypto/asn1/d2i_r_pr.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 | #ifndef NO_RSA | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/rsa.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/asn1_mac.h> | ||
66 | |||
67 | static ASN1_METHOD method={ | ||
68 | (int (*)()) i2d_RSAPrivateKey, | ||
69 | (char *(*)())d2i_RSAPrivateKey, | ||
70 | (char *(*)())RSA_new, | ||
71 | (void (*)()) RSA_free}; | ||
72 | |||
73 | ASN1_METHOD *RSAPrivateKey_asn1_meth(void) | ||
74 | { | ||
75 | return(&method); | ||
76 | } | ||
77 | |||
78 | RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length) | ||
79 | { | ||
80 | int i=ASN1_R_PARSING; | ||
81 | ASN1_INTEGER *bs=NULL; | ||
82 | M_ASN1_D2I_vars(a,RSA *,RSA_new); | ||
83 | |||
84 | M_ASN1_D2I_Init(); | ||
85 | M_ASN1_D2I_start_sequence(); | ||
86 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
87 | if (bs->length == 0) | ||
88 | ret->version=0; | ||
89 | else ret->version=bs->data[0]; | ||
90 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
91 | if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn; | ||
92 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
93 | if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn; | ||
94 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
95 | if ((ret->d=BN_bin2bn(bs->data,bs->length,ret->d)) == NULL) goto err_bn; | ||
96 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
97 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; | ||
98 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
99 | if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; | ||
100 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
101 | if ((ret->dmp1=BN_bin2bn(bs->data,bs->length,ret->dmp1)) == NULL) | ||
102 | goto err_bn; | ||
103 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
104 | if ((ret->dmq1=BN_bin2bn(bs->data,bs->length,ret->dmq1)) == NULL) | ||
105 | goto err_bn; | ||
106 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
107 | if ((ret->iqmp=BN_bin2bn(bs->data,bs->length,ret->iqmp)) == NULL) | ||
108 | goto err_bn; | ||
109 | |||
110 | M_ASN1_INTEGER_free(bs); | ||
111 | |||
112 | M_ASN1_D2I_Finish_2(a); | ||
113 | err_bn: | ||
114 | i=ERR_R_BN_LIB; | ||
115 | err: | ||
116 | ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,i); | ||
117 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); | ||
118 | if (bs != NULL) M_ASN1_INTEGER_free(bs); | ||
119 | |||
120 | return(NULL); | ||
121 | } | ||
122 | #else /* !NO_RSA */ | ||
123 | |||
124 | # if PEDANTIC | ||
125 | static void *dummy=&dummy; | ||
126 | # endif | ||
127 | |||
128 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/d2i_r_pu.c b/src/lib/libcrypto/asn1/d2i_r_pu.c deleted file mode 100644 index 9e5d41cf53..0000000000 --- a/src/lib/libcrypto/asn1/d2i_r_pu.c +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* crypto/asn1/d2i_r_pu.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 | #ifndef NO_RSA | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/rsa.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/asn1_mac.h> | ||
66 | |||
67 | #ifndef NO_NEG_PUBKEY_BUG | ||
68 | #define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER | ||
69 | #endif | ||
70 | |||
71 | RSA *d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length) | ||
72 | { | ||
73 | int i=ASN1_R_PARSING; | ||
74 | ASN1_INTEGER *bs=NULL; | ||
75 | M_ASN1_D2I_vars(a,RSA *,RSA_new); | ||
76 | |||
77 | M_ASN1_D2I_Init(); | ||
78 | M_ASN1_D2I_start_sequence(); | ||
79 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
80 | if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn; | ||
81 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
82 | if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn; | ||
83 | |||
84 | M_ASN1_INTEGER_free(bs); | ||
85 | bs=NULL; | ||
86 | |||
87 | M_ASN1_D2I_Finish_2(a); | ||
88 | |||
89 | err_bn: | ||
90 | i=ERR_R_BN_LIB; | ||
91 | err: | ||
92 | ASN1err(ASN1_F_D2I_RSAPUBLICKEY,i); | ||
93 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); | ||
94 | if (bs != NULL) M_ASN1_INTEGER_free(bs); | ||
95 | return(NULL); | ||
96 | } | ||
97 | #else /* !NO_RSA */ | ||
98 | |||
99 | # if PEDANTIC | ||
100 | static void *dummy=&dummy; | ||
101 | # endif | ||
102 | |||
103 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/d2i_s_pr.c b/src/lib/libcrypto/asn1/d2i_s_pr.c deleted file mode 100644 index 55d5802d70..0000000000 --- a/src/lib/libcrypto/asn1/d2i_s_pr.c +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | /* crypto/asn1/d2i_s_pr.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 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | ||
60 | |||
61 | #ifndef NO_DSA | ||
62 | #include <stdio.h> | ||
63 | #include "cryptlib.h" | ||
64 | #include <openssl/bn.h> | ||
65 | #include <openssl/dsa.h> | ||
66 | #include <openssl/objects.h> | ||
67 | #include <openssl/asn1_mac.h> | ||
68 | |||
69 | DSA *d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length) | ||
70 | { | ||
71 | int i=ASN1_R_PARSING; | ||
72 | ASN1_INTEGER *bs=NULL; | ||
73 | M_ASN1_D2I_vars(a,DSA *,DSA_new); | ||
74 | |||
75 | M_ASN1_D2I_Init(); | ||
76 | M_ASN1_D2I_start_sequence(); | ||
77 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
78 | if (bs->length == 0) | ||
79 | ret->version=0; | ||
80 | else ret->version=bs->data[0]; | ||
81 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
82 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn; | ||
83 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
84 | if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn; | ||
85 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
86 | if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn; | ||
87 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
88 | if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) | ||
89 | == NULL) goto err_bn; | ||
90 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
91 | if ((ret->priv_key=BN_bin2bn(bs->data,bs->length,ret->priv_key)) | ||
92 | == NULL) goto err_bn; | ||
93 | |||
94 | M_ASN1_INTEGER_free(bs); | ||
95 | bs = NULL; | ||
96 | |||
97 | M_ASN1_D2I_Finish_2(a); | ||
98 | err_bn: | ||
99 | i=ERR_R_BN_LIB; | ||
100 | err: | ||
101 | ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,i); | ||
102 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); | ||
103 | if (bs != NULL) M_ASN1_INTEGER_free(bs); | ||
104 | return(NULL); | ||
105 | } | ||
106 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/d2i_s_pu.c b/src/lib/libcrypto/asn1/d2i_s_pu.c deleted file mode 100644 index 0b7d2fafcc..0000000000 --- a/src/lib/libcrypto/asn1/d2i_s_pu.c +++ /dev/null | |||
@@ -1,121 +0,0 @@ | |||
1 | /* crypto/asn1/d2i_s_pu.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 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | ||
60 | |||
61 | #ifndef NO_DSA | ||
62 | #include <stdio.h> | ||
63 | #include "cryptlib.h" | ||
64 | #include <openssl/bn.h> | ||
65 | #include <openssl/dsa.h> | ||
66 | #include <openssl/objects.h> | ||
67 | #include <openssl/asn1_mac.h> | ||
68 | |||
69 | #ifndef NO_NEG_PUBKEY_BUG | ||
70 | #define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER | ||
71 | #endif | ||
72 | |||
73 | DSA *d2i_DSAPublicKey(DSA **a, unsigned char **pp, long length) | ||
74 | { | ||
75 | int i=ASN1_R_PARSING; | ||
76 | ASN1_INTEGER *bs=NULL; | ||
77 | M_ASN1_D2I_vars(a,DSA *,DSA_new); | ||
78 | |||
79 | M_ASN1_D2I_Init(); | ||
80 | if ((length != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) | ||
81 | == (V_ASN1_UNIVERSAL|(V_ASN1_INTEGER)))) | ||
82 | { | ||
83 | c.slen=length; | ||
84 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
85 | if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) | ||
86 | == NULL) | ||
87 | goto err_bn; | ||
88 | ret->write_params=0; | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | M_ASN1_D2I_start_sequence(); | ||
93 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
94 | if ((ret->pub_key=BN_bin2bn(bs->data,bs->length,ret->pub_key)) | ||
95 | == NULL) | ||
96 | goto err_bn; | ||
97 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
98 | if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) | ||
99 | goto err_bn; | ||
100 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
101 | if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) | ||
102 | goto err_bn; | ||
103 | M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER); | ||
104 | if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) | ||
105 | goto err_bn; | ||
106 | |||
107 | ret->write_params=1; | ||
108 | } | ||
109 | |||
110 | M_ASN1_INTEGER_free(bs); | ||
111 | bs=NULL; | ||
112 | M_ASN1_D2I_Finish_2(a); | ||
113 | err_bn: | ||
114 | i=ERR_R_BN_LIB; | ||
115 | err: | ||
116 | ASN1err(ASN1_F_D2I_DSAPUBLICKEY,i); | ||
117 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret); | ||
118 | if (bs != NULL) M_ASN1_INTEGER_free(bs); | ||
119 | return(NULL); | ||
120 | } | ||
121 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/i2d_dhp.c b/src/lib/libcrypto/asn1/i2d_dhp.c deleted file mode 100644 index b1de17fe07..0000000000 --- a/src/lib/libcrypto/asn1/i2d_dhp.c +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* crypto/asn1/i2d_dhp.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 | #ifndef NO_DH | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/asn1_mac.h> | ||
64 | #include <openssl/dh.h> | ||
65 | |||
66 | int i2d_DHparams(DH *a, unsigned char **pp) | ||
67 | { | ||
68 | BIGNUM *num[3]; | ||
69 | ASN1_INTEGER bs; | ||
70 | unsigned int j,i,tot=0,len,max=0; | ||
71 | int t,ret= -1; | ||
72 | unsigned char *p; | ||
73 | |||
74 | if (a == NULL) return(0); | ||
75 | num[0]=a->p; | ||
76 | num[1]=a->g; | ||
77 | if (a->length != 0) | ||
78 | { | ||
79 | if ((num[2]=BN_new()) == NULL) goto err; | ||
80 | if (!BN_set_word(num[2],a->length)) goto err; | ||
81 | } | ||
82 | else | ||
83 | num[2]=NULL; | ||
84 | |||
85 | for (i=0; i<3; i++) | ||
86 | { | ||
87 | if (num[i] == NULL) continue; | ||
88 | j=BN_num_bits(num[i]); | ||
89 | len=((j == 0)?0:((j/8)+1)); | ||
90 | if (len > max) max=len; | ||
91 | len=ASN1_object_size(0,len, | ||
92 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
93 | tot+=len; | ||
94 | } | ||
95 | |||
96 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
97 | if (pp == NULL) | ||
98 | { | ||
99 | if (num[2] != NULL) | ||
100 | BN_free(num[2]); | ||
101 | return(t); | ||
102 | } | ||
103 | |||
104 | p= *pp; | ||
105 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
106 | |||
107 | bs.type=V_ASN1_INTEGER; | ||
108 | bs.data=(unsigned char *)OPENSSL_malloc(max+4); | ||
109 | if (bs.data == NULL) | ||
110 | { | ||
111 | ASN1err(ASN1_F_I2D_DHPARAMS,ERR_R_MALLOC_FAILURE); | ||
112 | goto err; | ||
113 | } | ||
114 | |||
115 | for (i=0; i<3; i++) | ||
116 | { | ||
117 | if (num[i] == NULL) continue; | ||
118 | bs.length=BN_bn2bin(num[i],bs.data); | ||
119 | i2d_ASN1_INTEGER(&bs,&p); | ||
120 | } | ||
121 | OPENSSL_free(bs.data); | ||
122 | ret=t; | ||
123 | err: | ||
124 | if (num[2] != NULL) BN_free(num[2]); | ||
125 | *pp=p; | ||
126 | return(ret); | ||
127 | } | ||
128 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/i2d_dsap.c b/src/lib/libcrypto/asn1/i2d_dsap.c deleted file mode 100644 index 157fb43893..0000000000 --- a/src/lib/libcrypto/asn1/i2d_dsap.c +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* crypto/asn1/i2d_dsap.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 | #ifndef NO_DSA | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/asn1_mac.h> | ||
64 | #include <openssl/dsa.h> | ||
65 | |||
66 | int i2d_DSAparams(DSA *a, unsigned char **pp) | ||
67 | { | ||
68 | BIGNUM *num[3]; | ||
69 | ASN1_INTEGER bs; | ||
70 | unsigned int j,i,tot=0,len,max=0; | ||
71 | int t,ret= -1; | ||
72 | unsigned char *p; | ||
73 | |||
74 | if (a == NULL) return(0); | ||
75 | num[0]=a->p; | ||
76 | num[1]=a->q; | ||
77 | num[2]=a->g; | ||
78 | |||
79 | for (i=0; i<3; i++) | ||
80 | { | ||
81 | if (num[i] == NULL) continue; | ||
82 | j=BN_num_bits(num[i]); | ||
83 | len=((j == 0)?0:((j/8)+1)); | ||
84 | if (len > max) max=len; | ||
85 | len=ASN1_object_size(0,len, | ||
86 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
87 | tot+=len; | ||
88 | } | ||
89 | |||
90 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
91 | if (pp == NULL) return(t); | ||
92 | |||
93 | p= *pp; | ||
94 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
95 | |||
96 | bs.type=V_ASN1_INTEGER; | ||
97 | bs.data=(unsigned char *)OPENSSL_malloc(max+4); | ||
98 | if (bs.data == NULL) | ||
99 | { | ||
100 | ASN1err(ASN1_F_I2D_DSAPARAMS,ERR_R_MALLOC_FAILURE); | ||
101 | goto err; | ||
102 | } | ||
103 | |||
104 | for (i=0; i<3; i++) | ||
105 | { | ||
106 | if (num[i] == NULL) continue; | ||
107 | bs.length=BN_bn2bin(num[i],bs.data); | ||
108 | i2d_ASN1_INTEGER(&bs,&p); | ||
109 | } | ||
110 | OPENSSL_free(bs.data); | ||
111 | ret=t; | ||
112 | err: | ||
113 | *pp=p; | ||
114 | return(ret); | ||
115 | } | ||
116 | #endif | ||
117 | |||
diff --git a/src/lib/libcrypto/asn1/i2d_r_pr.c b/src/lib/libcrypto/asn1/i2d_r_pr.c deleted file mode 100644 index 88b1aac989..0000000000 --- a/src/lib/libcrypto/asn1/i2d_r_pr.c +++ /dev/null | |||
@@ -1,133 +0,0 @@ | |||
1 | /* crypto/asn1/i2d_r_pr.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 | #ifndef NO_RSA | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/rsa.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/asn1_mac.h> | ||
66 | |||
67 | int i2d_RSAPrivateKey(RSA *a, unsigned char **pp) | ||
68 | { | ||
69 | BIGNUM *num[9]; | ||
70 | unsigned char data[1]; | ||
71 | ASN1_INTEGER bs; | ||
72 | unsigned int j,i,tot,t,len,max=0; | ||
73 | unsigned char *p; | ||
74 | |||
75 | if (a == NULL) return(0); | ||
76 | |||
77 | num[1]=a->n; | ||
78 | num[2]=a->e; | ||
79 | num[3]=a->d; | ||
80 | num[4]=a->p; | ||
81 | num[5]=a->q; | ||
82 | num[6]=a->dmp1; | ||
83 | num[7]=a->dmq1; | ||
84 | num[8]=a->iqmp; | ||
85 | |||
86 | bs.length=1; | ||
87 | bs.data=data; | ||
88 | bs.type=V_ASN1_INTEGER; | ||
89 | data[0]=a->version&0x7f; | ||
90 | |||
91 | tot=i2d_ASN1_INTEGER(&(bs),NULL); | ||
92 | for (i=1; i<9; i++) | ||
93 | { | ||
94 | j=BN_num_bits(num[i]); | ||
95 | len=((j == 0)?0:((j/8)+1)); | ||
96 | if (len > max) max=len; | ||
97 | len=ASN1_object_size(0,len, | ||
98 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
99 | tot+=len; | ||
100 | } | ||
101 | |||
102 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
103 | if (pp == NULL) return(t); | ||
104 | |||
105 | p= *pp; | ||
106 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
107 | |||
108 | i2d_ASN1_INTEGER(&bs,&p); | ||
109 | |||
110 | bs.data=(unsigned char *)OPENSSL_malloc(max+4); | ||
111 | if (bs.data == NULL) | ||
112 | { | ||
113 | ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ERR_R_MALLOC_FAILURE); | ||
114 | return(-1); | ||
115 | } | ||
116 | |||
117 | for (i=1; i<9; i++) | ||
118 | { | ||
119 | bs.length=BN_bn2bin(num[i],bs.data); | ||
120 | i2d_ASN1_INTEGER(&bs,&p); | ||
121 | } | ||
122 | OPENSSL_free(bs.data); | ||
123 | *pp=p; | ||
124 | return(t); | ||
125 | } | ||
126 | #else /* !NO_RSA */ | ||
127 | |||
128 | # if PEDANTIC | ||
129 | static void *dummy=&dummy; | ||
130 | # endif | ||
131 | |||
132 | #endif | ||
133 | |||
diff --git a/src/lib/libcrypto/asn1/i2d_r_pu.c b/src/lib/libcrypto/asn1/i2d_r_pu.c deleted file mode 100644 index 8178c2c3b3..0000000000 --- a/src/lib/libcrypto/asn1/i2d_r_pu.c +++ /dev/null | |||
@@ -1,118 +0,0 @@ | |||
1 | /* crypto/asn1/i2d_r_pu.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 | #ifndef NO_RSA | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/rsa.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/asn1_mac.h> | ||
66 | |||
67 | int i2d_RSAPublicKey(RSA *a, unsigned char **pp) | ||
68 | { | ||
69 | BIGNUM *num[2]; | ||
70 | ASN1_INTEGER bs; | ||
71 | unsigned int j,i,tot=0,len,max=0,t; | ||
72 | unsigned char *p; | ||
73 | |||
74 | if (a == NULL) return(0); | ||
75 | |||
76 | num[0]=a->n; | ||
77 | num[1]=a->e; | ||
78 | |||
79 | for (i=0; i<2; i++) | ||
80 | { | ||
81 | j=BN_num_bits(num[i]); | ||
82 | len=((j == 0)?0:((j/8)+1)); | ||
83 | if (len > max) max=len; | ||
84 | len=ASN1_object_size(0,len, | ||
85 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
86 | tot+=len; | ||
87 | } | ||
88 | |||
89 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
90 | if (pp == NULL) return(t); | ||
91 | |||
92 | p= *pp; | ||
93 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
94 | |||
95 | bs.type=V_ASN1_INTEGER; | ||
96 | bs.data=(unsigned char *)OPENSSL_malloc(max+4); | ||
97 | if (bs.data == NULL) | ||
98 | { | ||
99 | ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ERR_R_MALLOC_FAILURE); | ||
100 | return(-1); | ||
101 | } | ||
102 | |||
103 | for (i=0; i<2; i++) | ||
104 | { | ||
105 | bs.length=BN_bn2bin(num[i],bs.data); | ||
106 | i2d_ASN1_INTEGER(&bs,&p); | ||
107 | } | ||
108 | OPENSSL_free(bs.data); | ||
109 | *pp=p; | ||
110 | return(t); | ||
111 | } | ||
112 | #else /* !NO_RSA */ | ||
113 | |||
114 | # if PEDANTIC | ||
115 | static void *dummy=&dummy; | ||
116 | # endif | ||
117 | |||
118 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/i2d_s_pr.c b/src/lib/libcrypto/asn1/i2d_s_pr.c deleted file mode 100644 index 9922952ad7..0000000000 --- a/src/lib/libcrypto/asn1/i2d_s_pr.c +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* crypto/asn1/i2d_s_pr.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 | #ifndef NO_DSA | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/dsa.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/asn1_mac.h> | ||
66 | |||
67 | int i2d_DSAPrivateKey(DSA *a, unsigned char **pp) | ||
68 | { | ||
69 | BIGNUM *num[6]; | ||
70 | unsigned char data[1]; | ||
71 | ASN1_INTEGER bs; | ||
72 | unsigned int j,i,tot,t,len,max=0; | ||
73 | unsigned char *p; | ||
74 | |||
75 | if (a == NULL) return(0); | ||
76 | |||
77 | num[1]=a->p; | ||
78 | num[2]=a->q; | ||
79 | num[3]=a->g; | ||
80 | num[4]=a->pub_key; | ||
81 | num[5]=a->priv_key; | ||
82 | |||
83 | bs.length=1; | ||
84 | bs.data=data; | ||
85 | bs.type=V_ASN1_INTEGER; | ||
86 | data[0]=a->version&0x7f; | ||
87 | |||
88 | tot=i2d_ASN1_INTEGER(&(bs),NULL); | ||
89 | for (i=1; i<6; i++) | ||
90 | { | ||
91 | j=BN_num_bits(num[i]); | ||
92 | len=((j == 0)?0:((j/8)+1)); | ||
93 | if (len > max) max=len; | ||
94 | len=ASN1_object_size(0,len, | ||
95 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
96 | tot+=len; | ||
97 | } | ||
98 | |||
99 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
100 | if (pp == NULL) return(t); | ||
101 | |||
102 | p= *pp; | ||
103 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
104 | |||
105 | i2d_ASN1_INTEGER(&bs,&p); | ||
106 | |||
107 | bs.data=(unsigned char *)OPENSSL_malloc(max+4); | ||
108 | if (bs.data == NULL) | ||
109 | { | ||
110 | ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ERR_R_MALLOC_FAILURE); | ||
111 | return(-1); | ||
112 | } | ||
113 | |||
114 | for (i=1; i<6; i++) | ||
115 | { | ||
116 | bs.length=BN_bn2bin(num[i],bs.data); | ||
117 | i2d_ASN1_INTEGER(&bs,&p); | ||
118 | } | ||
119 | OPENSSL_free(bs.data); | ||
120 | *pp=p; | ||
121 | return(t); | ||
122 | } | ||
123 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/i2d_s_pu.c b/src/lib/libcrypto/asn1/i2d_s_pu.c deleted file mode 100644 index e6014b82a8..0000000000 --- a/src/lib/libcrypto/asn1/i2d_s_pu.c +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | /* crypto/asn1/i2d_s_pu.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 | #ifndef NO_DSA | ||
60 | #include <stdio.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/bn.h> | ||
63 | #include <openssl/dsa.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/asn1_mac.h> | ||
66 | |||
67 | int i2d_DSAPublicKey(DSA *a, unsigned char **pp) | ||
68 | { | ||
69 | BIGNUM *num[4]; | ||
70 | ASN1_INTEGER bs; | ||
71 | unsigned int j,i,tot=0,len,max=0,t=0,all,n=1; | ||
72 | unsigned char *p; | ||
73 | |||
74 | if (a == NULL) return(0); | ||
75 | |||
76 | all=a->write_params; | ||
77 | |||
78 | num[0]=a->pub_key; | ||
79 | if (all) | ||
80 | { | ||
81 | num[1]=a->p; | ||
82 | num[2]=a->q; | ||
83 | num[3]=a->g; | ||
84 | n=4; | ||
85 | } | ||
86 | |||
87 | for (i=0; i<n; i++) | ||
88 | { | ||
89 | j=BN_num_bits(num[i]); | ||
90 | len=((j == 0)?0:((j/8)+1)); | ||
91 | if (len > max) max=len; | ||
92 | len=ASN1_object_size(0,len, | ||
93 | (num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER); | ||
94 | tot+=len; | ||
95 | } | ||
96 | |||
97 | if (all) | ||
98 | { | ||
99 | t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); | ||
100 | if (pp == NULL) return(t); | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | if (pp == NULL) return(tot); | ||
105 | } | ||
106 | |||
107 | p= *pp; | ||
108 | if (all) | ||
109 | ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
110 | |||
111 | bs.type=V_ASN1_INTEGER; | ||
112 | bs.data=(unsigned char *)OPENSSL_malloc(max+4); | ||
113 | if (bs.data == NULL) | ||
114 | { | ||
115 | ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ERR_R_MALLOC_FAILURE); | ||
116 | return(-1); | ||
117 | } | ||
118 | |||
119 | for (i=0; i<n; i++) | ||
120 | { | ||
121 | bs.length=BN_bn2bin(num[i],bs.data); | ||
122 | i2d_ASN1_INTEGER(&bs,&p); | ||
123 | } | ||
124 | OPENSSL_free(bs.data); | ||
125 | *pp=p; | ||
126 | if(all) return(t); | ||
127 | else return(tot); | ||
128 | } | ||
129 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/p7_dgst.c b/src/lib/libcrypto/asn1/p7_dgst.c deleted file mode 100644 index c170244616..0000000000 --- a/src/lib/libcrypto/asn1/p7_dgst.c +++ /dev/null | |||
@@ -1,121 +0,0 @@ | |||
1 | /* crypto/asn1/p7_dgst.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_DIGEST(PKCS7_DIGEST *a, unsigned char **pp) | ||
65 | { | ||
66 | M_ASN1_I2D_vars(a); | ||
67 | |||
68 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
69 | M_ASN1_I2D_len(a->md,i2d_X509_ALGOR); | ||
70 | M_ASN1_I2D_len(a->contents,i2d_PKCS7); | ||
71 | M_ASN1_I2D_len(a->digest,i2d_ASN1_OCTET_STRING); | ||
72 | |||
73 | M_ASN1_I2D_seq_total(); | ||
74 | |||
75 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_put(a->md,i2d_X509_ALGOR); | ||
77 | M_ASN1_I2D_put(a->contents,i2d_PKCS7); | ||
78 | M_ASN1_I2D_put(a->digest,i2d_ASN1_OCTET_STRING); | ||
79 | |||
80 | M_ASN1_I2D_finish(); | ||
81 | } | ||
82 | |||
83 | PKCS7_DIGEST *d2i_PKCS7_DIGEST(PKCS7_DIGEST **a, unsigned char **pp, | ||
84 | long length) | ||
85 | { | ||
86 | M_ASN1_D2I_vars(a,PKCS7_DIGEST *,PKCS7_DIGEST_new); | ||
87 | |||
88 | M_ASN1_D2I_Init(); | ||
89 | M_ASN1_D2I_start_sequence(); | ||
90 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
91 | M_ASN1_D2I_get(ret->md,d2i_X509_ALGOR); | ||
92 | M_ASN1_D2I_get(ret->contents,d2i_PKCS7); | ||
93 | M_ASN1_D2I_get(ret->digest,d2i_ASN1_OCTET_STRING); | ||
94 | |||
95 | M_ASN1_D2I_Finish(a,PKCS7_DIGEST_free,ASN1_F_D2I_PKCS7_DIGEST); | ||
96 | } | ||
97 | |||
98 | PKCS7_DIGEST *PKCS7_DIGEST_new(void) | ||
99 | { | ||
100 | PKCS7_DIGEST *ret=NULL; | ||
101 | ASN1_CTX c; | ||
102 | |||
103 | M_ASN1_New_Malloc(ret,PKCS7_DIGEST); | ||
104 | M_ASN1_New(ret->version,M_ASN1_INTEGER_new); | ||
105 | M_ASN1_New(ret->md,X509_ALGOR_new); | ||
106 | M_ASN1_New(ret->contents,PKCS7_new); | ||
107 | M_ASN1_New(ret->digest,M_ASN1_OCTET_STRING_new); | ||
108 | return(ret); | ||
109 | M_ASN1_New_Error(ASN1_F_PKCS7_DIGEST_NEW); | ||
110 | } | ||
111 | |||
112 | void PKCS7_DIGEST_free(PKCS7_DIGEST *a) | ||
113 | { | ||
114 | if (a == NULL) return; | ||
115 | M_ASN1_INTEGER_free(a->version); | ||
116 | X509_ALGOR_free(a->md); | ||
117 | PKCS7_free(a->contents); | ||
118 | M_ASN1_OCTET_STRING_free(a->digest); | ||
119 | OPENSSL_free(a); | ||
120 | } | ||
121 | |||
diff --git a/src/lib/libcrypto/asn1/p7_enc.c b/src/lib/libcrypto/asn1/p7_enc.c deleted file mode 100644 index 38ccafbdb0..0000000000 --- a/src/lib/libcrypto/asn1/p7_enc.c +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | /* crypto/asn1/p7_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 | |||
59 | #include <stdio.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_ENCRYPT(PKCS7_ENCRYPT *a, unsigned char **pp) | ||
65 | { | ||
66 | M_ASN1_I2D_vars(a); | ||
67 | |||
68 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
69 | M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
70 | |||
71 | M_ASN1_I2D_seq_total(); | ||
72 | |||
73 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
74 | M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
75 | |||
76 | M_ASN1_I2D_finish(); | ||
77 | } | ||
78 | |||
79 | PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(PKCS7_ENCRYPT **a, unsigned char **pp, | ||
80 | long length) | ||
81 | { | ||
82 | M_ASN1_D2I_vars(a,PKCS7_ENCRYPT *,PKCS7_ENCRYPT_new); | ||
83 | |||
84 | M_ASN1_D2I_Init(); | ||
85 | M_ASN1_D2I_start_sequence(); | ||
86 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
87 | M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); | ||
88 | |||
89 | M_ASN1_D2I_Finish(a,PKCS7_ENCRYPT_free,ASN1_F_D2I_PKCS7_ENCRYPT); | ||
90 | } | ||
91 | |||
92 | PKCS7_ENCRYPT *PKCS7_ENCRYPT_new(void) | ||
93 | { | ||
94 | PKCS7_ENCRYPT *ret=NULL; | ||
95 | ASN1_CTX c; | ||
96 | |||
97 | M_ASN1_New_Malloc(ret,PKCS7_ENCRYPT); | ||
98 | M_ASN1_New(ret->version,M_ASN1_INTEGER_new); | ||
99 | M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); | ||
100 | return(ret); | ||
101 | M_ASN1_New_Error(ASN1_F_PKCS7_ENCRYPT_NEW); | ||
102 | } | ||
103 | |||
104 | void PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *a) | ||
105 | { | ||
106 | if (a == NULL) return; | ||
107 | M_ASN1_INTEGER_free(a->version); | ||
108 | PKCS7_ENC_CONTENT_free(a->enc_data); | ||
109 | OPENSSL_free(a); | ||
110 | } | ||
111 | |||
diff --git a/src/lib/libcrypto/asn1/p7_enc_c.c b/src/lib/libcrypto/asn1/p7_enc_c.c deleted file mode 100644 index 031178ab52..0000000000 --- a/src/lib/libcrypto/asn1/p7_enc_c.c +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | /* crypto/asn1/p7_enc_c.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT *a, unsigned char **pp) | ||
65 | { | ||
66 | M_ASN1_I2D_vars(a); | ||
67 | |||
68 | M_ASN1_I2D_len(a->content_type,i2d_ASN1_OBJECT); | ||
69 | M_ASN1_I2D_len(a->algorithm,i2d_X509_ALGOR); | ||
70 | M_ASN1_I2D_len_IMP_opt(a->enc_data,i2d_ASN1_OCTET_STRING); | ||
71 | |||
72 | M_ASN1_I2D_seq_total(); | ||
73 | |||
74 | M_ASN1_I2D_put(a->content_type,i2d_ASN1_OBJECT); | ||
75 | M_ASN1_I2D_put(a->algorithm,i2d_X509_ALGOR); | ||
76 | M_ASN1_I2D_put_IMP_opt(a->enc_data,i2d_ASN1_OCTET_STRING,0); | ||
77 | |||
78 | M_ASN1_I2D_finish(); | ||
79 | } | ||
80 | |||
81 | PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT **a, | ||
82 | unsigned char **pp, long length) | ||
83 | { | ||
84 | M_ASN1_D2I_vars(a,PKCS7_ENC_CONTENT *,PKCS7_ENC_CONTENT_new); | ||
85 | |||
86 | M_ASN1_D2I_Init(); | ||
87 | M_ASN1_D2I_start_sequence(); | ||
88 | M_ASN1_D2I_get(ret->content_type,d2i_ASN1_OBJECT); | ||
89 | M_ASN1_D2I_get(ret->algorithm,d2i_X509_ALGOR); | ||
90 | M_ASN1_D2I_get_IMP_opt(ret->enc_data,d2i_ASN1_OCTET_STRING,0, | ||
91 | V_ASN1_OCTET_STRING); | ||
92 | |||
93 | M_ASN1_D2I_Finish(a,PKCS7_ENC_CONTENT_free, | ||
94 | ASN1_F_D2I_PKCS7_ENC_CONTENT); | ||
95 | } | ||
96 | |||
97 | PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new(void) | ||
98 | { | ||
99 | PKCS7_ENC_CONTENT *ret=NULL; | ||
100 | ASN1_CTX c; | ||
101 | |||
102 | M_ASN1_New_Malloc(ret,PKCS7_ENC_CONTENT); | ||
103 | /* M_ASN1_New(ret->content_type,ASN1_OBJECT_new); */ | ||
104 | /* We will almost always want this: so make it the default */ | ||
105 | ret->content_type=OBJ_nid2obj(NID_pkcs7_data); | ||
106 | M_ASN1_New(ret->algorithm,X509_ALGOR_new); | ||
107 | ret->enc_data=NULL; | ||
108 | return(ret); | ||
109 | M_ASN1_New_Error(ASN1_F_PKCS7_ENC_CONTENT_NEW); | ||
110 | } | ||
111 | |||
112 | void PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *a) | ||
113 | { | ||
114 | if (a == NULL) return; | ||
115 | ASN1_OBJECT_free(a->content_type); | ||
116 | X509_ALGOR_free(a->algorithm); | ||
117 | M_ASN1_OCTET_STRING_free(a->enc_data); | ||
118 | OPENSSL_free(a); | ||
119 | } | ||
120 | |||
diff --git a/src/lib/libcrypto/asn1/p7_evp.c b/src/lib/libcrypto/asn1/p7_evp.c deleted file mode 100644 index 60be3e5f66..0000000000 --- a/src/lib/libcrypto/asn1/p7_evp.c +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* crypto/asn1/p7_evp.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_ENVELOPE(PKCS7_ENVELOPE *a, unsigned char **pp) | ||
65 | { | ||
66 | M_ASN1_I2D_vars(a); | ||
67 | |||
68 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
69 | M_ASN1_I2D_len_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, | ||
70 | i2d_PKCS7_RECIP_INFO); | ||
71 | M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
72 | |||
73 | M_ASN1_I2D_seq_total(); | ||
74 | |||
75 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_put_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, | ||
77 | i2d_PKCS7_RECIP_INFO); | ||
78 | M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
79 | |||
80 | M_ASN1_I2D_finish(); | ||
81 | } | ||
82 | |||
83 | PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(PKCS7_ENVELOPE **a, unsigned char **pp, | ||
84 | long length) | ||
85 | { | ||
86 | M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new); | ||
87 | |||
88 | M_ASN1_D2I_Init(); | ||
89 | M_ASN1_D2I_start_sequence(); | ||
90 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
91 | M_ASN1_D2I_get_set_type(PKCS7_RECIP_INFO,ret->recipientinfo, | ||
92 | d2i_PKCS7_RECIP_INFO,PKCS7_RECIP_INFO_free); | ||
93 | M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); | ||
94 | |||
95 | M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE); | ||
96 | } | ||
97 | |||
98 | PKCS7_ENVELOPE *PKCS7_ENVELOPE_new(void) | ||
99 | { | ||
100 | PKCS7_ENVELOPE *ret=NULL; | ||
101 | ASN1_CTX c; | ||
102 | |||
103 | M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE); | ||
104 | M_ASN1_New(ret->version,M_ASN1_INTEGER_new); | ||
105 | M_ASN1_New(ret->recipientinfo,sk_PKCS7_RECIP_INFO_new_null); | ||
106 | M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); | ||
107 | return(ret); | ||
108 | M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW); | ||
109 | } | ||
110 | |||
111 | void PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *a) | ||
112 | { | ||
113 | if (a == NULL) return; | ||
114 | M_ASN1_INTEGER_free(a->version); | ||
115 | sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); | ||
116 | PKCS7_ENC_CONTENT_free(a->enc_data); | ||
117 | OPENSSL_free(a); | ||
118 | } | ||
119 | |||
diff --git a/src/lib/libcrypto/asn1/p7_i_s.c b/src/lib/libcrypto/asn1/p7_i_s.c deleted file mode 100644 index 4a7260a5c8..0000000000 --- a/src/lib/libcrypto/asn1/p7_i_s.c +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | /* crypto/asn1/p7_i_s.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL *a, | ||
65 | unsigned char **pp) | ||
66 | { | ||
67 | M_ASN1_I2D_vars(a); | ||
68 | |||
69 | M_ASN1_I2D_len(a->issuer,i2d_X509_NAME); | ||
70 | M_ASN1_I2D_len(a->serial,i2d_ASN1_INTEGER); | ||
71 | |||
72 | M_ASN1_I2D_seq_total(); | ||
73 | |||
74 | M_ASN1_I2D_put(a->issuer,i2d_X509_NAME); | ||
75 | M_ASN1_I2D_put(a->serial,i2d_ASN1_INTEGER); | ||
76 | |||
77 | M_ASN1_I2D_finish(); | ||
78 | } | ||
79 | |||
80 | PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL **a, unsigned char **pp, long length) | ||
81 | { | ||
82 | M_ASN1_D2I_vars(a,PKCS7_ISSUER_AND_SERIAL *,PKCS7_ISSUER_AND_SERIAL_new); | ||
83 | |||
84 | M_ASN1_D2I_Init(); | ||
85 | M_ASN1_D2I_start_sequence(); | ||
86 | M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME); | ||
87 | M_ASN1_D2I_get(ret->serial,d2i_ASN1_INTEGER); | ||
88 | M_ASN1_D2I_Finish(a,PKCS7_ISSUER_AND_SERIAL_free, | ||
89 | ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL); | ||
90 | } | ||
91 | |||
92 | PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new(void) | ||
93 | { | ||
94 | PKCS7_ISSUER_AND_SERIAL *ret=NULL; | ||
95 | ASN1_CTX c; | ||
96 | |||
97 | M_ASN1_New_Malloc(ret,PKCS7_ISSUER_AND_SERIAL); | ||
98 | M_ASN1_New(ret->issuer,X509_NAME_new); | ||
99 | M_ASN1_New(ret->serial,M_ASN1_INTEGER_new); | ||
100 | return(ret); | ||
101 | M_ASN1_New_Error(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW); | ||
102 | } | ||
103 | |||
104 | void PKCS7_ISSUER_AND_SERIAL_free(PKCS7_ISSUER_AND_SERIAL *a) | ||
105 | { | ||
106 | if (a == NULL) return; | ||
107 | X509_NAME_free(a->issuer); | ||
108 | M_ASN1_INTEGER_free(a->serial); | ||
109 | OPENSSL_free(a); | ||
110 | } | ||
111 | |||
diff --git a/src/lib/libcrypto/asn1/p7_lib.c b/src/lib/libcrypto/asn1/p7_lib.c deleted file mode 100644 index 8a340b0119..0000000000 --- a/src/lib/libcrypto/asn1/p7_lib.c +++ /dev/null | |||
@@ -1,393 +0,0 @@ | |||
1 | /* crypto/asn1/p7_lib.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/pkcs7.h> | ||
63 | #include <openssl/objects.h> | ||
64 | |||
65 | #ifdef PKCS7_INDEFINITE_ENCODING | ||
66 | |||
67 | int i2d_PKCS7(PKCS7 *a, unsigned char **pp) | ||
68 | { | ||
69 | M_ASN1_I2D_vars(a); | ||
70 | |||
71 | if (a->asn1 != NULL) | ||
72 | { | ||
73 | if (pp == NULL) | ||
74 | return((int)a->length); | ||
75 | memcpy(*pp,a->asn1,(int)a->length); | ||
76 | *pp+=a->length; | ||
77 | return((int)a->length); | ||
78 | } | ||
79 | |||
80 | ret+=4; /* sequence, BER header plus '0 0' end padding */ | ||
81 | M_ASN1_I2D_len(a->type,i2d_ASN1_OBJECT); | ||
82 | if (a->d.ptr != NULL) | ||
83 | { | ||
84 | ret+=4; /* explicit tag [ 0 ] BER plus '0 0' */ | ||
85 | switch (OBJ_obj2nid(a->type)) | ||
86 | { | ||
87 | case NID_pkcs7_data: | ||
88 | M_ASN1_I2D_len(a->d.data,i2d_ASN1_OCTET_STRING); | ||
89 | break; | ||
90 | case NID_pkcs7_signed: | ||
91 | M_ASN1_I2D_len(a->d.sign,i2d_PKCS7_SIGNED); | ||
92 | break; | ||
93 | case NID_pkcs7_enveloped: | ||
94 | M_ASN1_I2D_len(a->d.enveloped,i2d_PKCS7_ENVELOPE); | ||
95 | break; | ||
96 | case NID_pkcs7_signedAndEnveloped: | ||
97 | M_ASN1_I2D_len(a->d.signed_and_enveloped, | ||
98 | i2d_PKCS7_SIGN_ENVELOPE); | ||
99 | break; | ||
100 | case NID_pkcs7_digest: | ||
101 | M_ASN1_I2D_len(a->d.digest,i2d_PKCS7_DIGEST); | ||
102 | break; | ||
103 | case NID_pkcs7_encrypted: | ||
104 | M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT); | ||
105 | break; | ||
106 | default: | ||
107 | M_ASN1_I2D_len(a->d.other,i2d_ASN1_TYPE); | ||
108 | break; | ||
109 | } | ||
110 | } | ||
111 | r=ret; | ||
112 | if (pp == NULL) return(r); | ||
113 | p= *pp; | ||
114 | M_ASN1_I2D_INF_seq_start(V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
115 | M_ASN1_I2D_put(a->type,i2d_ASN1_OBJECT); | ||
116 | |||
117 | if (a->d.ptr != NULL) | ||
118 | { | ||
119 | M_ASN1_I2D_INF_seq_start(0,V_ASN1_CONTEXT_SPECIFIC); | ||
120 | switch (OBJ_obj2nid(a->type)) | ||
121 | { | ||
122 | case NID_pkcs7_data: | ||
123 | M_ASN1_I2D_put(a->d.data,i2d_ASN1_OCTET_STRING); | ||
124 | break; | ||
125 | case NID_pkcs7_signed: | ||
126 | M_ASN1_I2D_put(a->d.sign,i2d_PKCS7_SIGNED); | ||
127 | break; | ||
128 | case NID_pkcs7_enveloped: | ||
129 | M_ASN1_I2D_put(a->d.enveloped,i2d_PKCS7_ENVELOPE); | ||
130 | break; | ||
131 | case NID_pkcs7_signedAndEnveloped: | ||
132 | M_ASN1_I2D_put(a->d.signed_and_enveloped, | ||
133 | i2d_PKCS7_SIGN_ENVELOPE); | ||
134 | break; | ||
135 | case NID_pkcs7_digest: | ||
136 | M_ASN1_I2D_put(a->d.digest,i2d_PKCS7_DIGEST); | ||
137 | break; | ||
138 | case NID_pkcs7_encrypted: | ||
139 | M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT); | ||
140 | break; | ||
141 | default: | ||
142 | M_ASN1_I2D_put(a->d.other,i2d_ASN1_TYPE); | ||
143 | break; | ||
144 | } | ||
145 | M_ASN1_I2D_INF_seq_end(); | ||
146 | } | ||
147 | M_ASN1_I2D_INF_seq_end(); | ||
148 | M_ASN1_I2D_finish(); | ||
149 | } | ||
150 | |||
151 | #else | ||
152 | |||
153 | int i2d_PKCS7(PKCS7 *a, unsigned char **pp) | ||
154 | { | ||
155 | int explen = 0; | ||
156 | M_ASN1_I2D_vars(a); | ||
157 | |||
158 | if (a->asn1 != NULL) | ||
159 | { | ||
160 | if (pp == NULL) | ||
161 | return((int)a->length); | ||
162 | memcpy(*pp,a->asn1,(int)a->length); | ||
163 | *pp+=a->length; | ||
164 | return((int)a->length); | ||
165 | } | ||
166 | |||
167 | M_ASN1_I2D_len(a->type,i2d_ASN1_OBJECT); | ||
168 | if (a->d.ptr != NULL) | ||
169 | { | ||
170 | /* Save current length */ | ||
171 | r = ret; | ||
172 | switch (OBJ_obj2nid(a->type)) | ||
173 | { | ||
174 | case NID_pkcs7_data: | ||
175 | M_ASN1_I2D_len(a->d.data,i2d_ASN1_OCTET_STRING); | ||
176 | break; | ||
177 | case NID_pkcs7_signed: | ||
178 | M_ASN1_I2D_len(a->d.sign,i2d_PKCS7_SIGNED); | ||
179 | break; | ||
180 | case NID_pkcs7_enveloped: | ||
181 | M_ASN1_I2D_len(a->d.enveloped,i2d_PKCS7_ENVELOPE); | ||
182 | break; | ||
183 | case NID_pkcs7_signedAndEnveloped: | ||
184 | M_ASN1_I2D_len(a->d.signed_and_enveloped, | ||
185 | i2d_PKCS7_SIGN_ENVELOPE); | ||
186 | break; | ||
187 | case NID_pkcs7_digest: | ||
188 | M_ASN1_I2D_len(a->d.digest,i2d_PKCS7_DIGEST); | ||
189 | break; | ||
190 | case NID_pkcs7_encrypted: | ||
191 | M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT); | ||
192 | break; | ||
193 | default: | ||
194 | M_ASN1_I2D_len(a->d.other,i2d_ASN1_TYPE); | ||
195 | break; | ||
196 | } | ||
197 | /* Work out explicit tag content size */ | ||
198 | explen = ret - r; | ||
199 | /* Work out explicit tag size: Note: ASN1_object_size | ||
200 | * includes the content length. | ||
201 | */ | ||
202 | ret = r + ASN1_object_size(1, explen, 0); | ||
203 | } | ||
204 | |||
205 | M_ASN1_I2D_seq_total(); | ||
206 | |||
207 | M_ASN1_I2D_put(a->type,i2d_ASN1_OBJECT); | ||
208 | |||
209 | if (a->d.ptr != NULL) | ||
210 | { | ||
211 | ASN1_put_object(&p, 1, explen, 0, V_ASN1_CONTEXT_SPECIFIC); | ||
212 | switch (OBJ_obj2nid(a->type)) | ||
213 | { | ||
214 | case NID_pkcs7_data: | ||
215 | M_ASN1_I2D_put(a->d.data,i2d_ASN1_OCTET_STRING); | ||
216 | break; | ||
217 | case NID_pkcs7_signed: | ||
218 | M_ASN1_I2D_put(a->d.sign,i2d_PKCS7_SIGNED); | ||
219 | break; | ||
220 | case NID_pkcs7_enveloped: | ||
221 | M_ASN1_I2D_put(a->d.enveloped,i2d_PKCS7_ENVELOPE); | ||
222 | break; | ||
223 | case NID_pkcs7_signedAndEnveloped: | ||
224 | M_ASN1_I2D_put(a->d.signed_and_enveloped, | ||
225 | i2d_PKCS7_SIGN_ENVELOPE); | ||
226 | break; | ||
227 | case NID_pkcs7_digest: | ||
228 | M_ASN1_I2D_put(a->d.digest,i2d_PKCS7_DIGEST); | ||
229 | break; | ||
230 | case NID_pkcs7_encrypted: | ||
231 | M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT); | ||
232 | break; | ||
233 | default: | ||
234 | M_ASN1_I2D_put(a->d.other,i2d_ASN1_TYPE); | ||
235 | break; | ||
236 | } | ||
237 | } | ||
238 | M_ASN1_I2D_finish(); | ||
239 | } | ||
240 | |||
241 | #endif | ||
242 | |||
243 | PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length) | ||
244 | { | ||
245 | M_ASN1_D2I_vars(a,PKCS7 *,PKCS7_new); | ||
246 | |||
247 | if ((a != NULL) && ((*a) != NULL)) | ||
248 | { | ||
249 | if ((*a)->asn1 != NULL) | ||
250 | { | ||
251 | OPENSSL_free((*a)->asn1); | ||
252 | (*a)->asn1=NULL; | ||
253 | } | ||
254 | (*a)->length=0; | ||
255 | } | ||
256 | |||
257 | M_ASN1_D2I_Init(); | ||
258 | M_ASN1_D2I_start_sequence(); | ||
259 | M_ASN1_D2I_get(ret->type,d2i_ASN1_OBJECT); | ||
260 | if (!M_ASN1_D2I_end_sequence()) | ||
261 | { | ||
262 | int Tinf,Ttag,Tclass; | ||
263 | long Tlen; | ||
264 | |||
265 | if (M_ASN1_next != (V_ASN1_CONSTRUCTED| | ||
266 | V_ASN1_CONTEXT_SPECIFIC|0)) | ||
267 | { | ||
268 | c.error=ASN1_R_BAD_PKCS7_CONTENT; | ||
269 | c.line=__LINE__; | ||
270 | goto err; | ||
271 | } | ||
272 | |||
273 | ret->detached=0; | ||
274 | |||
275 | c.q=c.p; | ||
276 | Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass, | ||
277 | (c.inf & 1)?(length+ *pp-c.q):c.slen); | ||
278 | if (Tinf & 0x80) { c.line=__LINE__; goto err; } | ||
279 | c.slen-=(c.p-c.q); | ||
280 | |||
281 | switch (OBJ_obj2nid(ret->type)) | ||
282 | { | ||
283 | case NID_pkcs7_data: | ||
284 | M_ASN1_D2I_get(ret->d.data,d2i_ASN1_OCTET_STRING); | ||
285 | break; | ||
286 | case NID_pkcs7_signed: | ||
287 | M_ASN1_D2I_get(ret->d.sign,d2i_PKCS7_SIGNED); | ||
288 | if (ret->d.sign->contents->d.ptr == NULL) | ||
289 | ret->detached=1; | ||
290 | break; | ||
291 | case NID_pkcs7_enveloped: | ||
292 | M_ASN1_D2I_get(ret->d.enveloped,d2i_PKCS7_ENVELOPE); | ||
293 | break; | ||
294 | case NID_pkcs7_signedAndEnveloped: | ||
295 | M_ASN1_D2I_get(ret->d.signed_and_enveloped, | ||
296 | d2i_PKCS7_SIGN_ENVELOPE); | ||
297 | break; | ||
298 | case NID_pkcs7_digest: | ||
299 | M_ASN1_D2I_get(ret->d.digest,d2i_PKCS7_DIGEST); | ||
300 | break; | ||
301 | case NID_pkcs7_encrypted: | ||
302 | M_ASN1_D2I_get(ret->d.encrypted,d2i_PKCS7_ENCRYPT); | ||
303 | break; | ||
304 | default: | ||
305 | M_ASN1_D2I_get(ret->d.other,d2i_ASN1_TYPE); | ||
306 | break; | ||
307 | } | ||
308 | if (Tinf == (1|V_ASN1_CONSTRUCTED)) | ||
309 | { | ||
310 | c.q=c.p; | ||
311 | if (!ASN1_check_infinite_end(&c.p,c.slen)) | ||
312 | { | ||
313 | c.error=ERR_R_MISSING_ASN1_EOS; | ||
314 | c.line=__LINE__; | ||
315 | goto err; | ||
316 | } | ||
317 | c.slen-=(c.p-c.q); | ||
318 | } | ||
319 | } | ||
320 | else | ||
321 | ret->detached=1; | ||
322 | |||
323 | M_ASN1_D2I_Finish(a,PKCS7_free,ASN1_F_D2I_PKCS7); | ||
324 | } | ||
325 | |||
326 | PKCS7 *PKCS7_new(void) | ||
327 | { | ||
328 | PKCS7 *ret=NULL; | ||
329 | ASN1_CTX c; | ||
330 | |||
331 | M_ASN1_New_Malloc(ret,PKCS7); | ||
332 | ret->type=OBJ_nid2obj(NID_undef); | ||
333 | ret->asn1=NULL; | ||
334 | ret->length=0; | ||
335 | ret->detached=0; | ||
336 | ret->d.ptr=NULL; | ||
337 | return(ret); | ||
338 | M_ASN1_New_Error(ASN1_F_PKCS7_NEW); | ||
339 | } | ||
340 | |||
341 | void PKCS7_free(PKCS7 *a) | ||
342 | { | ||
343 | if (a == NULL) return; | ||
344 | |||
345 | PKCS7_content_free(a); | ||
346 | if (a->type != NULL) | ||
347 | { | ||
348 | ASN1_OBJECT_free(a->type); | ||
349 | } | ||
350 | OPENSSL_free(a); | ||
351 | } | ||
352 | |||
353 | void PKCS7_content_free(PKCS7 *a) | ||
354 | { | ||
355 | if(a == NULL) | ||
356 | return; | ||
357 | |||
358 | if (a->asn1 != NULL) OPENSSL_free(a->asn1); | ||
359 | |||
360 | if (a->d.ptr != NULL) | ||
361 | { | ||
362 | if (a->type == NULL) return; | ||
363 | |||
364 | switch (OBJ_obj2nid(a->type)) | ||
365 | { | ||
366 | case NID_pkcs7_data: | ||
367 | M_ASN1_OCTET_STRING_free(a->d.data); | ||
368 | break; | ||
369 | case NID_pkcs7_signed: | ||
370 | PKCS7_SIGNED_free(a->d.sign); | ||
371 | break; | ||
372 | case NID_pkcs7_enveloped: | ||
373 | PKCS7_ENVELOPE_free(a->d.enveloped); | ||
374 | break; | ||
375 | case NID_pkcs7_signedAndEnveloped: | ||
376 | PKCS7_SIGN_ENVELOPE_free(a->d.signed_and_enveloped); | ||
377 | break; | ||
378 | case NID_pkcs7_digest: | ||
379 | PKCS7_DIGEST_free(a->d.digest); | ||
380 | break; | ||
381 | case NID_pkcs7_encrypted: | ||
382 | PKCS7_ENCRYPT_free(a->d.encrypted); | ||
383 | break; | ||
384 | default: | ||
385 | ASN1_TYPE_free(a->d.other); | ||
386 | break; | ||
387 | } | ||
388 | } | ||
389 | a->d.ptr=NULL; | ||
390 | } | ||
391 | |||
392 | IMPLEMENT_STACK_OF(PKCS7) | ||
393 | IMPLEMENT_ASN1_SET_OF(PKCS7) | ||
diff --git a/src/lib/libcrypto/asn1/p7_recip.c b/src/lib/libcrypto/asn1/p7_recip.c deleted file mode 100644 index 5f6c88a2fa..0000000000 --- a/src/lib/libcrypto/asn1/p7_recip.c +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /* crypto/asn1/p7_recip.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO *a, unsigned char **pp) | ||
65 | { | ||
66 | M_ASN1_I2D_vars(a); | ||
67 | |||
68 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
69 | M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); | ||
70 | M_ASN1_I2D_len(a->key_enc_algor,i2d_X509_ALGOR); | ||
71 | M_ASN1_I2D_len(a->enc_key,i2d_ASN1_OCTET_STRING); | ||
72 | |||
73 | M_ASN1_I2D_seq_total(); | ||
74 | |||
75 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
76 | M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); | ||
77 | M_ASN1_I2D_put(a->key_enc_algor,i2d_X509_ALGOR); | ||
78 | M_ASN1_I2D_put(a->enc_key,i2d_ASN1_OCTET_STRING); | ||
79 | |||
80 | M_ASN1_I2D_finish(); | ||
81 | } | ||
82 | |||
83 | PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO **a, | ||
84 | unsigned char **pp, long length) | ||
85 | { | ||
86 | M_ASN1_D2I_vars(a,PKCS7_RECIP_INFO *,PKCS7_RECIP_INFO_new); | ||
87 | |||
88 | M_ASN1_D2I_Init(); | ||
89 | M_ASN1_D2I_start_sequence(); | ||
90 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
91 | M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); | ||
92 | M_ASN1_D2I_get(ret->key_enc_algor,d2i_X509_ALGOR); | ||
93 | M_ASN1_D2I_get(ret->enc_key,d2i_ASN1_OCTET_STRING); | ||
94 | |||
95 | M_ASN1_D2I_Finish(a,PKCS7_RECIP_INFO_free,ASN1_F_D2I_PKCS7_RECIP_INFO); | ||
96 | } | ||
97 | |||
98 | PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new(void) | ||
99 | { | ||
100 | PKCS7_RECIP_INFO *ret=NULL; | ||
101 | ASN1_CTX c; | ||
102 | |||
103 | M_ASN1_New_Malloc(ret,PKCS7_RECIP_INFO); | ||
104 | M_ASN1_New(ret->version,M_ASN1_INTEGER_new); | ||
105 | M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new); | ||
106 | M_ASN1_New(ret->key_enc_algor,X509_ALGOR_new); | ||
107 | M_ASN1_New(ret->enc_key,M_ASN1_OCTET_STRING_new); | ||
108 | ret->cert=NULL; | ||
109 | return(ret); | ||
110 | M_ASN1_New_Error(ASN1_F_PKCS7_RECIP_INFO_NEW); | ||
111 | } | ||
112 | |||
113 | void PKCS7_RECIP_INFO_free(PKCS7_RECIP_INFO *a) | ||
114 | { | ||
115 | if (a == NULL) return; | ||
116 | M_ASN1_INTEGER_free(a->version); | ||
117 | PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); | ||
118 | X509_ALGOR_free(a->key_enc_algor); | ||
119 | M_ASN1_OCTET_STRING_free(a->enc_key); | ||
120 | if (a->cert != NULL) X509_free(a->cert); | ||
121 | OPENSSL_free(a); | ||
122 | } | ||
123 | |||
124 | IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO) | ||
125 | IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO) | ||
diff --git a/src/lib/libcrypto/asn1/p7_s_e.c b/src/lib/libcrypto/asn1/p7_s_e.c deleted file mode 100644 index 709eb24b27..0000000000 --- a/src/lib/libcrypto/asn1/p7_s_e.c +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | /* crypto/asn1/p7_s_e.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE *a, unsigned char **pp) | ||
65 | { | ||
66 | M_ASN1_I2D_vars(a); | ||
67 | |||
68 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
69 | M_ASN1_I2D_len_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, | ||
70 | i2d_PKCS7_RECIP_INFO); | ||
71 | M_ASN1_I2D_len_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR); | ||
72 | M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
73 | M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0); | ||
74 | M_ASN1_I2D_len_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1); | ||
75 | M_ASN1_I2D_len_SET_type(PKCS7_SIGNER_INFO,a->signer_info, | ||
76 | i2d_PKCS7_SIGNER_INFO); | ||
77 | |||
78 | M_ASN1_I2D_seq_total(); | ||
79 | |||
80 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
81 | M_ASN1_I2D_put_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, | ||
82 | i2d_PKCS7_RECIP_INFO); | ||
83 | M_ASN1_I2D_put_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR); | ||
84 | M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); | ||
85 | M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0); | ||
86 | M_ASN1_I2D_put_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1); | ||
87 | M_ASN1_I2D_put_SET_type(PKCS7_SIGNER_INFO,a->signer_info, | ||
88 | i2d_PKCS7_SIGNER_INFO); | ||
89 | |||
90 | M_ASN1_I2D_finish(); | ||
91 | } | ||
92 | |||
93 | PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE **a, | ||
94 | unsigned char **pp, long length) | ||
95 | { | ||
96 | M_ASN1_D2I_vars(a,PKCS7_SIGN_ENVELOPE *,PKCS7_SIGN_ENVELOPE_new); | ||
97 | |||
98 | M_ASN1_D2I_Init(); | ||
99 | M_ASN1_D2I_start_sequence(); | ||
100 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
101 | M_ASN1_D2I_get_set_type(PKCS7_RECIP_INFO,ret->recipientinfo, | ||
102 | d2i_PKCS7_RECIP_INFO,PKCS7_RECIP_INFO_free); | ||
103 | M_ASN1_D2I_get_set_type(X509_ALGOR,ret->md_algs,d2i_X509_ALGOR, | ||
104 | X509_ALGOR_free); | ||
105 | M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); | ||
106 | M_ASN1_D2I_get_IMP_set_opt_type(X509,ret->cert,d2i_X509,X509_free,0); | ||
107 | M_ASN1_D2I_get_IMP_set_opt_type(X509_CRL,ret->crl,d2i_X509_CRL, | ||
108 | X509_CRL_free,1); | ||
109 | M_ASN1_D2I_get_set_type(PKCS7_SIGNER_INFO,ret->signer_info, | ||
110 | d2i_PKCS7_SIGNER_INFO,PKCS7_SIGNER_INFO_free); | ||
111 | |||
112 | M_ASN1_D2I_Finish(a,PKCS7_SIGN_ENVELOPE_free, | ||
113 | ASN1_F_D2I_PKCS7_SIGN_ENVELOPE); | ||
114 | } | ||
115 | |||
116 | PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new(void) | ||
117 | { | ||
118 | PKCS7_SIGN_ENVELOPE *ret=NULL; | ||
119 | ASN1_CTX c; | ||
120 | |||
121 | M_ASN1_New_Malloc(ret,PKCS7_SIGN_ENVELOPE); | ||
122 | M_ASN1_New(ret->version,M_ASN1_INTEGER_new); | ||
123 | M_ASN1_New(ret->recipientinfo,sk_PKCS7_RECIP_INFO_new_null); | ||
124 | M_ASN1_New(ret->md_algs,sk_X509_ALGOR_new_null); | ||
125 | M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); | ||
126 | ret->cert=NULL; | ||
127 | ret->crl=NULL; | ||
128 | M_ASN1_New(ret->signer_info,sk_PKCS7_SIGNER_INFO_new_null); | ||
129 | return(ret); | ||
130 | M_ASN1_New_Error(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW); | ||
131 | } | ||
132 | |||
133 | void PKCS7_SIGN_ENVELOPE_free(PKCS7_SIGN_ENVELOPE *a) | ||
134 | { | ||
135 | if (a == NULL) return; | ||
136 | M_ASN1_INTEGER_free(a->version); | ||
137 | sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); | ||
138 | sk_X509_ALGOR_pop_free(a->md_algs,X509_ALGOR_free); | ||
139 | PKCS7_ENC_CONTENT_free(a->enc_data); | ||
140 | sk_X509_pop_free(a->cert,X509_free); | ||
141 | sk_X509_CRL_pop_free(a->crl,X509_CRL_free); | ||
142 | sk_PKCS7_SIGNER_INFO_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); | ||
143 | OPENSSL_free(a); | ||
144 | } | ||
145 | |||
diff --git a/src/lib/libcrypto/asn1/p7_signd.c b/src/lib/libcrypto/asn1/p7_signd.c deleted file mode 100644 index c835f5475f..0000000000 --- a/src/lib/libcrypto/asn1/p7_signd.c +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /* crypto/asn1/p7_signd.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_SIGNED(PKCS7_SIGNED *a, unsigned char **pp) | ||
65 | { | ||
66 | M_ASN1_I2D_vars(a); | ||
67 | |||
68 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
69 | M_ASN1_I2D_len_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR); | ||
70 | M_ASN1_I2D_len(a->contents,i2d_PKCS7); | ||
71 | M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0); | ||
72 | M_ASN1_I2D_len_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1); | ||
73 | M_ASN1_I2D_len_SET_type(PKCS7_SIGNER_INFO,a->signer_info, | ||
74 | i2d_PKCS7_SIGNER_INFO); | ||
75 | |||
76 | M_ASN1_I2D_seq_total(); | ||
77 | |||
78 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
79 | M_ASN1_I2D_put_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR); | ||
80 | M_ASN1_I2D_put(a->contents,i2d_PKCS7); | ||
81 | M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0); | ||
82 | M_ASN1_I2D_put_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1); | ||
83 | M_ASN1_I2D_put_SET_type(PKCS7_SIGNER_INFO,a->signer_info, | ||
84 | i2d_PKCS7_SIGNER_INFO); | ||
85 | |||
86 | M_ASN1_I2D_finish(); | ||
87 | } | ||
88 | |||
89 | PKCS7_SIGNED *d2i_PKCS7_SIGNED(PKCS7_SIGNED **a, unsigned char **pp, | ||
90 | long length) | ||
91 | { | ||
92 | M_ASN1_D2I_vars(a,PKCS7_SIGNED *,PKCS7_SIGNED_new); | ||
93 | |||
94 | M_ASN1_D2I_Init(); | ||
95 | M_ASN1_D2I_start_sequence(); | ||
96 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
97 | M_ASN1_D2I_get_set_type(X509_ALGOR,ret->md_algs,d2i_X509_ALGOR, | ||
98 | X509_ALGOR_free); | ||
99 | M_ASN1_D2I_get(ret->contents,d2i_PKCS7); | ||
100 | M_ASN1_D2I_get_IMP_set_opt_type(X509,ret->cert,d2i_X509,X509_free,0); | ||
101 | M_ASN1_D2I_get_IMP_set_opt_type(X509_CRL,ret->crl,d2i_X509_CRL, | ||
102 | X509_CRL_free,1); | ||
103 | M_ASN1_D2I_get_set_type(PKCS7_SIGNER_INFO,ret->signer_info, | ||
104 | d2i_PKCS7_SIGNER_INFO,PKCS7_SIGNER_INFO_free); | ||
105 | |||
106 | M_ASN1_D2I_Finish(a,PKCS7_SIGNED_free,ASN1_F_D2I_PKCS7_SIGNED); | ||
107 | } | ||
108 | |||
109 | PKCS7_SIGNED *PKCS7_SIGNED_new(void) | ||
110 | { | ||
111 | PKCS7_SIGNED *ret=NULL; | ||
112 | ASN1_CTX c; | ||
113 | |||
114 | M_ASN1_New_Malloc(ret,PKCS7_SIGNED); | ||
115 | M_ASN1_New(ret->version,M_ASN1_INTEGER_new); | ||
116 | M_ASN1_New(ret->md_algs,sk_X509_ALGOR_new_null); | ||
117 | M_ASN1_New(ret->contents,PKCS7_new); | ||
118 | ret->cert=NULL; | ||
119 | ret->crl=NULL; | ||
120 | M_ASN1_New(ret->signer_info,sk_PKCS7_SIGNER_INFO_new_null); | ||
121 | return(ret); | ||
122 | M_ASN1_New_Error(ASN1_F_PKCS7_SIGNED_NEW); | ||
123 | } | ||
124 | |||
125 | void PKCS7_SIGNED_free(PKCS7_SIGNED *a) | ||
126 | { | ||
127 | if (a == NULL) return; | ||
128 | M_ASN1_INTEGER_free(a->version); | ||
129 | sk_X509_ALGOR_pop_free(a->md_algs,X509_ALGOR_free); | ||
130 | PKCS7_free(a->contents); | ||
131 | sk_X509_pop_free(a->cert,X509_free); | ||
132 | sk_X509_CRL_pop_free(a->crl,X509_CRL_free); | ||
133 | sk_PKCS7_SIGNER_INFO_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); | ||
134 | OPENSSL_free(a); | ||
135 | } | ||
diff --git a/src/lib/libcrypto/asn1/p7_signi.c b/src/lib/libcrypto/asn1/p7_signi.c deleted file mode 100644 index 248bf00945..0000000000 --- a/src/lib/libcrypto/asn1/p7_signi.c +++ /dev/null | |||
@@ -1,150 +0,0 @@ | |||
1 | /* crypto/asn1/p7_signi.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 "cryptlib.h" | ||
61 | #include <openssl/asn1_mac.h> | ||
62 | #include <openssl/x509.h> | ||
63 | |||
64 | int i2d_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO *a, unsigned char **pp) | ||
65 | { | ||
66 | M_ASN1_I2D_vars(a); | ||
67 | |||
68 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | ||
69 | M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); | ||
70 | M_ASN1_I2D_len(a->digest_alg,i2d_X509_ALGOR); | ||
71 | M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->auth_attr, | ||
72 | i2d_X509_ATTRIBUTE,0); | ||
73 | M_ASN1_I2D_len(a->digest_enc_alg,i2d_X509_ALGOR); | ||
74 | M_ASN1_I2D_len(a->enc_digest,i2d_ASN1_OCTET_STRING); | ||
75 | M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->unauth_attr, | ||
76 | i2d_X509_ATTRIBUTE,1); | ||
77 | |||
78 | M_ASN1_I2D_seq_total(); | ||
79 | |||
80 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | ||
81 | M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); | ||
82 | M_ASN1_I2D_put(a->digest_alg,i2d_X509_ALGOR); | ||
83 | M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->auth_attr, | ||
84 | i2d_X509_ATTRIBUTE,0); | ||
85 | M_ASN1_I2D_put(a->digest_enc_alg,i2d_X509_ALGOR); | ||
86 | M_ASN1_I2D_put(a->enc_digest,i2d_ASN1_OCTET_STRING); | ||
87 | M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->unauth_attr, | ||
88 | i2d_X509_ATTRIBUTE,1); | ||
89 | |||
90 | M_ASN1_I2D_finish(); | ||
91 | } | ||
92 | |||
93 | PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO **a, | ||
94 | unsigned char **pp, long length) | ||
95 | { | ||
96 | M_ASN1_D2I_vars(a,PKCS7_SIGNER_INFO *,PKCS7_SIGNER_INFO_new); | ||
97 | |||
98 | M_ASN1_D2I_Init(); | ||
99 | M_ASN1_D2I_start_sequence(); | ||
100 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | ||
101 | M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); | ||
102 | M_ASN1_D2I_get(ret->digest_alg,d2i_X509_ALGOR); | ||
103 | M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE,ret->auth_attr, | ||
104 | d2i_X509_ATTRIBUTE,X509_ATTRIBUTE_free, | ||
105 | 0); | ||
106 | M_ASN1_D2I_get(ret->digest_enc_alg,d2i_X509_ALGOR); | ||
107 | M_ASN1_D2I_get(ret->enc_digest,d2i_ASN1_OCTET_STRING); | ||
108 | M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE,ret->unauth_attr, | ||
109 | d2i_X509_ATTRIBUTE, | ||
110 | X509_ATTRIBUTE_free,1); | ||
111 | |||
112 | M_ASN1_D2I_Finish(a,PKCS7_SIGNER_INFO_free, | ||
113 | ASN1_F_D2I_PKCS7_SIGNER_INFO); | ||
114 | } | ||
115 | |||
116 | PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new(void) | ||
117 | { | ||
118 | PKCS7_SIGNER_INFO *ret=NULL; | ||
119 | ASN1_CTX c; | ||
120 | |||
121 | M_ASN1_New_Malloc(ret,PKCS7_SIGNER_INFO); | ||
122 | M_ASN1_New(ret->version,M_ASN1_INTEGER_new); | ||
123 | M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new); | ||
124 | M_ASN1_New(ret->digest_alg,X509_ALGOR_new); | ||
125 | ret->auth_attr=NULL; | ||
126 | M_ASN1_New(ret->digest_enc_alg,X509_ALGOR_new); | ||
127 | M_ASN1_New(ret->enc_digest,M_ASN1_OCTET_STRING_new); | ||
128 | ret->unauth_attr=NULL; | ||
129 | ret->pkey=NULL; | ||
130 | return(ret); | ||
131 | M_ASN1_New_Error(ASN1_F_PKCS7_SIGNER_INFO_NEW); | ||
132 | } | ||
133 | |||
134 | void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a) | ||
135 | { | ||
136 | if (a == NULL) return; | ||
137 | M_ASN1_INTEGER_free(a->version); | ||
138 | PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); | ||
139 | X509_ALGOR_free(a->digest_alg); | ||
140 | sk_X509_ATTRIBUTE_pop_free(a->auth_attr,X509_ATTRIBUTE_free); | ||
141 | X509_ALGOR_free(a->digest_enc_alg); | ||
142 | M_ASN1_OCTET_STRING_free(a->enc_digest); | ||
143 | sk_X509_ATTRIBUTE_pop_free(a->unauth_attr,X509_ATTRIBUTE_free); | ||
144 | if (a->pkey != NULL) | ||
145 | EVP_PKEY_free(a->pkey); | ||
146 | OPENSSL_free(a); | ||
147 | } | ||
148 | |||
149 | IMPLEMENT_STACK_OF(PKCS7_SIGNER_INFO) | ||
150 | IMPLEMENT_ASN1_SET_OF(PKCS7_SIGNER_INFO) | ||