| OLD | NEW |
| (Empty) |
| 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 | |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
| 4 /* $Id: hasht.h,v 1.9 2012/04/25 14:49:43 gerv%gerv.net Exp $ */ | |
| 5 | |
| 6 #ifndef _HASHT_H_ | |
| 7 #define _HASHT_H_ | |
| 8 | |
| 9 /* Opaque objects */ | |
| 10 typedef struct SECHashObjectStr SECHashObject; | |
| 11 typedef struct HASHContextStr HASHContext; | |
| 12 | |
| 13 /* | |
| 14 * The hash functions the security library supports | |
| 15 * NOTE the order must match the definition of SECHashObjects[]! | |
| 16 */ | |
| 17 typedef enum { | |
| 18 HASH_AlgNULL = 0, | |
| 19 HASH_AlgMD2 = 1, | |
| 20 HASH_AlgMD5 = 2, | |
| 21 HASH_AlgSHA1 = 3, | |
| 22 HASH_AlgSHA256 = 4, | |
| 23 HASH_AlgSHA384 = 5, | |
| 24 HASH_AlgSHA512 = 6, | |
| 25 HASH_AlgSHA224 = 7, | |
| 26 HASH_AlgTOTAL | |
| 27 } HASH_HashType; | |
| 28 | |
| 29 /* | |
| 30 * Number of bytes each hash algorithm produces | |
| 31 */ | |
| 32 #define MD2_LENGTH 16 | |
| 33 #define MD5_LENGTH 16 | |
| 34 #define SHA1_LENGTH 20 | |
| 35 #define SHA224_LENGTH 28 | |
| 36 #define SHA256_LENGTH 32 | |
| 37 #define SHA384_LENGTH 48 | |
| 38 #define SHA512_LENGTH 64 | |
| 39 #define HASH_LENGTH_MAX SHA512_LENGTH | |
| 40 | |
| 41 /* | |
| 42 * Structure to hold hash computation info and routines | |
| 43 */ | |
| 44 struct SECHashObjectStr { | |
| 45 unsigned int length; /* hash output length (in bytes) */ | |
| 46 void * (*create)(void); | |
| 47 void * (*clone)(void *); | |
| 48 void (*destroy)(void *, PRBool); | |
| 49 void (*begin)(void *); | |
| 50 void (*update)(void *, const unsigned char *, unsigned int); | |
| 51 void (*end)(void *, unsigned char *, unsigned int *, unsigned int); | |
| 52 unsigned int blocklength; /* hash input block size (in bytes) */ | |
| 53 HASH_HashType type; | |
| 54 }; | |
| 55 | |
| 56 struct HASHContextStr { | |
| 57 const struct SECHashObjectStr *hashobj; | |
| 58 void *hash_context; | |
| 59 }; | |
| 60 | |
| 61 /* This symbol is NOT exported from the NSS DLL. Code that needs a | |
| 62 * pointer to one of the SECHashObjects should call HASH_GetHashObject() | |
| 63 * instead. See "sechash.h". | |
| 64 */ | |
| 65 extern const SECHashObject SECHashObjects[]; | |
| 66 | |
| 67 /* Only those functions below the PKCS #11 line should use SECRawHashObjects. | |
| 68 * This symbol is not exported from the NSS DLL. | |
| 69 */ | |
| 70 extern const SECHashObject SECRawHashObjects[]; | |
| 71 | |
| 72 #endif /* _HASHT_H_ */ | |
| OLD | NEW |