Make -nameopt work in req and add support for -reqopt
[openssl.git] / crypto / objects / o_names.c
index 5e70508d9a09f3bb051b822e64c650d342477555..b4453b4a98753391933e3f8e9822119e79b3626a 100644 (file)
@@ -5,6 +5,18 @@
 #include <openssl/lhash.h>
 #include <openssl/objects.h>
 #include <openssl/safestack.h>
+#include <openssl/e_os2.h>
+
+/* Later versions of DEC C has started to add lnkage 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.
+ */
+#ifdef OPENSSL_SYS_VMS_DECC
+# define OPENSSL_strcmp (int (*)(const char *,const char *))strcmp
+#else
+# define OPENSSL_strcmp strcmp
+#endif
 
 /* I use the ex_data stuff to manage the identifiers for the obj_name_types
  * that applications may define.  I only really use the free function field.
@@ -67,13 +79,16 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
                {
                MemCheck_off();
                name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));
+               MemCheck_on();
+               if (!name_funcs) return(0);
                name_funcs->hash_func = lh_strhash;
-               name_funcs->cmp_func = strcmp;
+               name_funcs->cmp_func = OPENSSL_strcmp;
                name_funcs->free_func = 0; /* NULL is often declared to
                                                * ((void *)0), which according
                                                * to Compaq C is not really
                                                * compatible with a function
                                                * pointer.      -- Richard Levitte*/
+               MemCheck_off();
                sk_NAME_FUNCS_push(name_funcs_stack,name_funcs);
                MemCheck_on();
                }