Tagging 0.9.8a-4 as uploaded
Kurt Roeckx
18 years ago
0 | /* crypto/md/md2.h */ | |
1 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | |
2 | * All rights reserved. | |
3 | * | |
4 | * This package is an SSL implementation written | |
5 | * by Eric Young (eay@cryptsoft.com). | |
6 | * The implementation was written so as to conform with Netscapes SSL. | |
7 | * | |
8 | * This library is free for commercial and non-commercial use as long as | |
9 | * the following conditions are aheared to. The following conditions | |
10 | * apply to all code found in this distribution, be it the RC4, RSA, | |
11 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | |
12 | * included with this distribution is covered by the same copyright terms | |
13 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | |
14 | * | |
15 | * Copyright remains Eric Young's, and as such any Copyright notices in | |
16 | * the code are not to be removed. | |
17 | * If this package is used in a product, Eric Young should be given attribution | |
18 | * as the author of the parts of the library used. | |
19 | * This can be in the form of a textual message at program startup or | |
20 | * in documentation (online or textual) provided with the package. | |
21 | * | |
22 | * Redistribution and use in source and binary forms, with or without | |
23 | * modification, are permitted provided that the following conditions | |
24 | * are met: | |
25 | * 1. Redistributions of source code must retain the copyright | |
26 | * notice, this list of conditions and the following disclaimer. | |
27 | * 2. Redistributions in binary form must reproduce the above copyright | |
28 | * notice, this list of conditions and the following disclaimer in the | |
29 | * documentation and/or other materials provided with the distribution. | |
30 | * 3. All advertising materials mentioning features or use of this software | |
31 | * must display the following acknowledgement: | |
32 | * "This product includes cryptographic software written by | |
33 | * Eric Young (eay@cryptsoft.com)" | |
34 | * The word 'cryptographic' can be left out if the rouines from the library | |
35 | * being used are not cryptographic related :-). | |
36 | * 4. If you include any Windows specific code (or a derivative thereof) from | |
37 | * the apps directory (application code) you must include an acknowledgement: | |
38 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | |
39 | * | |
40 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | |
41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
43 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
50 | * SUCH DAMAGE. | |
51 | * | |
52 | * The licence and distribution terms for any publically available version or | |
53 | * derivative of this code cannot be changed. i.e. this code cannot simply be | |
54 | * copied and put under another distribution licence | |
55 | * [including the GNU Public Licence.] | |
56 | */ | |
57 | ||
58 | #ifndef HEADER_MD2_H | |
59 | #define HEADER_MD2_H | |
60 | ||
61 | #include <stddef.h> | |
62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_MD2, MD2_INT */ | |
63 | #ifdef OPENSSL_NO_MD2 | |
64 | #error MD2 is disabled. | |
65 | #endif | |
66 | ||
67 | #define MD2_DIGEST_LENGTH 16 | |
68 | #define MD2_BLOCK 16 | |
69 | ||
70 | #ifdef __cplusplus | |
71 | extern "C" { | |
72 | #endif | |
73 | ||
74 | typedef struct MD2state_st | |
75 | { | |
76 | unsigned int num; | |
77 | unsigned char data[MD2_BLOCK]; | |
78 | MD2_INT cksm[MD2_BLOCK]; | |
79 | MD2_INT state[MD2_BLOCK]; | |
80 | } MD2_CTX; | |
81 | ||
82 | const char *MD2_options(void); | |
83 | int MD2_Init(MD2_CTX *c); | |
84 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); | |
85 | int MD2_Final(unsigned char *md, MD2_CTX *c); | |
86 | unsigned char *MD2(const unsigned char *d, size_t n,unsigned char *md); | |
87 | #ifdef __cplusplus | |
88 | } | |
89 | #endif | |
90 | ||
91 | #endif |
0 | /* crypto/md4/md4.h */ | |
1 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | |
2 | * All rights reserved. | |
3 | * | |
4 | * This package is an SSL implementation written | |
5 | * by Eric Young (eay@cryptsoft.com). | |
6 | * The implementation was written so as to conform with Netscapes SSL. | |
7 | * | |
8 | * This library is free for commercial and non-commercial use as long as | |
9 | * the following conditions are aheared to. The following conditions | |
10 | * apply to all code found in this distribution, be it the RC4, RSA, | |
11 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | |
12 | * included with this distribution is covered by the same copyright terms | |
13 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | |
14 | * | |
15 | * Copyright remains Eric Young's, and as such any Copyright notices in | |
16 | * the code are not to be removed. | |
17 | * If this package is used in a product, Eric Young should be given attribution | |
18 | * as the author of the parts of the library used. | |
19 | * This can be in the form of a textual message at program startup or | |
20 | * in documentation (online or textual) provided with the package. | |
21 | * | |
22 | * Redistribution and use in source and binary forms, with or without | |
23 | * modification, are permitted provided that the following conditions | |
24 | * are met: | |
25 | * 1. Redistributions of source code must retain the copyright | |
26 | * notice, this list of conditions and the following disclaimer. | |
27 | * 2. Redistributions in binary form must reproduce the above copyright | |
28 | * notice, this list of conditions and the following disclaimer in the | |
29 | * documentation and/or other materials provided with the distribution. | |
30 | * 3. All advertising materials mentioning features or use of this software | |
31 | * must display the following acknowledgement: | |
32 | * "This product includes cryptographic software written by | |
33 | * Eric Young (eay@cryptsoft.com)" | |
34 | * The word 'cryptographic' can be left out if the rouines from the library | |
35 | * being used are not cryptographic related :-). | |
36 | * 4. If you include any Windows specific code (or a derivative thereof) from | |
37 | * the apps directory (application code) you must include an acknowledgement: | |
38 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | |
39 | * | |
40 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | |
41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
43 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
50 | * SUCH DAMAGE. | |
51 | * | |
52 | * The licence and distribution terms for any publically available version or | |
53 | * derivative of this code cannot be changed. i.e. this code cannot simply be | |
54 | * copied and put under another distribution licence | |
55 | * [including the GNU Public Licence.] | |
56 | */ | |
57 | ||
58 | #ifndef HEADER_MD4_H | |
59 | #define HEADER_MD4_H | |
60 | ||
61 | #include <stddef.h> | |
62 | #include <openssl/e_os2.h> | |
63 | ||
64 | #ifdef __cplusplus | |
65 | extern "C" { | |
66 | #endif | |
67 | ||
68 | #ifdef OPENSSL_NO_MD4 | |
69 | #error MD4 is disabled. | |
70 | #endif | |
71 | ||
72 | /* | |
73 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
74 | * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then ! | |
75 | * ! MD4_LONG_LOG2 has to be defined along. ! | |
76 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
77 | */ | |
78 | ||
79 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | |
80 | #define MD4_LONG unsigned long | |
81 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | |
82 | #define MD4_LONG unsigned long | |
83 | #define MD4_LONG_LOG2 3 | |
84 | /* | |
85 | * _CRAY note. I could declare short, but I have no idea what impact | |
86 | * does it have on performance on none-T3E machines. I could declare | |
87 | * int, but at least on C90 sizeof(int) can be chosen at compile time. | |
88 | * So I've chosen long... | |
89 | * <appro@fy.chalmers.se> | |
90 | */ | |
91 | #else | |
92 | #define MD4_LONG unsigned int | |
93 | #endif | |
94 | ||
95 | #define MD4_CBLOCK 64 | |
96 | #define MD4_LBLOCK (MD4_CBLOCK/4) | |
97 | #define MD4_DIGEST_LENGTH 16 | |
98 | ||
99 | typedef struct MD4state_st | |
100 | { | |
101 | MD4_LONG A,B,C,D; | |
102 | MD4_LONG Nl,Nh; | |
103 | MD4_LONG data[MD4_LBLOCK]; | |
104 | unsigned int num; | |
105 | } MD4_CTX; | |
106 | ||
107 | int MD4_Init(MD4_CTX *c); | |
108 | int MD4_Update(MD4_CTX *c, const void *data, size_t len); | |
109 | int MD4_Final(unsigned char *md, MD4_CTX *c); | |
110 | unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); | |
111 | void MD4_Transform(MD4_CTX *c, const unsigned char *b); | |
112 | #ifdef __cplusplus | |
113 | } | |
114 | #endif | |
115 | ||
116 | #endif |
0 | /* crypto/md5/md5.h */ | |
1 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | |
2 | * All rights reserved. | |
3 | * | |
4 | * This package is an SSL implementation written | |
5 | * by Eric Young (eay@cryptsoft.com). | |
6 | * The implementation was written so as to conform with Netscapes SSL. | |
7 | * | |
8 | * This library is free for commercial and non-commercial use as long as | |
9 | * the following conditions are aheared to. The following conditions | |
10 | * apply to all code found in this distribution, be it the RC4, RSA, | |
11 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | |
12 | * included with this distribution is covered by the same copyright terms | |
13 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | |
14 | * | |
15 | * Copyright remains Eric Young's, and as such any Copyright notices in | |
16 | * the code are not to be removed. | |
17 | * If this package is used in a product, Eric Young should be given attribution | |
18 | * as the author of the parts of the library used. | |
19 | * This can be in the form of a textual message at program startup or | |
20 | * in documentation (online or textual) provided with the package. | |
21 | * | |
22 | * Redistribution and use in source and binary forms, with or without | |
23 | * modification, are permitted provided that the following conditions | |
24 | * are met: | |
25 | * 1. Redistributions of source code must retain the copyright | |
26 | * notice, this list of conditions and the following disclaimer. | |
27 | * 2. Redistributions in binary form must reproduce the above copyright | |
28 | * notice, this list of conditions and the following disclaimer in the | |
29 | * documentation and/or other materials provided with the distribution. | |
30 | * 3. All advertising materials mentioning features or use of this software | |
31 | * must display the following acknowledgement: | |
32 | * "This product includes cryptographic software written by | |
33 | * Eric Young (eay@cryptsoft.com)" | |
34 | * The word 'cryptographic' can be left out if the rouines from the library | |
35 | * being used are not cryptographic related :-). | |
36 | * 4. If you include any Windows specific code (or a derivative thereof) from | |
37 | * the apps directory (application code) you must include an acknowledgement: | |
38 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | |
39 | * | |
40 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | |
41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
43 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
50 | * SUCH DAMAGE. | |
51 | * | |
52 | * The licence and distribution terms for any publically available version or | |
53 | * derivative of this code cannot be changed. i.e. this code cannot simply be | |
54 | * copied and put under another distribution licence | |
55 | * [including the GNU Public Licence.] | |
56 | */ | |
57 | ||
58 | #ifndef HEADER_MD5_H | |
59 | #define HEADER_MD5_H | |
60 | ||
61 | #include <stddef.h> | |
62 | #include <openssl/e_os2.h> | |
63 | ||
64 | #ifdef __cplusplus | |
65 | extern "C" { | |
66 | #endif | |
67 | ||
68 | #ifdef OPENSSL_NO_MD5 | |
69 | #error MD5 is disabled. | |
70 | #endif | |
71 | ||
72 | /* | |
73 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
74 | * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! | |
75 | * ! MD5_LONG_LOG2 has to be defined along. ! | |
76 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
77 | */ | |
78 | ||
79 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | |
80 | #define MD5_LONG unsigned long | |
81 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | |
82 | #define MD5_LONG unsigned long | |
83 | #define MD5_LONG_LOG2 3 | |
84 | /* | |
85 | * _CRAY note. I could declare short, but I have no idea what impact | |
86 | * does it have on performance on none-T3E machines. I could declare | |
87 | * int, but at least on C90 sizeof(int) can be chosen at compile time. | |
88 | * So I've chosen long... | |
89 | * <appro@fy.chalmers.se> | |
90 | */ | |
91 | #else | |
92 | #define MD5_LONG unsigned int | |
93 | #endif | |
94 | ||
95 | #define MD5_CBLOCK 64 | |
96 | #define MD5_LBLOCK (MD5_CBLOCK/4) | |
97 | #define MD5_DIGEST_LENGTH 16 | |
98 | ||
99 | typedef struct MD5state_st | |
100 | { | |
101 | MD5_LONG A,B,C,D; | |
102 | MD5_LONG Nl,Nh; | |
103 | MD5_LONG data[MD5_LBLOCK]; | |
104 | unsigned int num; | |
105 | } MD5_CTX; | |
106 | ||
107 | int MD5_Init(MD5_CTX *c); | |
108 | int MD5_Update(MD5_CTX *c, const void *data, size_t len); | |
109 | int MD5_Final(unsigned char *md, MD5_CTX *c); | |
110 | unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); | |
111 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); | |
112 | #ifdef __cplusplus | |
113 | } | |
114 | #endif | |
115 | ||
116 | #endif |
0 | /* crypto/ripemd/ripemd.h */ | |
1 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | |
2 | * All rights reserved. | |
3 | * | |
4 | * This package is an SSL implementation written | |
5 | * by Eric Young (eay@cryptsoft.com). | |
6 | * The implementation was written so as to conform with Netscapes SSL. | |
7 | * | |
8 | * This library is free for commercial and non-commercial use as long as | |
9 | * the following conditions are aheared to. The following conditions | |
10 | * apply to all code found in this distribution, be it the RC4, RSA, | |
11 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | |
12 | * included with this distribution is covered by the same copyright terms | |
13 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | |
14 | * | |
15 | * Copyright remains Eric Young's, and as such any Copyright notices in | |
16 | * the code are not to be removed. | |
17 | * If this package is used in a product, Eric Young should be given attribution | |
18 | * as the author of the parts of the library used. | |
19 | * This can be in the form of a textual message at program startup or | |
20 | * in documentation (online or textual) provided with the package. | |
21 | * | |
22 | * Redistribution and use in source and binary forms, with or without | |
23 | * modification, are permitted provided that the following conditions | |
24 | * are met: | |
25 | * 1. Redistributions of source code must retain the copyright | |
26 | * notice, this list of conditions and the following disclaimer. | |
27 | * 2. Redistributions in binary form must reproduce the above copyright | |
28 | * notice, this list of conditions and the following disclaimer in the | |
29 | * documentation and/or other materials provided with the distribution. | |
30 | * 3. All advertising materials mentioning features or use of this software | |
31 | * must display the following acknowledgement: | |
32 | * "This product includes cryptographic software written by | |
33 | * Eric Young (eay@cryptsoft.com)" | |
34 | * The word 'cryptographic' can be left out if the rouines from the library | |
35 | * being used are not cryptographic related :-). | |
36 | * 4. If you include any Windows specific code (or a derivative thereof) from | |
37 | * the apps directory (application code) you must include an acknowledgement: | |
38 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | |
39 | * | |
40 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | |
41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
43 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
50 | * SUCH DAMAGE. | |
51 | * | |
52 | * The licence and distribution terms for any publically available version or | |
53 | * derivative of this code cannot be changed. i.e. this code cannot simply be | |
54 | * copied and put under another distribution licence | |
55 | * [including the GNU Public Licence.] | |
56 | */ | |
57 | ||
58 | #ifndef HEADER_RIPEMD_H | |
59 | #define HEADER_RIPEMD_H | |
60 | ||
61 | #include <stddef.h> | |
62 | #include <openssl/e_os2.h> | |
63 | ||
64 | #ifdef __cplusplus | |
65 | extern "C" { | |
66 | #endif | |
67 | ||
68 | #ifdef OPENSSL_NO_RIPEMD | |
69 | #error RIPEMD is disabled. | |
70 | #endif | |
71 | ||
72 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | |
73 | #define RIPEMD160_LONG unsigned long | |
74 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | |
75 | #define RIPEMD160_LONG unsigned long | |
76 | #define RIPEMD160_LONG_LOG2 3 | |
77 | #else | |
78 | #define RIPEMD160_LONG unsigned int | |
79 | #endif | |
80 | ||
81 | #define RIPEMD160_CBLOCK 64 | |
82 | #define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) | |
83 | #define RIPEMD160_DIGEST_LENGTH 20 | |
84 | ||
85 | typedef struct RIPEMD160state_st | |
86 | { | |
87 | RIPEMD160_LONG A,B,C,D,E; | |
88 | RIPEMD160_LONG Nl,Nh; | |
89 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; | |
90 | unsigned int num; | |
91 | } RIPEMD160_CTX; | |
92 | ||
93 | int RIPEMD160_Init(RIPEMD160_CTX *c); | |
94 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); | |
95 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); | |
96 | unsigned char *RIPEMD160(const unsigned char *d, size_t n, | |
97 | unsigned char *md); | |
98 | void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); | |
99 | #ifdef __cplusplus | |
100 | } | |
101 | #endif | |
102 | ||
103 | #endif |
0 | /* crypto/sha/sha.h */ | |
1 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | |
2 | * All rights reserved. | |
3 | * | |
4 | * This package is an SSL implementation written | |
5 | * by Eric Young (eay@cryptsoft.com). | |
6 | * The implementation was written so as to conform with Netscapes SSL. | |
7 | * | |
8 | * This library is free for commercial and non-commercial use as long as | |
9 | * the following conditions are aheared to. The following conditions | |
10 | * apply to all code found in this distribution, be it the RC4, RSA, | |
11 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | |
12 | * included with this distribution is covered by the same copyright terms | |
13 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | |
14 | * | |
15 | * Copyright remains Eric Young's, and as such any Copyright notices in | |
16 | * the code are not to be removed. | |
17 | * If this package is used in a product, Eric Young should be given attribution | |
18 | * as the author of the parts of the library used. | |
19 | * This can be in the form of a textual message at program startup or | |
20 | * in documentation (online or textual) provided with the package. | |
21 | * | |
22 | * Redistribution and use in source and binary forms, with or without | |
23 | * modification, are permitted provided that the following conditions | |
24 | * are met: | |
25 | * 1. Redistributions of source code must retain the copyright | |
26 | * notice, this list of conditions and the following disclaimer. | |
27 | * 2. Redistributions in binary form must reproduce the above copyright | |
28 | * notice, this list of conditions and the following disclaimer in the | |
29 | * documentation and/or other materials provided with the distribution. | |
30 | * 3. All advertising materials mentioning features or use of this software | |
31 | * must display the following acknowledgement: | |
32 | * "This product includes cryptographic software written by | |
33 | * Eric Young (eay@cryptsoft.com)" | |
34 | * The word 'cryptographic' can be left out if the rouines from the library | |
35 | * being used are not cryptographic related :-). | |
36 | * 4. If you include any Windows specific code (or a derivative thereof) from | |
37 | * the apps directory (application code) you must include an acknowledgement: | |
38 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | |
39 | * | |
40 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | |
41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
43 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
50 | * SUCH DAMAGE. | |
51 | * | |
52 | * The licence and distribution terms for any publically available version or | |
53 | * derivative of this code cannot be changed. i.e. this code cannot simply be | |
54 | * copied and put under another distribution licence | |
55 | * [including the GNU Public Licence.] | |
56 | */ | |
57 | ||
58 | #ifndef HEADER_SHA_H | |
59 | #define HEADER_SHA_H | |
60 | ||
61 | #include <stddef.h> | |
62 | #include <openssl/e_os2.h> | |
63 | ||
64 | #ifdef __cplusplus | |
65 | extern "C" { | |
66 | #endif | |
67 | ||
68 | #if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) | |
69 | #error SHA is disabled. | |
70 | #endif | |
71 | ||
72 | #if defined(OPENSSL_FIPS) | |
73 | #define FIPS_SHA_SIZE_T size_t | |
74 | #endif | |
75 | ||
76 | /* | |
77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
78 | * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! | |
79 | * ! SHA_LONG_LOG2 has to be defined along. ! | |
80 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
81 | */ | |
82 | ||
83 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | |
84 | #define SHA_LONG unsigned long | |
85 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | |
86 | #define SHA_LONG unsigned long | |
87 | #define SHA_LONG_LOG2 3 | |
88 | #else | |
89 | #define SHA_LONG unsigned int | |
90 | #endif | |
91 | ||
92 | #define SHA_LBLOCK 16 | |
93 | #define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a | |
94 | * contiguous array of 32 bit | |
95 | * wide big-endian values. */ | |
96 | #define SHA_LAST_BLOCK (SHA_CBLOCK-8) | |
97 | #define SHA_DIGEST_LENGTH 20 | |
98 | ||
99 | typedef struct SHAstate_st | |
100 | { | |
101 | SHA_LONG h0,h1,h2,h3,h4; | |
102 | SHA_LONG Nl,Nh; | |
103 | SHA_LONG data[SHA_LBLOCK]; | |
104 | unsigned int num; | |
105 | } SHA_CTX; | |
106 | ||
107 | #ifndef OPENSSL_NO_SHA0 | |
108 | int SHA_Init(SHA_CTX *c); | |
109 | int SHA_Update(SHA_CTX *c, const void *data, size_t len); | |
110 | int SHA_Final(unsigned char *md, SHA_CTX *c); | |
111 | unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md); | |
112 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); | |
113 | #endif | |
114 | #ifndef OPENSSL_NO_SHA1 | |
115 | int SHA1_Init(SHA_CTX *c); | |
116 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len); | |
117 | int SHA1_Final(unsigned char *md, SHA_CTX *c); | |
118 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); | |
119 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); | |
120 | #endif | |
121 | ||
122 | #define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a | |
123 | * contiguous array of 32 bit | |
124 | * wide big-endian values. */ | |
125 | #define SHA224_DIGEST_LENGTH 28 | |
126 | #define SHA256_DIGEST_LENGTH 32 | |
127 | ||
128 | typedef struct SHA256state_st | |
129 | { | |
130 | SHA_LONG h[8]; | |
131 | SHA_LONG Nl,Nh; | |
132 | SHA_LONG data[SHA_LBLOCK]; | |
133 | unsigned int num,md_len; | |
134 | } SHA256_CTX; | |
135 | ||
136 | #ifndef OPENSSL_NO_SHA256 | |
137 | int SHA224_Init(SHA256_CTX *c); | |
138 | int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); | |
139 | int SHA224_Final(unsigned char *md, SHA256_CTX *c); | |
140 | unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md); | |
141 | int SHA256_Init(SHA256_CTX *c); | |
142 | int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); | |
143 | int SHA256_Final(unsigned char *md, SHA256_CTX *c); | |
144 | unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md); | |
145 | void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); | |
146 | #endif | |
147 | ||
148 | #define SHA384_DIGEST_LENGTH 48 | |
149 | #define SHA512_DIGEST_LENGTH 64 | |
150 | ||
151 | #ifndef OPENSSL_NO_SHA512 | |
152 | /* | |
153 | * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 | |
154 | * being exactly 64-bit wide. See Implementation Notes in sha512.c | |
155 | * for further details. | |
156 | */ | |
157 | #define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a | |
158 | * contiguous array of 64 bit | |
159 | * wide big-endian values. */ | |
160 | #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) | |
161 | #define SHA_LONG64 unsigned __int64 | |
162 | #define U64(C) C##UI64 | |
163 | #elif defined(__arch64__) | |
164 | #define SHA_LONG64 unsigned long | |
165 | #define U64(C) C##UL | |
166 | #else | |
167 | #define SHA_LONG64 unsigned long long | |
168 | #define U64(C) C##ULL | |
169 | #endif | |
170 | ||
171 | typedef struct SHA512state_st | |
172 | { | |
173 | SHA_LONG64 h[8]; | |
174 | SHA_LONG64 Nl,Nh; | |
175 | union { | |
176 | SHA_LONG64 d[SHA_LBLOCK]; | |
177 | unsigned char p[SHA512_CBLOCK]; | |
178 | } u; | |
179 | unsigned int num,md_len; | |
180 | } SHA512_CTX; | |
181 | #endif | |
182 | ||
183 | #ifndef OPENSSL_NO_SHA512 | |
184 | int SHA384_Init(SHA512_CTX *c); | |
185 | int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); | |
186 | int SHA384_Final(unsigned char *md, SHA512_CTX *c); | |
187 | unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md); | |
188 | int SHA512_Init(SHA512_CTX *c); | |
189 | int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); | |
190 | int SHA512_Final(unsigned char *md, SHA512_CTX *c); | |
191 | unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md); | |
192 | void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); | |
193 | #endif | |
194 | ||
195 | #ifdef __cplusplus | |
196 | } | |
197 | #endif | |
198 | ||
199 | #endif |
12 | 12 | * Use -m64 instead of -bpowerpc64-linux on ppc64. (Closes: #335486) |
13 | 13 | * Make powerpc and ppc64 use the assembler version for bn. ppc64 |
14 | 14 | had the location in the string wrong, powerpc had it missing. |
15 | ||
16 | -- Kurt Roeckx <kurt@roeckx.be> Wed, 9 Nov 2005 22:05:39 +0100 | |
15 | * Add includes for stddef to get size_t in md2.h, md4.h, md5.h, | |
16 | ripemd.h and sha.h. (Closes: #333101) | |
17 | * Run make test for each of the versions we build, make it | |
18 | not fail the build process if an error is found. | |
19 | ||
20 | -- Kurt Roeckx <kurt@roeckx.be> Wed, 13 Nov 2005 16:01:05 +0100 | |
17 | 21 | |
18 | 22 | openssl (0.9.8a-3) unstable; urgency=high |
19 | 23 |
33 | 33 | # chmod +x debian/libtool |
34 | 34 | ./Configure no-shared $(CONFARGS) debian-$(DEB_HOST_ARCH) |
35 | 35 | make -f Makefile DIRS="crypto ssl" all |
36 | -make test | |
36 | 37 | mv libcrypto.a libcrypto.static |
37 | 38 | mv libssl.a libssl.static |
38 | 39 | make -f Makefile DIRS="crypto ssl" clean |
41 | 42 | set -xe; \ |
42 | 43 | ./Configure shared $(CONFARGS) debian-$(DEB_HOST_ARCH)-$$opt; \ |
43 | 44 | make -f Makefile DIRS="crypto ssl" all; \ |
45 | -make test; \ | |
44 | 46 | mkdir -p $$opt; \ |
45 | 47 | mv libcrypto.so* libssl.so* $$opt/; \ |
46 | 48 | make -f Makefile DIRS="crypto ssl" clean; \ |
50 | 52 | ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/ |
51 | 53 | # make -f Makefile linux-shared |
52 | 54 | make -f Makefile all |
55 | -make test | |
53 | 56 | # strip apps/openssl |
54 | 57 | # make -f Makefile clean DIRS="crypto ssl" |
55 | 58 | # ./Configure --prefix=/usr --openssldir=/usr/lib/ssl no-idea no-mdc2 no-rc5 debian-$(DEB_HOST_ARCH) |