OLD | NEW |
1 /* | 1 /* |
2 * Verification stuff. | 2 * Verification stuff. |
3 * | 3 * |
4 * This Source Code Form is subject to the terms of the Mozilla Public | 4 * This Source Code Form is subject to the terms of the Mozilla Public |
5 * License, v. 2.0. If a copy of the MPL was not distributed with this | 5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include "cryptohi.h" | 9 #include "cryptohi.h" |
10 #include "sechash.h" | 10 #include "sechash.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 * encalg: address of a SECOidTag which will be set with the signing alg. | 175 * encalg: address of a SECOidTag which will be set with the signing alg. |
176 * | 176 * |
177 * Returns: SECSuccess if the algorithm was acceptable, SECFailure if the | 177 * Returns: SECSuccess if the algorithm was acceptable, SECFailure if the |
178 * algorithm was not found or was not a signing algorithm. | 178 * algorithm was not found or was not a signing algorithm. |
179 */ | 179 */ |
180 SECStatus | 180 SECStatus |
181 sec_DecodeSigAlg(const SECKEYPublicKey *key, SECOidTag sigAlg, | 181 sec_DecodeSigAlg(const SECKEYPublicKey *key, SECOidTag sigAlg, |
182 const SECItem *param, SECOidTag *encalg, SECOidTag *hashalg) | 182 const SECItem *param, SECOidTag *encalg, SECOidTag *hashalg) |
183 { | 183 { |
184 int len; | 184 int len; |
185 PRArenaPool *arena; | 185 PLArenaPool *arena; |
186 SECStatus rv; | 186 SECStatus rv; |
187 SECItem oid; | 187 SECItem oid; |
188 | 188 |
189 PR_ASSERT(hashalg!=NULL); | 189 PR_ASSERT(hashalg!=NULL); |
190 PR_ASSERT(encalg!=NULL); | 190 PR_ASSERT(encalg!=NULL); |
191 | 191 |
192 switch (sigAlg) { | 192 switch (sigAlg) { |
193 /* We probably shouldn't be generating MD2 signatures either */ | 193 /* We probably shouldn't be generating MD2 signatures either */ |
194 case SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION: | 194 case SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION: |
195 *hashalg = SEC_OID_MD2; | 195 *hashalg = SEC_OID_MD2; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 { | 723 { |
724 SECOidTag encAlg, hashAlg; | 724 SECOidTag encAlg, hashAlg; |
725 SECOidTag sigAlg = SECOID_GetAlgorithmTag((SECAlgorithmID *)sigAlgorithm); | 725 SECOidTag sigAlg = SECOID_GetAlgorithmTag((SECAlgorithmID *)sigAlgorithm); |
726 SECStatus rv = sec_DecodeSigAlg(key, sigAlg, | 726 SECStatus rv = sec_DecodeSigAlg(key, sigAlg, |
727 &sigAlgorithm->parameters, &encAlg, &hashAlg); | 727 &sigAlgorithm->parameters, &encAlg, &hashAlg); |
728 if (rv != SECSuccess) { | 728 if (rv != SECSuccess) { |
729 return rv; | 729 return rv; |
730 } | 730 } |
731 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx); | 731 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx); |
732 } | 732 } |
OLD | NEW |