| 39 | namespace mmkv { |
| 40 | |
| 41 | CodedInputDataCrypt::CodedInputDataCrypt(const void *oData, size_t length, AESCrypt &crypt) |
| 42 | : m_ptr((uint8_t *) oData), m_size(length), m_position(0), m_decryptPosition(0), m_decrypter(crypt) { |
| 43 | m_decryptBufferSize = AES_IV_LEN * 2; |
| 44 | m_decryptBufferPosition = static_cast<size_t>(crypt.m_number); |
| 45 | m_decryptBufferDiscardPosition = m_decryptBufferPosition; |
| 46 | m_decryptBufferDecryptLength = m_decryptBufferPosition; |
| 47 | |
| 48 | m_decryptBuffer = (uint8_t *) malloc(m_decryptBufferSize); |
| 49 | if (!m_decryptBuffer) { |
| 50 | throw runtime_error(strerror(errno)); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | CodedInputDataCrypt::~CodedInputDataCrypt() { |
| 55 | if (m_decryptBuffer) { |
nothing calls this directly
no outgoing calls
no test coverage detected