OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 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 | 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/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 #ifdef FREEBL_NO_DEPEND | 5 #ifdef FREEBL_NO_DEPEND |
6 #include "stubs.h" | 6 #include "stubs.h" |
7 #endif | 7 #endif |
8 | 8 |
9 #include "nspr.h" | 9 #include "nspr.h" |
10 #include "hasht.h" | 10 #include "hasht.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 const SECHashObject SECRawHashObjects[] = { | 51 const SECHashObject SECRawHashObjects[] = { |
52 { 0, | 52 { 0, |
53 (void * (*)(void)) null_hash_new_context, | 53 (void * (*)(void)) null_hash_new_context, |
54 (void * (*)(void *)) null_hash_clone_context, | 54 (void * (*)(void *)) null_hash_clone_context, |
55 (void (*)(void *, PRBool)) null_hash_destroy_context, | 55 (void (*)(void *, PRBool)) null_hash_destroy_context, |
56 (void (*)(void *)) null_hash_begin, | 56 (void (*)(void *)) null_hash_begin, |
57 (void (*)(void *, const unsigned char *, unsigned int)) null_hash_update, | 57 (void (*)(void *, const unsigned char *, unsigned int)) null_hash_update, |
58 (void (*)(void *, unsigned char *, unsigned int *, | 58 (void (*)(void *, unsigned char *, unsigned int *, |
59 unsigned int)) null_hash_end, | 59 unsigned int)) null_hash_end, |
60 0, | 60 0, |
61 HASH_AlgNULL | 61 HASH_AlgNULL, |
| 62 (void (*)(void *, unsigned char *, unsigned int *, |
| 63 » unsigned int)) null_hash_end |
62 }, | 64 }, |
63 { MD2_LENGTH, | 65 { MD2_LENGTH, |
64 (void * (*)(void)) MD2_NewContext, | 66 (void * (*)(void)) MD2_NewContext, |
65 (void * (*)(void *)) null_hash_clone_context, | 67 (void * (*)(void *)) null_hash_clone_context, |
66 (void (*)(void *, PRBool)) MD2_DestroyContext, | 68 (void (*)(void *, PRBool)) MD2_DestroyContext, |
67 (void (*)(void *)) MD2_Begin, | 69 (void (*)(void *)) MD2_Begin, |
68 (void (*)(void *, const unsigned char *, unsigned int)) MD2_Update, | 70 (void (*)(void *, const unsigned char *, unsigned int)) MD2_Update, |
69 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) MD2_End, | 71 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) MD2_End, |
70 MD2_BLOCK_LENGTH, | 72 MD2_BLOCK_LENGTH, |
71 HASH_AlgMD2 | 73 HASH_AlgMD2, |
| 74 NULL /* end_raw */ |
72 }, | 75 }, |
73 { MD5_LENGTH, | 76 { MD5_LENGTH, |
74 (void * (*)(void)) MD5_NewContext, | 77 (void * (*)(void)) MD5_NewContext, |
75 (void * (*)(void *)) null_hash_clone_context, | 78 (void * (*)(void *)) null_hash_clone_context, |
76 (void (*)(void *, PRBool)) MD5_DestroyContext, | 79 (void (*)(void *, PRBool)) MD5_DestroyContext, |
77 (void (*)(void *)) MD5_Begin, | 80 (void (*)(void *)) MD5_Begin, |
78 (void (*)(void *, const unsigned char *, unsigned int)) MD5_Update, | 81 (void (*)(void *, const unsigned char *, unsigned int)) MD5_Update, |
79 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) MD5_End, | 82 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) MD5_End, |
80 MD5_BLOCK_LENGTH, | 83 MD5_BLOCK_LENGTH, |
81 HASH_AlgMD5 | 84 HASH_AlgMD5, |
| 85 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) MD5_EndRaw |
82 }, | 86 }, |
83 { SHA1_LENGTH, | 87 { SHA1_LENGTH, |
84 (void * (*)(void)) SHA1_NewContext, | 88 (void * (*)(void)) SHA1_NewContext, |
85 (void * (*)(void *)) null_hash_clone_context, | 89 (void * (*)(void *)) null_hash_clone_context, |
86 (void (*)(void *, PRBool)) SHA1_DestroyContext, | 90 (void (*)(void *, PRBool)) SHA1_DestroyContext, |
87 (void (*)(void *)) SHA1_Begin, | 91 (void (*)(void *)) SHA1_Begin, |
88 (void (*)(void *, const unsigned char *, unsigned int)) SHA1_Update, | 92 (void (*)(void *, const unsigned char *, unsigned int)) SHA1_Update, |
89 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) SHA1_End, | 93 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) SHA1_End, |
90 SHA1_BLOCK_LENGTH, | 94 SHA1_BLOCK_LENGTH, |
91 HASH_AlgSHA1 | 95 HASH_AlgSHA1, |
| 96 (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) |
| 97 » SHA1_EndRaw |
92 }, | 98 }, |
93 { SHA256_LENGTH, | 99 { SHA256_LENGTH, |
94 (void * (*)(void)) SHA256_NewContext, | 100 (void * (*)(void)) SHA256_NewContext, |
95 (void * (*)(void *)) null_hash_clone_context, | 101 (void * (*)(void *)) null_hash_clone_context, |
96 (void (*)(void *, PRBool)) SHA256_DestroyContext, | 102 (void (*)(void *, PRBool)) SHA256_DestroyContext, |
97 (void (*)(void *)) SHA256_Begin, | 103 (void (*)(void *)) SHA256_Begin, |
98 (void (*)(void *, const unsigned char *, unsigned int)) SHA256_Update, | 104 (void (*)(void *, const unsigned char *, unsigned int)) SHA256_Update, |
99 (void (*)(void *, unsigned char *, unsigned int *, | 105 (void (*)(void *, unsigned char *, unsigned int *, |
100 unsigned int)) SHA256_End, | 106 unsigned int)) SHA256_End, |
101 SHA256_BLOCK_LENGTH, | 107 SHA256_BLOCK_LENGTH, |
102 HASH_AlgSHA256 | 108 HASH_AlgSHA256, |
| 109 (void (*)(void *, unsigned char *, unsigned int *, |
| 110 » unsigned int)) SHA256_EndRaw |
103 }, | 111 }, |
104 { SHA384_LENGTH, | 112 { SHA384_LENGTH, |
105 (void * (*)(void)) SHA384_NewContext, | 113 (void * (*)(void)) SHA384_NewContext, |
106 (void * (*)(void *)) null_hash_clone_context, | 114 (void * (*)(void *)) null_hash_clone_context, |
107 (void (*)(void *, PRBool)) SHA384_DestroyContext, | 115 (void (*)(void *, PRBool)) SHA384_DestroyContext, |
108 (void (*)(void *)) SHA384_Begin, | 116 (void (*)(void *)) SHA384_Begin, |
109 (void (*)(void *, const unsigned char *, unsigned int)) SHA384_Update, | 117 (void (*)(void *, const unsigned char *, unsigned int)) SHA384_Update, |
110 (void (*)(void *, unsigned char *, unsigned int *, | 118 (void (*)(void *, unsigned char *, unsigned int *, |
111 unsigned int)) SHA384_End, | 119 unsigned int)) SHA384_End, |
112 SHA384_BLOCK_LENGTH, | 120 SHA384_BLOCK_LENGTH, |
113 HASH_AlgSHA384 | 121 HASH_AlgSHA384, |
| 122 (void (*)(void *, unsigned char *, unsigned int *, |
| 123 » unsigned int)) SHA384_EndRaw |
114 }, | 124 }, |
115 { SHA512_LENGTH, | 125 { SHA512_LENGTH, |
116 (void * (*)(void)) SHA512_NewContext, | 126 (void * (*)(void)) SHA512_NewContext, |
117 (void * (*)(void *)) null_hash_clone_context, | 127 (void * (*)(void *)) null_hash_clone_context, |
118 (void (*)(void *, PRBool)) SHA512_DestroyContext, | 128 (void (*)(void *, PRBool)) SHA512_DestroyContext, |
119 (void (*)(void *)) SHA512_Begin, | 129 (void (*)(void *)) SHA512_Begin, |
120 (void (*)(void *, const unsigned char *, unsigned int)) SHA512_Update, | 130 (void (*)(void *, const unsigned char *, unsigned int)) SHA512_Update, |
121 (void (*)(void *, unsigned char *, unsigned int *, | 131 (void (*)(void *, unsigned char *, unsigned int *, |
122 unsigned int)) SHA512_End, | 132 unsigned int)) SHA512_End, |
123 SHA512_BLOCK_LENGTH, | 133 SHA512_BLOCK_LENGTH, |
124 HASH_AlgSHA512 | 134 HASH_AlgSHA512, |
| 135 (void (*)(void *, unsigned char *, unsigned int *, |
| 136 » unsigned int)) SHA512_EndRaw |
125 }, | 137 }, |
126 { SHA224_LENGTH, | 138 { SHA224_LENGTH, |
127 (void * (*)(void)) SHA224_NewContext, | 139 (void * (*)(void)) SHA224_NewContext, |
128 (void * (*)(void *)) null_hash_clone_context, | 140 (void * (*)(void *)) null_hash_clone_context, |
129 (void (*)(void *, PRBool)) SHA224_DestroyContext, | 141 (void (*)(void *, PRBool)) SHA224_DestroyContext, |
130 (void (*)(void *)) SHA224_Begin, | 142 (void (*)(void *)) SHA224_Begin, |
131 (void (*)(void *, const unsigned char *, unsigned int)) SHA224_Update, | 143 (void (*)(void *, const unsigned char *, unsigned int)) SHA224_Update, |
132 (void (*)(void *, unsigned char *, unsigned int *, | 144 (void (*)(void *, unsigned char *, unsigned int *, |
133 unsigned int)) SHA224_End, | 145 unsigned int)) SHA224_End, |
134 SHA224_BLOCK_LENGTH, | 146 SHA224_BLOCK_LENGTH, |
135 HASH_AlgSHA224 | 147 HASH_AlgSHA224, |
| 148 (void (*)(void *, unsigned char *, unsigned int *, |
| 149 » unsigned int)) SHA224_EndRaw |
136 }, | 150 }, |
137 }; | 151 }; |
138 | 152 |
139 const SECHashObject * | 153 const SECHashObject * |
140 HASH_GetRawHashObject(HASH_HashType hashType) | 154 HASH_GetRawHashObject(HASH_HashType hashType) |
141 { | 155 { |
142 if (hashType < HASH_AlgNULL || hashType >= HASH_AlgTOTAL) { | 156 if (hashType < HASH_AlgNULL || hashType >= HASH_AlgTOTAL) { |
143 PORT_SetError(SEC_ERROR_INVALID_ARGS); | 157 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
144 return NULL; | 158 return NULL; |
145 } | 159 } |
146 return &SECRawHashObjects[hashType]; | 160 return &SECRawHashObjects[hashType]; |
147 } | 161 } |
OLD | NEW |