[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Fri Feb 26 16:04:16 UTC 2016

The branch master has been updated
       via  2d51c28ff749f8b5f133bea0f7ba2160ecc0598b (commit)
      from  a26d8be9531862af09c69b9704d219f1768d3d0e (commit)

- Log -----------------------------------------------------------------
commit 2d51c28ff749f8b5f133bea0f7ba2160ecc0598b
Author: David Woodhouse <David.Woodhouse at intel.com>
Date:   Mon Feb 22 16:29:12 2016 +0000

    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 at openssl.org>
    Reviewed-by: Kurt Roeckx <kurt at openssl.org>


Summary of changes:
 crypto/objects/o_names.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c
index 0a07379..5728806 100644
--- a/crypto/objects/o_names.c
+++ b/crypto/objects/o_names.c
@@ -10,15 +10,23 @@
 #include "obj_lcl.h"
- * Later versions of DEC C has started to add linkage information to certain
- * functions, which makes it tricky to use them as values to regular function
- * pointers.  One way is to define a macro that takes care of casting them
- * correctly.
+ * We define this wrapper for two reasons. Firstly, later versions of
+ * DEC C add linkage information to certain functions, which makes it
+ * tricky to use them as values to regular function pointers.
+ * Secondly, in the EDK2 build environment, the strcmp function is
+ * actually an external function (AsciiStrCmp) with the Microsoft ABI,
+ * so we can't transparently assign function pointers to it.
+ * Arguably the latter is a stupidity of the UEFI environment, but
+ * since the wrapper solves the DEC C issue too, let's just use the
+ * same solution.
-# define OPENSSL_strcmp (int (*)(const char *,const char *))strcmp
+#if defined(OPENSSL_SYS_VMS_DECC) || defined(OPENSSL_SYS_UEFI)
+static int obj_strcmp(const char *a, const char *b)
+	return strcmp(a, b);
-# define OPENSSL_strcmp strcmp
+#define obj_strcmp strcmp
@@ -83,7 +91,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
             return (0);
         name_funcs->hash_func = lh_strhash;
-        name_funcs->cmp_func = OPENSSL_strcmp;
+        name_funcs->cmp_func = obj_strcmp;
         sk_NAME_FUNCS_push(name_funcs_stack, name_funcs);

More information about the openssl-commits mailing list