michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _HASH_H_ michael@0: #define _HASH_H_ michael@0: michael@0: #include "seccomon.h" michael@0: #include "hasht.h" michael@0: #include "secoidt.h" michael@0: michael@0: SEC_BEGIN_PROTOS michael@0: michael@0: /* michael@0: ** Generic hash api. michael@0: */ michael@0: michael@0: extern unsigned int HASH_ResultLen(HASH_HashType type); michael@0: michael@0: extern unsigned int HASH_ResultLenContext(HASHContext *context); michael@0: michael@0: extern unsigned int HASH_ResultLenByOidTag(SECOidTag hashOid); michael@0: michael@0: extern SECStatus HASH_HashBuf(HASH_HashType type, michael@0: unsigned char *dest, michael@0: const unsigned char *src, michael@0: PRUint32 src_len); michael@0: michael@0: extern HASHContext * HASH_Create(HASH_HashType type); michael@0: michael@0: extern HASHContext * HASH_Clone(HASHContext *context); michael@0: michael@0: extern void HASH_Destroy(HASHContext *context); michael@0: michael@0: extern void HASH_Begin(HASHContext *context); michael@0: michael@0: extern void HASH_Update(HASHContext *context, michael@0: const unsigned char *src, michael@0: unsigned int len); michael@0: michael@0: extern void HASH_End(HASHContext *context, michael@0: unsigned char *result, michael@0: unsigned int *result_len, michael@0: unsigned int max_result_len); michael@0: michael@0: extern HASH_HashType HASH_GetType(HASHContext *context); michael@0: michael@0: extern const SECHashObject * HASH_GetHashObject(HASH_HashType type); michael@0: michael@0: extern const SECHashObject * HASH_GetHashObjectByOidTag(SECOidTag hashOid); michael@0: michael@0: extern HASH_HashType HASH_GetHashTypeByOidTag(SECOidTag hashOid); michael@0: extern SECOidTag HASH_GetHashOidTagByHMACOidTag(SECOidTag hmacOid); michael@0: extern SECOidTag HASH_GetHMACOidTagByHashOidTag(SECOidTag hashOid); michael@0: michael@0: SEC_END_PROTOS michael@0: michael@0: #endif /* _HASH_H_ */