This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch libhdfs3
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git
The following commit(s) were added to refs/heads/libhdfs3 by this push:
new 8e0e644 [Fix](libhdfs3) Fix AES Block size to 128 bits. (#32)
8e0e644 is described below
commit 8e0e64410ce35d15c717721b11f0d90883c668b1
Author: Qi Chen <[email protected]>
AuthorDate: Fri Jan 20 21:37:09 2023 +0800
[Fix](libhdfs3) Fix AES Block size to 128 bits. (#32)
For AES, the algorithm block is fixed size of 128 bits.
http://en.wikipedia.org/wiki/Advanced_Encryption_Standard
---
src/client/CryptoCodec.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/client/CryptoCodec.cpp b/src/client/CryptoCodec.cpp
index bd4443f..c8dadb8 100644
--- a/src/client/CryptoCodec.cpp
+++ b/src/client/CryptoCodec.cpp
@@ -138,8 +138,9 @@ namespace Hdfs {
// Calculate new IV when appending an existed file.
std::string iv = encryptionInfo->getIv();
if (stream_offset > 0) {
- counter = stream_offset / AlgorithmBlockSize;
- padding = stream_offset % AlgorithmBlockSize;
+ // For AES, the algorithm block is fixed size of 128
bits.
+ counter = stream_offset / 16;
+ padding = stream_offset % 16;
iv = this->calculateIV(iv, counter);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]