1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/src/nsCryptoHash.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef _nsCryptoHash_h_ 1.11 +#define _nsCryptoHash_h_ 1.12 + 1.13 +#include "nsICryptoHash.h" 1.14 +#include "nsICryptoHMAC.h" 1.15 +#include "nsNSSShutDown.h" 1.16 +#include "hasht.h" 1.17 +#include "secmodt.h" 1.18 + 1.19 +class nsIInputStream; 1.20 + 1.21 +#define NS_CRYPTO_HASH_CID {0x36a1d3b3, 0xd886, 0x4317, {0x96, 0xff, 0x87, 0xb0, 0x00, 0x5c, 0xfe, 0xf7}} 1.22 +#define NS_CRYPTO_HMAC_CID {0xa496d0a2, 0xdff7, 0x4e23, {0xbd, 0x65, 0x1c, 0xa7, 0x42, 0xfa, 0x17, 0x8a}} 1.23 + 1.24 +class nsCryptoHash : public nsICryptoHash, public nsNSSShutDownObject 1.25 +{ 1.26 +public: 1.27 + NS_DECL_ISUPPORTS 1.28 + NS_DECL_NSICRYPTOHASH 1.29 + 1.30 + nsCryptoHash(); 1.31 + 1.32 +private: 1.33 + ~nsCryptoHash(); 1.34 + 1.35 + HASHContext* mHashContext; 1.36 + bool mInitialized; 1.37 + 1.38 + virtual void virtualDestroyNSSReference(); 1.39 + void destructorSafeDestroyNSSReference(); 1.40 +}; 1.41 + 1.42 +class nsCryptoHMAC : public nsICryptoHMAC, public nsNSSShutDownObject 1.43 +{ 1.44 +public: 1.45 + NS_DECL_ISUPPORTS 1.46 + NS_DECL_NSICRYPTOHMAC 1.47 + 1.48 + nsCryptoHMAC(); 1.49 + 1.50 +private: 1.51 + ~nsCryptoHMAC(); 1.52 + PK11Context* mHMACContext; 1.53 + 1.54 + virtual void virtualDestroyNSSReference(); 1.55 + void destructorSafeDestroyNSSReference(); 1.56 +}; 1.57 + 1.58 +#endif // _nsCryptoHash_h_ 1.59 +