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