summaryrefslogtreecommitdiff
path: root/PasswordCrypt.h
diff options
context:
space:
mode:
authorGary Ching-Pang Lin <glin@suse.com>2013-01-15 18:01:41 +0800
committerPeter Jones <pjones@redhat.com>2013-09-26 11:58:01 -0400
commitafb61e79027d2a5de9edfcab8de163609894f930 (patch)
treeba4b6929522867b84d46ef795bf1decbbda81b4e /PasswordCrypt.h
parent4a7f9bd4a687f1bca25e86644e53c5ca5ab2bac8 (diff)
downloadefi-boot-shim-afb61e79027d2a5de9edfcab8de163609894f930.tar.gz
efi-boot-shim-afb61e79027d2a5de9edfcab8de163609894f930.zip
MokManager: support crypt() password hash
The password format is introduced for the password hash generated by crypt(), so that the user can import the password hash from /etc/shadow. The packager, especially those who packages 3rd party drivers, can utilize this feature to import a 3rd party certificate without interfering the package installation. This commit implements the sha256-based crypt() hash function. Conflicts: Makefile MokManager.c
Diffstat (limited to 'PasswordCrypt.h')
-rw-r--r--PasswordCrypt.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/PasswordCrypt.h b/PasswordCrypt.h
new file mode 100644
index 00000000..c9e377a2
--- /dev/null
+++ b/PasswordCrypt.h
@@ -0,0 +1,26 @@
+#ifndef __PASSWORD_CRYPT_H__
+#define __PASSWORD_CRYPT_H__
+
+enum HashMethod {
+ TRANDITIONAL_DES = 0,
+ EXTEND_BSDI_DES,
+ MD5_BASED,
+ SHA256_BASED,
+ SHA512_BASED,
+ BLOWFISH_BASED
+};
+
+typedef struct {
+ UINT16 method;
+ UINT64 iter_count;
+ UINT16 salt_size;
+ UINT8 salt[32];
+ UINT8 hash[128];
+} __attribute__ ((packed)) PASSWORD_CRYPT;
+
+#define PASSWORD_CRYPT_SIZE sizeof(PASSWORD_CRYPT)
+
+EFI_STATUS password_crypt (const char *password, UINT32 pw_length,
+ const PASSWORD_CRYPT *pw_hash, UINT8 *hash);
+
+#endif /* __PASSWORD_CRYPT_H__ */