summaryrefslogtreecommitdiff
path: root/PasswordCrypt.c
diff options
context:
space:
mode:
authorMathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>2018-07-24 16:24:23 -0400
committerMathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>2018-07-24 16:24:23 -0400
commitca6b8577754558ed790dd305d9579d7d5ed72091 (patch)
treef4aef8def509710b9e5a73ca4fb7105e439636a8 /PasswordCrypt.c
parent3802e1ad5adf91f955b9f1408950e28bad10d830 (diff)
parentf892ac66084ab0315adb0c52e4a39b518730d023 (diff)
downloadefi-boot-shim-ca6b8577754558ed790dd305d9579d7d5ed72091.tar.gz
efi-boot-shim-ca6b8577754558ed790dd305d9579d7d5ed72091.zip
Update upstream source from tag 'upstream/15+1531942534.dd3230d'
Update to upstream version '15+1531942534.dd3230d' with Debian dir 8b167be00338c76b0ddc9164059ce6090c274641
Diffstat (limited to 'PasswordCrypt.c')
-rw-r--r--PasswordCrypt.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/PasswordCrypt.c b/PasswordCrypt.c
index 2494549c..2eb971dd 100644
--- a/PasswordCrypt.c
+++ b/PasswordCrypt.c
@@ -3,8 +3,8 @@
#include <Library/BaseCryptLib.h>
#include <openssl/sha.h>
#include <openssl/md5.h>
-#include "PasswordCrypt.h"
-#include "crypt_blowfish.h"
+
+#include "shim.h"
#define TRAD_DES_HASH_SIZE 13 /* (64/6+1) + (12/6) */
#define BSDI_DES_HASH_SIZE 20 /* (64/6+1) + (24/6) + 4 + 1 */
@@ -286,7 +286,7 @@ static EFI_STATUS blowfish_crypt (const char *key, const char *salt, UINT8 *hash
EFI_STATUS password_crypt (const char *password, UINT32 pw_length,
const PASSWORD_CRYPT *pw_crypt, UINT8 *hash)
{
- EFI_STATUS status;
+ EFI_STATUS efi_status;
if (!pw_crypt)
return EFI_INVALID_PARAMETER;
@@ -294,32 +294,36 @@ EFI_STATUS password_crypt (const char *password, UINT32 pw_length,
switch (pw_crypt->method) {
case TRADITIONAL_DES:
case EXTEND_BSDI_DES:
- status = EFI_UNSUPPORTED;
+ efi_status = EFI_UNSUPPORTED;
break;
case MD5_BASED:
- status = md5_crypt (password, pw_length, (char *)pw_crypt->salt,
- pw_crypt->salt_size, hash);
+ efi_status = md5_crypt (password, pw_length,
+ (char *)pw_crypt->salt,
+ pw_crypt->salt_size, hash);
break;
case SHA256_BASED:
- status = sha256_crypt(password, pw_length, (char *)pw_crypt->salt,
- pw_crypt->salt_size, pw_crypt->iter_count,
- hash);
+ efi_status = sha256_crypt(password, pw_length,
+ (char *)pw_crypt->salt,
+ pw_crypt->salt_size,
+ pw_crypt->iter_count, hash);
break;
case SHA512_BASED:
- status = sha512_crypt(password, pw_length, (char *)pw_crypt->salt,
- pw_crypt->salt_size, pw_crypt->iter_count,
- hash);
+ efi_status = sha512_crypt(password, pw_length,
+ (char *)pw_crypt->salt,
+ pw_crypt->salt_size,
+ pw_crypt->iter_count, hash);
break;
case BLOWFISH_BASED:
if (pw_crypt->salt_size != (7 + 22 + 1)) {
- status = EFI_INVALID_PARAMETER;
+ efi_status = EFI_INVALID_PARAMETER;
break;
}
- status = blowfish_crypt(password, (char *)pw_crypt->salt, hash);
+ efi_status = blowfish_crypt(password, (char *)pw_crypt->salt,
+ hash);
break;
default:
return EFI_INVALID_PARAMETER;
}
- return status;
+ return efi_status;
}