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 * pkix_pl_publickey.c | 5 * pkix_pl_publickey.c |
6 * | 6 * |
7 * Certificate Object Functions | 7 * Certificate Object Functions |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 PKIX_UInt32 *pHashcode, | 204 PKIX_UInt32 *pHashcode, |
205 void *plContext) | 205 void *plContext) |
206 { | 206 { |
207 PKIX_PL_PublicKey *pkixPubKey = NULL; | 207 PKIX_PL_PublicKey *pkixPubKey = NULL; |
208 SECItem algOID; | 208 SECItem algOID; |
209 SECItem algParams; | 209 SECItem algParams; |
210 SECItem nssPubKey; | 210 SECItem nssPubKey; |
211 PKIX_UInt32 algOIDHash; | 211 PKIX_UInt32 algOIDHash; |
212 PKIX_UInt32 algParamsHash; | 212 PKIX_UInt32 algParamsHash; |
213 PKIX_UInt32 pubKeyHash; | 213 PKIX_UInt32 pubKeyHash; |
214 PKIX_UInt32 fullHash; | |
215 | 214 |
216 PKIX_ENTER(PUBLICKEY, "pkix_pl_PublicKey_Hashcode"); | 215 PKIX_ENTER(PUBLICKEY, "pkix_pl_PublicKey_Hashcode"); |
217 PKIX_NULLCHECK_TWO(object, pHashcode); | 216 PKIX_NULLCHECK_TWO(object, pHashcode); |
218 | 217 |
219 PKIX_CHECK(pkix_CheckType(object, PKIX_PUBLICKEY_TYPE, plContext), | 218 PKIX_CHECK(pkix_CheckType(object, PKIX_PUBLICKEY_TYPE, plContext), |
220 PKIX_OBJECTNOTPUBLICKEY); | 219 PKIX_OBJECTNOTPUBLICKEY); |
221 | 220 |
222 pkixPubKey = (PKIX_PL_PublicKey *)object; | 221 pkixPubKey = (PKIX_PL_PublicKey *)object; |
223 | 222 |
224 PKIX_NULLCHECK_ONE(pkixPubKey->nssSPKI); | 223 PKIX_NULLCHECK_ONE(pkixPubKey->nssSPKI); |
225 | 224 |
226 algOID = pkixPubKey->nssSPKI->algorithm.algorithm; | 225 algOID = pkixPubKey->nssSPKI->algorithm.algorithm; |
227 algParams = pkixPubKey->nssSPKI->algorithm.parameters; | 226 algParams = pkixPubKey->nssSPKI->algorithm.parameters; |
228 nssPubKey = pkixPubKey->nssSPKI->subjectPublicKey; | 227 nssPubKey = pkixPubKey->nssSPKI->subjectPublicKey; |
229 | 228 |
230 PKIX_CHECK(pkix_hash | 229 PKIX_CHECK(pkix_hash |
231 (algOID.data, algOID.len, &algOIDHash, plContext), | 230 (algOID.data, algOID.len, &algOIDHash, plContext), |
232 PKIX_HASHFAILED); | 231 PKIX_HASHFAILED); |
233 | 232 |
234 PKIX_CHECK(pkix_hash | 233 PKIX_CHECK(pkix_hash |
235 (algParams.data, algParams.len, &algParamsHash, plContext), | 234 (algParams.data, algParams.len, &algParamsHash, plContext), |
236 PKIX_HASHFAILED); | 235 PKIX_HASHFAILED); |
237 | 236 |
238 PKIX_CHECK(pkix_hash | 237 PKIX_CHECK(pkix_hash |
239 (nssPubKey.data, nssPubKey.len, &pubKeyHash, plContext), | 238 (nssPubKey.data, nssPubKey.len, &pubKeyHash, plContext), |
240 PKIX_HASHFAILED); | 239 PKIX_HASHFAILED); |
241 | 240 |
242 fullHash = algOIDHash + algParamsHash + pubKeyHash; | |
243 | |
244 *pHashcode = pubKeyHash; | 241 *pHashcode = pubKeyHash; |
245 | 242 |
246 cleanup: | 243 cleanup: |
247 | 244 |
248 PKIX_RETURN(PUBLICKEY); | 245 PKIX_RETURN(PUBLICKEY); |
249 } | 246 } |
250 | 247 |
251 | 248 |
252 /* | 249 /* |
253 * FUNCTION: pkix_pl_PublicKey_Equals | 250 * FUNCTION: pkix_pl_PublicKey_Equals |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 cleanup: | 480 cleanup: |
484 | 481 |
485 if (thirdSPKI && PKIX_ERROR_RECEIVED){ | 482 if (thirdSPKI && PKIX_ERROR_RECEIVED){ |
486 PKIX_CHECK(pkix_pl_DestroySPKI(thirdSPKI, plContext), | 483 PKIX_CHECK(pkix_pl_DestroySPKI(thirdSPKI, plContext), |
487 PKIX_DESTROYSPKIFAILED); | 484 PKIX_DESTROYSPKIFAILED); |
488 PKIX_FREE(thirdSPKI); | 485 PKIX_FREE(thirdSPKI); |
489 } | 486 } |
490 | 487 |
491 PKIX_RETURN(PUBLICKEY); | 488 PKIX_RETURN(PUBLICKEY); |
492 } | 489 } |
OLD | NEW |