If we cannot get random data from the RNG protocol we can still use our
load address to make the stack guard a little less static.
EFI_RNG_PROTOCOL *rng;
if (BS->LocateProtocol(MAKE_GUID_PTR(EFI_RNG_PROTOCOL), NULL, (void **) &rng) == EFI_SUCCESS)
(void) rng->GetRNG(rng, NULL, sizeof(__stack_chk_guard), (void *) &__stack_chk_guard);
+ else
+ /* Better than no extra entropy. */
+ __stack_chk_guard ^= (intptr_t) &__ImageBase;
}
#endif