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

Method tabulateL

libcppcryptfs/crypt/eme.cpp:149–175  ·  view source on GitHub ↗

tabulateL - calculate L_i for messages up to a length of m cipher blocks

Source from the content-addressed store, hash-verified

147
148// tabulateL - calculate L_i for messages up to a length of m cipher blocks
149void EmeCryptContext::tabulateL(int m, CryptConfig *pConfig){
150
151 /* set L0 = 2*AESenc(K; 0) */
152 BYTE eZero[16];
153 memset(eZero, 0, sizeof(eZero));
154
155 LockZeroBuffer<BYTE> Li(16, true);
156
157 AesEncrypt(Li.m_buf, eZero, 16, this);
158
159 m_LTable = new LPBYTE[m];
160
161 // Allocate pool once and slice into m pieces in the loop
162
163 m_pLTableBuf = new LockZeroBuffer<BYTE>(m * 16, true);
164
165 pConfig->m_keybuf_manager.RegisterBuf(m_pLTableBuf);
166
167 BYTE *pool = m_pLTableBuf->m_buf;
168
169 for (int i = 0; i < m; i++) {
170 multByTwo(Li.m_buf, Li.m_buf, 16);
171 m_LTable[i] = pool + i * 16;
172 memcpy(m_LTable[i], Li.m_buf, 16);
173 }
174
175}
176
177
178

Callers

nothing calls this directly

Calls 3

AesEncryptFunction · 0.85
multByTwoFunction · 0.85
RegisterBufMethod · 0.45

Tested by

no test coverage detected