| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Verification stuff. | 2 * Verification stuff. |
| 3 * | 3 * |
| 4 * ***** BEGIN LICENSE BLOCK ***** | 4 * ***** BEGIN LICENSE BLOCK ***** |
| 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 6 * | 6 * |
| 7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
| 8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
| 9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
| 10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 * in which case the provisions of the GPL or the LGPL are applicable instead | 30 * in which case the provisions of the GPL or the LGPL are applicable instead |
| 31 * of those above. If you wish to allow use of your version of this file only | 31 * of those above. If you wish to allow use of your version of this file only |
| 32 * under the terms of either the GPL or the LGPL, and not to allow others to | 32 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 33 * use your version of this file under the terms of the MPL, indicate your | 33 * use your version of this file under the terms of the MPL, indicate your |
| 34 * decision by deleting the provisions above and replace them with the notice | 34 * decision by deleting the provisions above and replace them with the notice |
| 35 * and other provisions required by the GPL or the LGPL. If you do not delete | 35 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 36 * the provisions above, a recipient may use your version of this file under | 36 * the provisions above, a recipient may use your version of this file under |
| 37 * the terms of any one of the MPL, the GPL or the LGPL. | 37 * the terms of any one of the MPL, the GPL or the LGPL. |
| 38 * | 38 * |
| 39 * ***** END LICENSE BLOCK ***** */ | 39 * ***** END LICENSE BLOCK ***** */ |
| 40 /* $Id: secvfy.c,v 1.22 2008/02/28 04:27:36 nelson%bolyard.com Exp $ */ | 40 /* $Id: secvfy.c,v 1.23 2010/02/10 00:49:43 wtc%google.com Exp $ */ |
| 41 | 41 |
| 42 #include <stdio.h> | 42 #include <stdio.h> |
| 43 #include "cryptohi.h" | 43 #include "cryptohi.h" |
| 44 #include "sechash.h" | 44 #include "sechash.h" |
| 45 #include "keyhi.h" | 45 #include "keyhi.h" |
| 46 #include "secasn1.h" | 46 #include "secasn1.h" |
| 47 #include "secoid.h" | 47 #include "secoid.h" |
| 48 #include "pk11func.h" | 48 #include "pk11func.h" |
| 49 #include "secdig.h" | 49 #include "secdig.h" |
| 50 #include "secerr.h" | 50 #include "secerr.h" |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 SECStatus | 714 SECStatus |
| 715 VFY_VerifyDataDirect(const unsigned char *buf, int len, | 715 VFY_VerifyDataDirect(const unsigned char *buf, int len, |
| 716 const SECKEYPublicKey *key, const SECItem *sig, | 716 const SECKEYPublicKey *key, const SECItem *sig, |
| 717 SECOidTag encAlg, SECOidTag hashAlg, | 717 SECOidTag encAlg, SECOidTag hashAlg, |
| 718 SECOidTag *hash, void *wincx) | 718 SECOidTag *hash, void *wincx) |
| 719 { | 719 { |
| 720 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx); | 720 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx); |
| 721 } | 721 } |
| 722 | 722 |
| 723 SECStatus | 723 SECStatus |
| 724 VFY_VerifyData(unsigned char *buf, int len, SECKEYPublicKey *key, | 724 VFY_VerifyData(const unsigned char *buf, int len, const SECKEYPublicKey *key, |
| 725 » SECItem *sig, SECOidTag algid, void *wincx) | 725 » const SECItem *sig, SECOidTag algid, void *wincx) |
| 726 { | 726 { |
| 727 SECOidTag encAlg, hashAlg; | 727 SECOidTag encAlg, hashAlg; |
| 728 SECStatus rv = sec_DecodeSigAlg(key, algid, NULL, &encAlg, &hashAlg); | 728 SECStatus rv = sec_DecodeSigAlg(key, algid, NULL, &encAlg, &hashAlg); |
| 729 if (rv != SECSuccess) { | 729 if (rv != SECSuccess) { |
| 730 return rv; | 730 return rv; |
| 731 } | 731 } |
| 732 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, NULL, wincx); | 732 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, NULL, wincx); |
| 733 } | 733 } |
| 734 | 734 |
| 735 SECStatus | 735 SECStatus |
| 736 VFY_VerifyDataWithAlgorithmID(const unsigned char *buf, int len, | 736 VFY_VerifyDataWithAlgorithmID(const unsigned char *buf, int len, |
| 737 const SECKEYPublicKey *key, | 737 const SECKEYPublicKey *key, |
| 738 const SECItem *sig, | 738 const SECItem *sig, |
| 739 const SECAlgorithmID *sigAlgorithm, | 739 const SECAlgorithmID *sigAlgorithm, |
| 740 SECOidTag *hash, void *wincx) | 740 SECOidTag *hash, void *wincx) |
| 741 { | 741 { |
| 742 SECOidTag encAlg, hashAlg; | 742 SECOidTag encAlg, hashAlg; |
| 743 SECOidTag sigAlg = SECOID_GetAlgorithmTag((SECAlgorithmID *)sigAlgorithm); | 743 SECOidTag sigAlg = SECOID_GetAlgorithmTag((SECAlgorithmID *)sigAlgorithm); |
| 744 SECStatus rv = sec_DecodeSigAlg(key, sigAlg, | 744 SECStatus rv = sec_DecodeSigAlg(key, sigAlg, |
| 745 &sigAlgorithm->parameters, &encAlg, &hashAlg); | 745 &sigAlgorithm->parameters, &encAlg, &hashAlg); |
| 746 if (rv != SECSuccess) { | 746 if (rv != SECSuccess) { |
| 747 return rv; | 747 return rv; |
| 748 } | 748 } |
| 749 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx); | 749 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx); |
| 750 } | 750 } |
| OLD | NEW |