diff options
| author | Gary Ching-Pang Lin <glin@suse.com> | 2013-01-15 18:01:41 +0800 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2013-09-26 11:58:01 -0400 |
| commit | afb61e79027d2a5de9edfcab8de163609894f930 (patch) | |
| tree | ba4b6929522867b84d46ef795bf1decbbda81b4e /PasswordCrypt.h | |
| parent | 4a7f9bd4a687f1bca25e86644e53c5ca5ab2bac8 (diff) | |
| download | efi-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.h | 26 |
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__ */ |
