Clear security sensitive data
As password is sensitive data Clear after use.
Tested:
Verified using ipmitool commands
Command: ipmitool user set password 5 asdf1234 //Set user password
Response: Set User Password command successful (user 5)
Command: ipmitool raw 6 0x47 5 2 0x30 0x70 0x65 0x6e 0x42 0x6d 0x63
0x31 0 0 0 0 0 0 0 0 //set user password - set password
Response: //Success
Command: ipmitool raw 6 0x47 5 3 0x30 0x70 0x65 0x6e 0x42 0x6d 0x63
0x31 0 0 0 0 0 0 0 0 //set user password - test password
Response: //Success
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I06196233ac5468534bd10fd34f99f7d35fd7b971
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index bda4027..622857c 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -413,9 +413,17 @@
{
log<level::DEBUG>("Test password failed",
entry("USER-ID=%d", (uint8_t)req->userId));
+ // Clear sensitive data
+ OPENSSL_cleanse(&testPassword, testPassword.length());
+ OPENSSL_cleanse(&password, password.length());
+
return static_cast<Cc>(
IPMISetPasswordReturnCodes::ipmiCCPasswdFailMismatch);
}
+ // Clear sensitive data
+ OPENSSL_cleanse(&testPassword, testPassword.length());
+ OPENSSL_cleanse(&password, password.length());
+
return ccSuccess;
}
return ccInvalidFieldRequest;