| 2140 | } |
| 2141 | |
| 2142 | Status TmpWriteHandle::EncryptAndHash( |
| 2143 | MemRange buffer, const BufferPoolClientCounters* counters) { |
| 2144 | DCHECK(FLAGS_disk_spill_encryption); |
| 2145 | SCOPED_TIMER2(parent_->encryption_timer_, |
| 2146 | counters == nullptr ? nullptr : counters->encryption_time); |
| 2147 | // Since we're using GCM/CTR/CFB mode, we must take care not to reuse a |
| 2148 | // key/IV pair. Regenerate a new key and IV for every data buffer we write. |
| 2149 | RETURN_IF_ERROR(key_.InitializeRandom(AES_BLOCK_SIZE, key_.GetSupportedDefaultMode())); |
| 2150 | RETURN_IF_ERROR(key_.Encrypt(buffer.data(), buffer.len(), buffer.data())); |
| 2151 | |
| 2152 | if (!key_.IsGcmMode()) { |
| 2153 | hash_.Compute(buffer.data(), buffer.len()); |
| 2154 | } |
| 2155 | return Status::OK(); |
| 2156 | } |
| 2157 | |
| 2158 | Status TmpWriteHandle::CheckHashAndDecrypt( |
| 2159 | MemRange buffer, const BufferPoolClientCounters* counters) { |
nothing calls this directly
no test coverage detected