| 26 | } |
| 27 | |
| 28 | void CCM_Base::Resync(const byte *iv, size_t len) |
| 29 | { |
| 30 | BlockCipher &cipher = AccessBlockCipher(); |
| 31 | |
| 32 | m_L = REQUIRED_BLOCKSIZE-1-(int)len; |
| 33 | CRYPTOPP_ASSERT(m_L >= 2); |
| 34 | if (m_L > 8) |
| 35 | m_L = 8; |
| 36 | |
| 37 | m_buffer[0] = byte(m_L-1); // flag |
| 38 | memcpy(m_buffer+1, iv, len); |
| 39 | memset(m_buffer+1+len, 0, REQUIRED_BLOCKSIZE-1-len); |
| 40 | |
| 41 | if (m_state >= State_IVSet) |
| 42 | m_ctr.Resynchronize(m_buffer, REQUIRED_BLOCKSIZE); |
| 43 | else |
| 44 | m_ctr.SetCipherWithIV(cipher, m_buffer); |
| 45 | |
| 46 | m_ctr.Seek(REQUIRED_BLOCKSIZE); |
| 47 | m_aadLength = 0; |
| 48 | m_messageLength = 0; |
| 49 | } |
| 50 | |
| 51 | void CCM_Base::UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword /*footerLength*/) |
| 52 | { |
nothing calls this directly
no test coverage detected