Updated digest commands to include SHA-2 support, hash strings, perfo… #94
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the following:
It is also backward compatible with hashing one or more images as have been available in md5sum and sha1sum previous to the PR. The major difference is it will write or overwrite hash and hashlen with the last of the multiple images successfully hashed.
Without this PR, the hash functions seem to only provide a way to manually verify the digest results. With this the resulting digest string and the length of the image can both automatically be confirmed by the ipxe script.
Also consider the following situation, a company creates an ipxe efi module were they want it to go to an ipxe shell when DHCP fails. However, the company policy requires a password be verified to provide the shell access and also requires the password not be easy to extract even if the efi module is examined with a debugger.
This PR would allow a script such as this to be used:
#!ipxe
dhcp || goto dhcpfail
... normal tasks ...
:dhcpfail
prompt DHCP has failed, press a key to login for shell access
:loginshell
login
iseq ${username:string} ipxeadmin || goto loginshell
set salt:string 3cbc63d0c64482c666d4dfb0516eed35
md5sum --rounds 1000000 --str ${salt:string}${password:string}
iseq ${hash:string} 1577df1969a3b8f0188496804645c406 || goto loginshell
shell
Please feel free to let me know if there is problem with my code or even if there is problems with the concept I am trying to achieve with the code.
Thanks