Since my KASLR implementation for arm64 Linux is based on the EFI_RNG_PROTOCOL (at least for UEFI systems), which is not yet widely available on systems that are under developement currently, this implements a pseudo-random version for ARM Juno. This code is not suitable for production, but since Juno is strictly a development platform, that concern does not apply here. Note that the library is delivered as a binary which prints a warning to the console the first time it is called.
Ard Biesheuvel (2): Platforms/ARM: implement a pseudo-random version of RngLib Platforms/ArmJuno: add RngDxe based on PseudoRngLib
Platforms/ARM/Drivers/PseudoRngLib/License.txt | 19 ++++++++++ Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.inf | 38 ++++++++++++++++++++ Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.lib | Bin 0 -> 29610 bytes Platforms/ARM/Drivers/PseudoRngLib/README | 8 +++++ Platforms/ARM/Juno/ArmJuno.dsc | 8 +++++ Platforms/ARM/Juno/ArmJuno.fdf | 5 +++ 6 files changed, 78 insertions(+) create mode 100644 Platforms/ARM/Drivers/PseudoRngLib/License.txt create mode 100644 Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.inf create mode 100644 Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.lib create mode 100644 Platforms/ARM/Drivers/PseudoRngLib/README
For lack of suitable hardware upon which a proper implementation of RngLib can be based, this implements a pseudo-random version of RngLib based on the generic timer, the cycle counter and a couple of rounds of AES.
NOTE: while the values produced by this library may look like random values to the human eye, they most certainly are not, and use of this library in production is UNSAFE. For this reason, the library is provided as a binary only, and will print a warning to the console the first time it is invoked.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel ard.biesheuvel@linaro.org --- Platforms/ARM/Drivers/PseudoRngLib/License.txt | 19 ++++++++++ Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.inf | 38 ++++++++++++++++++++ Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.lib | Bin 0 -> 29610 bytes Platforms/ARM/Drivers/PseudoRngLib/README | 8 +++++ 4 files changed, 65 insertions(+)
diff --git a/Platforms/ARM/Drivers/PseudoRngLib/License.txt b/Platforms/ARM/Drivers/PseudoRngLib/License.txt new file mode 100644 index 000000000000..59024e66da4b --- /dev/null +++ b/Platforms/ARM/Drivers/PseudoRngLib/License.txt @@ -0,0 +1,19 @@ +Copyright (c) 2016, Linaro Ltd. All rights reserved. + +Redistribution and use in binary form without modification is permitted +provided that this copyright notice and the following disclaimer are +reproduced in the documentation and/or other materials provided with the +distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.inf b/Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.inf new file mode 100644 index 000000000000..10942ac26814 --- /dev/null +++ b/Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.inf @@ -0,0 +1,38 @@ +## @file +# Instance of RNG (Random Number Generator) Library. +# +# Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR> +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PseudoRngLib + FILE_GUID = 0b9d239e-e958-4071-882a-102835914533 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RngLib|DXE_DRIVER + +# +# VALID_ARCHITECTURES = AARCH64 +# + +[Binaries.AARCH64] + LIB|PseudoRngLib.lib|* + +[Packages] + MdePkg/MdePkg.dec + ArmPkg/ArmPkg.dec + +[LibraryClasses] + BaseLib + ArmGenericTimerCounterLib + UefiBootServicesTableLib diff --git a/Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.lib b/Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.lib new file mode 100644 index 0000000000000000000000000000000000000000..90bf9dd737e7f582dcc326442ed7c760afefaa8e GIT binary patch literal 29610 zcmdUY3w&F}neQA+@{yGgY?6?W0FlcpJZ#4ygz&a3%dv_rDUuu#`cM>Ew$;dz(Idn> z+VE(gEl|QM>?Lq%X_u7UKK9oZXbasGw)6p|lt<7M8Z`ue3|K+(KK@?Uws}-+Xg? z{8=vP-h20VcYg7lng4wAy=LZ{IY&oI``Ot_Zv5OpS8!%p<*MqkI}ZlC*Q{lVEdixe zvr^WXv;WGw*5_-9YQ8>FPG(CZ<%!;@TE40P)YVvhVr#zAy;dTpu9nE!H4^Dwy-sB^ z4f(4sX^zX9M#VLbxmyCPZfR_=u(h+i^+R1VkZ`$@*Jzj1M{{&n-M(78W(^UnUe|rP z_Su%eM<Rp$O_l|Y)5%f~sOg$Pl}hBN%RN-=QOBsDdNcLS&%NnU_W{)Ur+MnYTOR8^ zOZA-5ZmHAS)y^dFIs@C_+NxB~0Tt{y(B$no(4)@#@lQRA?t9s@@V-CI>pAdd>XCg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#=b1SU2TlnoAJ00C<Uhp+tLHQuCztZOy4MBWX_c#@%Q`pz zmt6O%RZMd5|CiiKmw`Q`Ne`Tz(d+O_WRURte)mE0-+9(^)_iXae(Ex&j%+Vk@4T}& zIIuFN##hEHxVFRf|F?SkWoi)r&$$&r&vSptcl^lsKa>66`0kk=YdPZPzH2tF=a%K% zqZ#$^eB25%wbcOTx($A81HNqo-?^FN`!t5||Lpp1XXK{@d#PtTw4=3howUw&0dbP> uTxaBi?LSwHF#Yii>`qcX)?G`;A?;zp{fyxG6z`P|Hbxkx7+c&)%KzW+b^2fc
literal 0 HcmV?d00001
diff --git a/Platforms/ARM/Drivers/PseudoRngLib/README b/Platforms/ARM/Drivers/PseudoRngLib/README new file mode 100644 index 000000000000..e93b093aa59a --- /dev/null +++ b/Platforms/ARM/Drivers/PseudoRngLib/README @@ -0,0 +1,8 @@ +This pseudo-random implementation of RngLib is unsafe, and is not intended for +use in production. It is provided for development purposes only, and only to be +used on development platforms that lack any hardware peripherals to implement +RngLib properly. + +Note that this code blindly assumes the availability of the AES instructions, +and the accessibility of the cycle counter. If either is not available, this +code will crash.
This adds RngDxe to the Juno build, based on the PseudoRngLib that is based on the generic timer and the cycle counter. This is only intended for development purposes, since PseudoRngLib is UNSAFE FOR PRODUCTION.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel ard.biesheuvel@linaro.org --- Platforms/ARM/Juno/ArmJuno.dsc | 8 ++++++++ Platforms/ARM/Juno/ArmJuno.fdf | 5 +++++ 2 files changed, 13 insertions(+)
diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index 9f1cbc2ba243..2c2e333f3cbe 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -293,6 +293,14 @@ ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
# + # Random Number Generator driver + # + SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf { + <LibraryClasses> + RngLib|OpenPlatformPkg/Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.inf + } + + # # Bds # MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf diff --git a/Platforms/ARM/Juno/ArmJuno.fdf b/Platforms/ARM/Juno/ArmJuno.fdf index 0e7274f74361..7bd5bc37b7f4 100644 --- a/Platforms/ARM/Juno/ArmJuno.fdf +++ b/Platforms/ARM/Juno/ArmJuno.fdf @@ -198,6 +198,11 @@ FvNameGuid = B73FE497-B92E-416e-8326-45AD0D270092 INF ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
# + # Random Number Generator driver + # + INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf + + # # Bds # INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
On 8 February 2016 at 12:55, Ard Biesheuvel ard.biesheuvel@linaro.org wrote:
This adds RngDxe to the Juno build, based on the PseudoRngLib that is based on the generic timer and the cycle counter. This is only intended for development purposes, since PseudoRngLib is UNSAFE FOR PRODUCTION.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel ard.biesheuvel@linaro.org
Platforms/ARM/Juno/ArmJuno.dsc | 8 ++++++++ Platforms/ARM/Juno/ArmJuno.fdf | 5 +++++ 2 files changed, 13 insertions(+)
diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index 9f1cbc2ba243..2c2e333f3cbe 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -293,6 +293,14 @@ ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
#
- # Random Number Generator driver
I'm wondering if it's worth putting am "UNSAFE FOR PRODUCTION" comment in the .dsc file? Mind you, the name "Pseudo..." should give it away. But a comment might have a slim change of helping those who use Juno as a template to create their own BSP.
- #
- SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf {
<LibraryClasses>
RngLib|OpenPlatformPkg/Platforms/ARM/Drivers/PseudoRngLib/PseudoRngLib.inf
- }
- # # Bds # MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
diff --git a/Platforms/ARM/Juno/ArmJuno.fdf b/Platforms/ARM/Juno/ArmJuno.fdf index 0e7274f74361..7bd5bc37b7f4 100644 --- a/Platforms/ARM/Juno/ArmJuno.fdf +++ b/Platforms/ARM/Juno/ArmJuno.fdf @@ -198,6 +198,11 @@ FvNameGuid = B73FE497-B92E-416e-8326-45AD0D270092 INF ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
#
- # Random Number Generator driver
- #
- INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
- # # Bds # INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
-- 2.5.0
Linaro-uefi mailing list Linaro-uefi@lists.linaro.org https://lists.linaro.org/mailman/listinfo/linaro-uefi
On 8 February 2016 at 14:52, Ryan Harkin ryan.harkin@linaro.org wrote:
On 8 February 2016 at 12:55, Ard Biesheuvel ard.biesheuvel@linaro.org wrote:
This adds RngDxe to the Juno build, based on the PseudoRngLib that is based on the generic timer and the cycle counter. This is only intended for development purposes, since PseudoRngLib is UNSAFE FOR PRODUCTION.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel ard.biesheuvel@linaro.org
Platforms/ARM/Juno/ArmJuno.dsc | 8 ++++++++ Platforms/ARM/Juno/ArmJuno.fdf | 5 +++++ 2 files changed, 13 insertions(+)
diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index 9f1cbc2ba243..2c2e333f3cbe 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -293,6 +293,14 @@ ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
#
- # Random Number Generator driver
I'm wondering if it's worth putting am "UNSAFE FOR PRODUCTION" comment in the .dsc file? Mind you, the name "Pseudo..." should give it away. But a comment might have a slim change of helping those who use Juno as a template to create their own BSP.
Yeah, good point. The git commit log is perhaps not as useful in this regard.
On 02/08/2016 06:55 AM, Ard Biesheuvel wrote:
Since my KASLR implementation for arm64 Linux is based on the EFI_RNG_PROTOCOL (at least for UEFI systems), which is not yet widely available on systems that are under developement currently, this implements a pseudo-random version for ARM Juno. This code is not suitable for production, but since Juno is strictly a development platform, that concern does not apply here. Note that the library is delivered as a binary which prints a warning to the console the first time it is called.
This is handy, I needed a reasonable way to generate some serial numbers in the SMBIOS data, and my prng code is ugly.
Is there a reason why its checked in as a binary? I've had to rebuild the shell a couple times and its a PITA because its also checked in as a binary.
On 02/09/2016 12:32 AM, Jeremy Linton wrote:
On 02/08/2016 06:55 AM, Ard Biesheuvel wrote:
Since my KASLR implementation for arm64 Linux is based on the EFI_RNG_PROTOCOL (at least for UEFI systems), which is not yet widely available on systems that are under developement currently, this implements a pseudo-random version for ARM Juno. This code is not suitable for production, but since Juno is strictly a development platform, that concern does not apply here. Note that the library is delivered as a binary which prints a warning to the console the first time it is called.
This is handy, I needed a reasonable way to generate some serial numbers in the SMBIOS data, and my prng code is ugly.
Is there a reason why its checked in as a binary? I've had to rebuild the shell a couple times and its a PITA because its also checked in as a binary.
I agree; even it is not safe for production, it still provides a good reference to develop a production version. So I think it will be better for us to have the source code.
I even think we can move it out of the directory "Platforms/ARM" and to a common directory, because it should be a software emulation and hardware independent.
Thanks.
Heyi
Linaro-uefi mailing list Linaro-uefi@lists.linaro.org https://lists.linaro.org/mailman/listinfo/linaro-uefi