Mercurial > trustbridge > nss-cmake-static
comparison nss/lib/freebl/rawhash.c @ 0:1e5118fa0cb1
This is NSS with a Cmake Buildsyste
To compile a static NSS library for Windows we've used the
Chromium-NSS fork and added a Cmake buildsystem to compile
it statically for Windows. See README.chromium for chromium
changes and README.trustbridge for our modifications.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 28 Jul 2014 10:47:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1e5118fa0cb1 |
---|---|
1 /* This Source Code Form is subject to the terms of the Mozilla Public | |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
4 | |
5 #ifdef FREEBL_NO_DEPEND | |
6 #include "stubs.h" | |
7 #endif | |
8 | |
9 #include "nspr.h" | |
10 #include "hasht.h" | |
11 #include "blapi.h" /* below the line */ | |
12 #include "secerr.h" | |
13 | |
14 static void * | |
15 null_hash_new_context(void) | |
16 { | |
17 return NULL; | |
18 } | |
19 | |
20 static void * | |
21 null_hash_clone_context(void *v) | |
22 { | |
23 PORT_Assert(v == NULL); | |
24 return NULL; | |
25 } | |
26 | |
27 static void | |
28 null_hash_begin(void *v) | |
29 { | |
30 } | |
31 | |
32 static void | |
33 null_hash_update(void *v, const unsigned char *input, unsigned int length) | |
34 { | |
35 } | |
36 | |
37 static void | |
38 null_hash_end(void *v, unsigned char *output, unsigned int *outLen, | |
39 unsigned int maxOut) | |
40 { | |
41 *outLen = 0; | |
42 } | |
43 | |
44 static void | |
45 null_hash_destroy_context(void *v, PRBool b) | |
46 { | |
47 PORT_Assert(v == NULL); | |
48 } | |
49 | |
50 | |
51 const SECHashObject SECRawHashObjects[] = { | |
52 { 0, | |
53 (void * (*)(void)) null_hash_new_context, | |
54 (void * (*)(void *)) null_hash_clone_context, | |
55 (void (*)(void *, PRBool)) null_hash_destroy_context, | |
56 (void (*)(void *)) null_hash_begin, | |
57 (void (*)(void *, const unsigned char *, unsigned int)) null_hash_update, | |
58 (void (*)(void *, unsigned char *, unsigned int *, | |
59 unsigned int)) null_hash_end, | |
60 0, | |
61 HASH_AlgNULL, | |
62 (void (*)(void *, unsigned char *, unsigned int *, | |
63 unsigned int)) null_hash_end | |
64 }, | |
65 { MD2_LENGTH, | |
66 (void * (*)(void)) MD2_NewContext, | |
67 (void * (*)(void *)) null_hash_clone_context, | |
68 (void (*)(void *, PRBool)) MD2_DestroyContext, | |
69 (void (*)(void *)) MD2_Begin, | |
70 (void (*)(void *, const unsigned char *, unsigned int)) MD2_Update, | |
71 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) MD2_End, | |
72 MD2_BLOCK_LENGTH, | |
73 HASH_AlgMD2, | |
74 NULL /* end_raw */ | |
75 }, | |
76 { MD5_LENGTH, | |
77 (void * (*)(void)) MD5_NewContext, | |
78 (void * (*)(void *)) null_hash_clone_context, | |
79 (void (*)(void *, PRBool)) MD5_DestroyContext, | |
80 (void (*)(void *)) MD5_Begin, | |
81 (void (*)(void *, const unsigned char *, unsigned int)) MD5_Update, | |
82 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) MD5_End, | |
83 MD5_BLOCK_LENGTH, | |
84 HASH_AlgMD5, | |
85 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) MD5_EndRaw | |
86 }, | |
87 { SHA1_LENGTH, | |
88 (void * (*)(void)) SHA1_NewContext, | |
89 (void * (*)(void *)) null_hash_clone_context, | |
90 (void (*)(void *, PRBool)) SHA1_DestroyContext, | |
91 (void (*)(void *)) SHA1_Begin, | |
92 (void (*)(void *, const unsigned char *, unsigned int)) SHA1_Update, | |
93 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) SHA1_End, | |
94 SHA1_BLOCK_LENGTH, | |
95 HASH_AlgSHA1, | |
96 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) | |
97 SHA1_EndRaw | |
98 }, | |
99 { SHA256_LENGTH, | |
100 (void * (*)(void)) SHA256_NewContext, | |
101 (void * (*)(void *)) null_hash_clone_context, | |
102 (void (*)(void *, PRBool)) SHA256_DestroyContext, | |
103 (void (*)(void *)) SHA256_Begin, | |
104 (void (*)(void *, const unsigned char *, unsigned int)) SHA256_Update, | |
105 (void (*)(void *, unsigned char *, unsigned int *, | |
106 unsigned int)) SHA256_End, | |
107 SHA256_BLOCK_LENGTH, | |
108 HASH_AlgSHA256, | |
109 (void (*)(void *, unsigned char *, unsigned int *, | |
110 unsigned int)) SHA256_EndRaw | |
111 }, | |
112 { SHA384_LENGTH, | |
113 (void * (*)(void)) SHA384_NewContext, | |
114 (void * (*)(void *)) null_hash_clone_context, | |
115 (void (*)(void *, PRBool)) SHA384_DestroyContext, | |
116 (void (*)(void *)) SHA384_Begin, | |
117 (void (*)(void *, const unsigned char *, unsigned int)) SHA384_Update, | |
118 (void (*)(void *, unsigned char *, unsigned int *, | |
119 unsigned int)) SHA384_End, | |
120 SHA384_BLOCK_LENGTH, | |
121 HASH_AlgSHA384, | |
122 (void (*)(void *, unsigned char *, unsigned int *, | |
123 unsigned int)) SHA384_EndRaw | |
124 }, | |
125 { SHA512_LENGTH, | |
126 (void * (*)(void)) SHA512_NewContext, | |
127 (void * (*)(void *)) null_hash_clone_context, | |
128 (void (*)(void *, PRBool)) SHA512_DestroyContext, | |
129 (void (*)(void *)) SHA512_Begin, | |
130 (void (*)(void *, const unsigned char *, unsigned int)) SHA512_Update, | |
131 (void (*)(void *, unsigned char *, unsigned int *, | |
132 unsigned int)) SHA512_End, | |
133 SHA512_BLOCK_LENGTH, | |
134 HASH_AlgSHA512, | |
135 (void (*)(void *, unsigned char *, unsigned int *, | |
136 unsigned int)) SHA512_EndRaw | |
137 }, | |
138 { SHA224_LENGTH, | |
139 (void * (*)(void)) SHA224_NewContext, | |
140 (void * (*)(void *)) null_hash_clone_context, | |
141 (void (*)(void *, PRBool)) SHA224_DestroyContext, | |
142 (void (*)(void *)) SHA224_Begin, | |
143 (void (*)(void *, const unsigned char *, unsigned int)) SHA224_Update, | |
144 (void (*)(void *, unsigned char *, unsigned int *, | |
145 unsigned int)) SHA224_End, | |
146 SHA224_BLOCK_LENGTH, | |
147 HASH_AlgSHA224, | |
148 (void (*)(void *, unsigned char *, unsigned int *, | |
149 unsigned int)) SHA224_EndRaw | |
150 }, | |
151 }; | |
152 | |
153 const SECHashObject * | |
154 HASH_GetRawHashObject(HASH_HashType hashType) | |
155 { | |
156 if (hashType < HASH_AlgNULL || hashType >= HASH_AlgTOTAL) { | |
157 PORT_SetError(SEC_ERROR_INVALID_ARGS); | |
158 return NULL; | |
159 } | |
160 return &SECRawHashObjects[hashType]; | |
161 } |