MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / KeybufManager

Class KeybufManager

libcppcryptfs/util/KeybufManager.h:36–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34using namespace std;
35
36class KeybufManager
37{
38public:
39 mutex m_mutex;
40 KeyCache::id_t m_key_cache_id;
41 bool m_bActive;
42 bool m_bFinalized;
43 int m_refcount;
44 DWORD m_total_len;
45
46 vector<KeyBuf> m_bufs;
47 vector<BYTE> m_encryptedBuf;
48 BYTE m_optional_entropy[32];
49
50 KeybufManager();
51
52 virtual ~KeybufManager();
53private:
54 void RegisterBuf(BYTE* p, DWORD len);
55 bool EnterInternal();
56 void LeaveInternal();
57public:
58 template <typename T>
59 void RegisterBuf(LockZeroBuffer<T> *pBuf)
60 {
61 RegisterBuf(reinterpret_cast<BYTE*>(pBuf->m_buf), pBuf->m_len * sizeof(T));
62 };
63
64 void Activate() { m_bActive = true; };
65 bool Finalize(bool use_key_cache);
66
67 bool Enter()
68 {
69 if (!m_bActive)
70 return true;
71
72 return EnterInternal();
73 }
74 void Leave()
75 {
76 if (!m_bActive)
77 return;
78
79 LeaveInternal();
80 }
81
82 // disallow copying
83 KeybufManager(KeybufManager const&) = delete;
84 void operator=(KeybufManager const&) = delete;
85};
86
87class KeyDecryptor {
88 KeybufManager* m_mgr;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected