RT4335: Fix UEFI build of OBJ_NAME_new_index()
authorDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 22 Feb 2016 16:29:12 +0000 (16:29 +0000)
committerRich Salz <rsalz@openssl.org>
Fri, 26 Feb 2016 16:03:28 +0000 (11:03 -0500)
commit2d51c28ff749f8b5f133bea0f7ba2160ecc0598b
tree2e38aa3c2c645181ea0dd8a1d950570670639f3c
parenta26d8be9531862af09c69b9704d219f1768d3d0e
RT4335: Fix UEFI build of OBJ_NAME_new_index()

We are using strcmp() as the cmp_func, where in the EDK2 environment
strcmp actually ends up being the external AsciiStrCmp() function —
an EFI library function defined with the Microsoft ABI.

This means that we can't just assign function pointers to it, since
in GCC-hosted builds the ABI of any function *not* explicitly marked
EFIAPI is the native SysV ABI.

Arguably this stupidity ought to be resolved on the UEFI side, but in
the general case that would mean that we need to provide ABI-compatible
wrappers for *all* the "standard" functions, just in case they're used
like this.

And in fact we already have a workaround here for DEC C. So instead of
playing games with casting function pointers, it's nicer just to use a
simple function to wrap the strcmp() call. That cleans up the DEC C
workaround, *and* it works around the UEFI bogosity at the same time.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
crypto/objects/o_names.c