Removal of excess 16 bytes padding
Cipher block padding is applied twice(once manually, and
once through EVP_CipherFinal()) causing excess 16 bytes of
data. Manual padding is removed to fix the issue.
Unit-Test:
1. Verified that files are padded correctly without
excess 16 bytes. Also, verified the password update and
RMCP+ login using ipmitool
ipmitool user set password <userid> <password>
ipmitool -I lanplus -H 127.0.0.1 -U <userid> -P <password>
raw 6 1
2. Also verified renaming of user name and login
after that
Resolves openbmc/openbmc#3463
Change-Id: Idec14b100bf7558137ff14601eb590b50cdbd7bf
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/user_channel/passwd_mgr.cpp b/user_channel/passwd_mgr.cpp
index d4ff39f..525b2b7 100644
--- a/user_channel/passwd_mgr.cpp
+++ b/user_channel/passwd_mgr.cpp
@@ -41,11 +41,6 @@
#define META_PASSWD_SIG "=OPENBMC="
-static inline size_t blockRound(size_t odd, size_t blk)
-{
- return ((odd) + (((blk) - ((odd) & ((blk)-1))) & ((blk)-1)));
-}
-
/*
* Meta data struct for encrypted password file
*/
@@ -389,10 +384,7 @@
}
linePtr = strtok_r(NULL, "\n", &nToken);
}
-
- // Round of to block size and padding remaing bytes with zero.
- inBytesLen = blockRound(bytesWritten, EVP_CIPHER_block_size(cipher));
- std::memset(&inBytes[0] + bytesWritten, 0, inBytesLen - bytesWritten);
+ inBytesLen = bytesWritten;
}
if (!isUsrFound)
{