| OLD | NEW |
| 1 /* | 1 /* |
| 2 * crypto.h - public data structures and prototypes for the crypto library | 2 * crypto.h - public data structures and prototypes for the crypto library |
| 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 /* $Id: cryptohi.h,v 1.17 2012/06/25 21:48:39 rrelyea%redhat.com Exp $ */ | 7 /* $Id: cryptohi.h,v 1.17 2012/06/25 21:48:39 rrelyea%redhat.com Exp $ */ |
| 8 | 8 |
| 9 #ifndef _CRYPTOHI_H_ | 9 #ifndef _CRYPTOHI_H_ |
| 10 #define _CRYPTOHI_H_ | 10 #define _CRYPTOHI_H_ |
| 11 | 11 |
| 12 #include "blapit.h" | 12 #include "blapit.h" |
| 13 | 13 |
| 14 #include "seccomon.h" | 14 #include "seccomon.h" |
| 15 #include "secoidt.h" | 15 #include "secoidt.h" |
| 16 #include "secdert.h" | 16 #include "secdert.h" |
| 17 #include "cryptoht.h" | 17 #include "cryptoht.h" |
| 18 #include "keyt.h" | 18 #include "keyt.h" |
| 19 #include "certt.h" | 19 #include "certt.h" |
| 20 | 20 |
| 21 | 21 |
| 22 SEC_BEGIN_PROTOS | 22 SEC_BEGIN_PROTOS |
| 23 | 23 |
| 24 | 24 |
| 25 /****************************************/ | 25 /****************************************/ |
| 26 /* | 26 /* |
| 27 ** DER encode/decode (EC)DSA signatures | 27 ** DER encode/decode (EC)DSA signatures |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 /* ANSI X9.57 defines DSA signatures as DER encoded data. Our DSA code (and | 30 /* ANSI X9.57 defines DSA signatures as DER encoded data. Our DSA1 code (and |
| 31 * most of the rest of the world) just generates 40 bytes of raw data. These | 31 * most of the rest of the world) just generates 40 bytes of raw data. These |
| 32 * functions convert between formats. | 32 * functions convert between formats. |
| 33 */ | 33 */ |
| 34 extern SECStatus DSAU_EncodeDerSig(SECItem *dest, SECItem *src); | 34 extern SECStatus DSAU_EncodeDerSig(SECItem *dest, SECItem *src); |
| 35 extern SECItem *DSAU_DecodeDerSig(const SECItem *item); | 35 extern SECItem *DSAU_DecodeDerSig(const SECItem *item); |
| 36 | 36 |
| 37 /* | 37 /* |
| 38 * Unlike DSA, raw ECDSA signatures do not have a fixed length. | 38 * Unlike DSA1, raw DSA2 and ECDSA signatures do not have a fixed length. |
| 39 * Rather they contain two integers r and s whose length depends | 39 * Rather they contain two integers r and s whose length depends |
| 40 * on the size of the EC key used for signing. | 40 * on the size of q or the EC key used for signing. |
| 41 * | 41 * |
| 42 * We can reuse the DSAU_EncodeDerSig interface to DER encode | 42 * We can reuse the DSAU_EncodeDerSig interface to DER encode |
| 43 * raw ECDSA signature keeping in mind that the length of r | 43 * raw ECDSA signature keeping in mind that the length of r |
| 44 * is the same as that of s and exactly half of src->len. | 44 * is the same as that of s and exactly half of src->len. |
| 45 * | 45 * |
| 46 * For decoding, we need to pass the length of the desired | 46 * For decoding, we need to pass the length of the desired |
| 47 * raw signature (twice the key size) explicitly. | 47 * raw signature (twice the key size) explicitly. |
| 48 */ | 48 */ |
| 49 extern SECStatus DSAU_EncodeDerSigWithLen(SECItem *dest, SECItem *src, | 49 extern SECStatus DSAU_EncodeDerSigWithLen(SECItem *dest, SECItem *src, |
| 50 unsigned int len); | 50 unsigned int len); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 extern SECStatus VFY_VerifyDataWithAlgorithmID(const unsigned char *buf, | 360 extern SECStatus VFY_VerifyDataWithAlgorithmID(const unsigned char *buf, |
| 361 int len, const SECKEYPublicKey *key, | 361 int len, const SECKEYPublicKey *key, |
| 362 const SECItem *sig, | 362 const SECItem *sig, |
| 363 const SECAlgorithmID *algid, SECOidTag *hash, | 363 const SECAlgorithmID *algid, SECOidTag *hash, |
| 364 void *wincx); | 364 void *wincx); |
| 365 | 365 |
| 366 | 366 |
| 367 SEC_END_PROTOS | 367 SEC_END_PROTOS |
| 368 | 368 |
| 369 #endif /* _CRYPTOHI_H_ */ | 369 #endif /* _CRYPTOHI_H_ */ |
| OLD | NEW |