OLD | NEW |
1 /* | 1 /* |
2 * Signature stuff. | 2 * Signature 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: secsign.c,v 1.21 2009/09/23 22:51:56 wtc%google.com Exp $ */ | 40 /* $Id: secsign.c,v 1.22 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 "secder.h" | 45 #include "secder.h" |
46 #include "keyhi.h" | 46 #include "keyhi.h" |
47 #include "secoid.h" | 47 #include "secoid.h" |
48 #include "secdig.h" | 48 #include "secdig.h" |
49 #include "pk11func.h" | 49 #include "pk11func.h" |
50 #include "secerr.h" | 50 #include "secerr.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 return rv; | 270 return rv; |
271 } | 271 } |
272 | 272 |
273 /************************************************************************/ | 273 /************************************************************************/ |
274 | 274 |
275 /* | 275 /* |
276 ** Sign a block of data returning in result a bunch of bytes that are the | 276 ** Sign a block of data returning in result a bunch of bytes that are the |
277 ** signature. Returns zero on success, an error code on failure. | 277 ** signature. Returns zero on success, an error code on failure. |
278 */ | 278 */ |
279 SECStatus | 279 SECStatus |
280 SEC_SignData(SECItem *res, unsigned char *buf, int len, | 280 SEC_SignData(SECItem *res, const unsigned char *buf, int len, |
281 SECKEYPrivateKey *pk, SECOidTag algid) | 281 SECKEYPrivateKey *pk, SECOidTag algid) |
282 { | 282 { |
283 SECStatus rv; | 283 SECStatus rv; |
284 SGNContext *sgn; | 284 SGNContext *sgn; |
285 | 285 |
286 | 286 |
287 sgn = SGN_NewContext(algid, pk); | 287 sgn = SGN_NewContext(algid, pk); |
288 | 288 |
289 if (sgn == NULL) | 289 if (sgn == NULL) |
290 return SECFailure; | 290 return SECFailure; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 case SEC_OID_SHA512: | 509 case SEC_OID_SHA512: |
510 sigTag = SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE; break; | 510 sigTag = SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE; break; |
511 default: | 511 default: |
512 break; | 512 break; |
513 } | 513 } |
514 default: | 514 default: |
515 break; | 515 break; |
516 } | 516 } |
517 return sigTag; | 517 return sigTag; |
518 } | 518 } |
OLD | NEW |