UEFI is currently more popular as a standard X86 architecture framework initialization, has been widely recognized in the industry. Of which many programming ideas adopted really worth learning. Modify the code a little experience under the framework of summary UEFI today, rookie reference purposes only. First column dry, concrete follow-up to complement Summary: 1. Identify implement a logic function you want, you need to add code in which position. (Very important, it determines your proposal is feasible an important prerequisite, once this step wrong, the subsequent code will implement the code of the frame due to improper completely collapse) 2. Code requires good packaging, high cohesion, low coupling. This principle holds. I propose to write code at the start of the final function started writing, what variables, GUID, or header files used in the definition of what went to add. This will ensure that you add all your needs, and ideas will not mess. Under 3. UEFI framework often involve some GUID, including cross Pkg of Lib calls, in this summary will look. OK, dry goods on these points, with a small problem I currently experiencing – “UserPassWord Repeat password can successfully function in BIOS Setup” as an example.
1. The process of combing
.. A password storage and general use HASH value check parity mode, the advantages [safe, simple password process under b] BIOS:
After the user input password, BIOS to get user input string is first necessary to verify the password complexity. See the complexity of compliance.
(CRB code provided in the past three AdminPassword of repeatedly checking for a password, its implementation process relatively complicated, but the principle should be stored Hash value verification by setting a password for the past three times, and the need to follow the order of storage, after all can only store three times in the past. this place should use a similar scheme queues, FIFO)
Hash is finally in store passwords every time, it should eventually save the Admin password is stored in the queue inside. The original password to delete the oldest stored, the next two Hash password in order to enhance one, and then the newly saved passwords Hash placed in the queue to third place
2.1 In the final save your password when setting a Variable to store the current UserPassword of Hash
After entering the UserPassword 2.2, a password Hash disposed on the reading, compared with currently input password Hash. Determining whether may be written
3.1 UserPassword Hash value settings are saved, we only need to get the string current password, and then get Sha256 ed value, and through gRT-> storage service to save the SetVariable. Function preliminary written as follows:
3.2 After the password is entered after the verification done complexity, adding replicated UserPassWord code is as follows:
3.3 SetVariable will eventually add functions to save and exit when the BIOS, set a password location.
Will eventually add SetVariable function to save and exit when the BIOS, set a password location. Bug after this sort is actually very simple, look at your ideas solution of the problem, it should be noted that several main points are as follows:. A mechanism to sort out the inspection at the original AdminPassword, and learn some of its treatment of encoding b, right. GUID and some calls Lib library a little less clear, but also by re-sort this sort call use the GUID and Lib library. (Follow-up emphasis summary) c. There are a number of process performance function, only used inside a .c file, in this case, decisive consider rewriting a set of functions for its own use. Do not call the original function for external spend too much useless time. d. the most important thing, when writing code requirements must be clear, what they write, write in what place? Then start from the most basic needs, the need to think of what to add, so as to hold our ground, calmly. For the smaller the Bug resolved to do more than summarize and give us the same as the program ape, leaving little footprints.
Growth from an ordinary programmer, I welcome the attention of the public number, a big crowd, both destined to meet with you. Haha