|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef _nsCryptoHash_h_ |
|
8 #define _nsCryptoHash_h_ |
|
9 |
|
10 #include "nsICryptoHash.h" |
|
11 #include "nsICryptoHMAC.h" |
|
12 #include "nsNSSShutDown.h" |
|
13 #include "hasht.h" |
|
14 #include "secmodt.h" |
|
15 |
|
16 class nsIInputStream; |
|
17 |
|
18 #define NS_CRYPTO_HASH_CID {0x36a1d3b3, 0xd886, 0x4317, {0x96, 0xff, 0x87, 0xb0, 0x00, 0x5c, 0xfe, 0xf7}} |
|
19 #define NS_CRYPTO_HMAC_CID {0xa496d0a2, 0xdff7, 0x4e23, {0xbd, 0x65, 0x1c, 0xa7, 0x42, 0xfa, 0x17, 0x8a}} |
|
20 |
|
21 class nsCryptoHash : public nsICryptoHash, public nsNSSShutDownObject |
|
22 { |
|
23 public: |
|
24 NS_DECL_ISUPPORTS |
|
25 NS_DECL_NSICRYPTOHASH |
|
26 |
|
27 nsCryptoHash(); |
|
28 |
|
29 private: |
|
30 ~nsCryptoHash(); |
|
31 |
|
32 HASHContext* mHashContext; |
|
33 bool mInitialized; |
|
34 |
|
35 virtual void virtualDestroyNSSReference(); |
|
36 void destructorSafeDestroyNSSReference(); |
|
37 }; |
|
38 |
|
39 class nsCryptoHMAC : public nsICryptoHMAC, public nsNSSShutDownObject |
|
40 { |
|
41 public: |
|
42 NS_DECL_ISUPPORTS |
|
43 NS_DECL_NSICRYPTOHMAC |
|
44 |
|
45 nsCryptoHMAC(); |
|
46 |
|
47 private: |
|
48 ~nsCryptoHMAC(); |
|
49 PK11Context* mHMACContext; |
|
50 |
|
51 virtual void virtualDestroyNSSReference(); |
|
52 void destructorSafeDestroyNSSReference(); |
|
53 }; |
|
54 |
|
55 #endif // _nsCryptoHash_h_ |
|
56 |