Skip to content
Commit 8655bf16 authored by Sami Mujawar's avatar Sami Mujawar
Browse files

MdePkg: Warn if AArch64 RNDR instruction is not supported



The BaseRngLib library constructor for AArch64 asserts if the
RNDR instruction is not supported by the CPU. This approach to
warn about the unsupported instruction may be suitable for the
host platform firmware. However, for a guest firmware the only
mechanism to discover the supported RNG interface is by probing
the processor feature registers.
The guest firmware may therefore assume that RNDR instruction
is supported and if the probe fails, fall back to an alternate
RNG source, e.g. Virtio RNG.

Therefore, replace the assert with a warning message to allow
the guest firmware to progress.

Note:
 - If RNDR instruction is not supported, the GetRandomNumberXXX
   functions will return FALSE to indicate that the random number
   generation has failed. It is expected that the calling function
   checks the status and handles this error appropriately.
 - This change should not have any side effect as the behaviour
   will be similar to that of release builds where the asserts
   would be removed.

Signed-off-by: Sami Mujawar's avatarSami Mujawar <sami.mujawar@arm.com>
parent 4c6a2e38
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment