MCPcopy Create free account
hub / github.com/apache/impala / EncryptAndHash

Method EncryptAndHash

be/src/runtime/tmp-file-mgr.cc:2142–2156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2140}
2141
2142Status 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
2158Status TmpWriteHandle::CheckHashAndDecrypt(
2159 MemRange buffer, const BufferPoolClientCounters* counters) {

Callers

nothing calls this directly

Calls 8

OKFunction · 0.85
InitializeRandomMethod · 0.80
EncryptMethod · 0.80
IsGcmModeMethod · 0.80
dataMethod · 0.45
lenMethod · 0.45
ComputeMethod · 0.45

Tested by

no test coverage detected