Catch up to the removal of OSSL_STORE_open_file()
[openssl.git] / include / openssl / safestack.h
index 306b3acc575fb06901a8adde7ecc249f2b2d2397..9fe733c24e4f3c0314f4b1b772e3ada33bd70f5c 100644 (file)
@@ -59,11 +59,11 @@ extern "C" {
     } \
     static ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \
     { \
-        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (void *)ptr); \
+        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
     } \
     static ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \
     { \
-        return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (void *)ptr); \
+        return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \
     } \
     static ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \
     { \
@@ -79,11 +79,11 @@ extern "C" {
     } \
     static ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \
     { \
-        return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (void *)ptr, idx); \
+        return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \
     } \
     static ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \
     { \
-        return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (void *)ptr); \
+        return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \
     } \
     static ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \
     { \
@@ -101,15 +101,15 @@ extern "C" {
     { \
         return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \
     } \
-    static ossl_inline STACK_OF(t1) * sk_##t1##_dup(STACK_OF(t1) *sk) \
+    static ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \
     { \
-        return (STACK_OF(t1) *)OPENSSL_sk_dup((OPENSSL_STACK *)sk); \
+        return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \
     } \
-    static ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(STACK_OF(t1) *sk, \
+    static ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \
                                                     sk_##t1##_copyfunc copyfunc, \
                                                     sk_##t1##_freefunc freefunc) \
     { \
-        return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((OPENSSL_STACK *)sk, \
+        return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \
                                             (OPENSSL_sk_copyfunc)copyfunc, \
                                             (OPENSSL_sk_freefunc)freefunc); \
     } \
@@ -120,6 +120,8 @@ extern "C" {
 
 # define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2)
 # define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t)
+# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \
+            SKM_DEFINE_STACK_OF(t1, const t2, t2)
 # define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t)
 
 /*-
@@ -147,6 +149,7 @@ typedef const char *OPENSSL_CSTRING;
  * dealt with in the autogenerated macros below.
  */
 DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
+DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char)
 
 /*
  * Similarly, we sometimes use a block of characters, NOT nul-terminated.