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

Method CheckHashAndDecrypt

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

Source from the content-addressed store, hash-verified

2156}
2157
2158Status TmpWriteHandle::CheckHashAndDecrypt(
2159 MemRange buffer, const BufferPoolClientCounters* counters) {
2160 DCHECK(FLAGS_disk_spill_encryption);
2161 DCHECK(write_range_ != nullptr);
2162 SCOPED_TIMER2(parent_->encryption_timer_,
2163 counters == nullptr ? nullptr : counters->encryption_time);
2164
2165 // GCM mode will verify the integrity by itself
2166 if (!key_.IsGcmMode()) {
2167 if (!hash_.Verify(buffer.data(), buffer.len())) {
2168 return Status(TErrorCode::SCRATCH_READ_VERIFY_FAILED, buffer.len(),
2169 write_range_->file(), GetBackendString(), write_range_->offset());
2170 }
2171 }
2172 Status decrypt_status = key_.Decrypt(buffer.data(), buffer.len(), buffer.data());
2173 if (!decrypt_status.ok()) {
2174 // Treat decryption failing as a verification failure, but include extra info from
2175 // the decryption status.
2176 Status result_status(TErrorCode::SCRATCH_READ_VERIFY_FAILED, buffer.len(),
2177 write_range_->file(), GetBackendString(), write_range_->offset());
2178 result_status.MergeStatus(decrypt_status);
2179 return result_status;
2180 }
2181 return Status::OK();
2182}
2183
2184void TmpWriteHandle::FreeCompressedBuffer() {
2185 if (compressed_.buffer() == nullptr) return;

Callers 2

WaitForAsyncReadMethod · 0.80
RestoreDataMethod · 0.80

Calls 12

GetBackendStringFunction · 0.85
OKFunction · 0.85
IsGcmModeMethod · 0.80
DecryptMethod · 0.80
MergeStatusMethod · 0.80
StatusClass · 0.70
VerifyMethod · 0.45
dataMethod · 0.45
lenMethod · 0.45
fileMethod · 0.45
offsetMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected