/* Give a user interface parametrised control commands. This can be used to
send down an integer, a data pointer or a function pointer, as well as
be used to get information from a STORE. */
-int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)());
+int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void));
/* A control to set the directory with keys and certificates. Used by the
built-in directory level method. */
and is of course volatile. It's used by other methods that have an in-memory
cache. */
const STORE_METHOD *STORE_Memory(void);
+#if 0 /* Not yet implemented */
/* This is the directory store. It does everything except revoking and updating,
and uses STORE_Memory() to cache things in memory. */
const STORE_METHOD *STORE_Directory(void);
and uses STORE_Memory() to cache things in memory. Certificates are added
to it with the store operation, and it will only get cached certificates. */
const STORE_METHOD *STORE_File(void);
-
+#endif
/* Store functions take a type code for the type of data they should store
or fetch */
typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
typedef int (*STORE_MODIFY_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
-typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)());
+typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void));
-int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR gen_f);
-int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR gen_f);
-int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR gen_f);
+int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f);
+int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f);
+int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f);
int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f);
int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f);
int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f);
/* Error codes for the STORE functions. */
/* Function codes. */
+#define STORE_F_CTRL 160
#define STORE_F_MEM_DELETE 134
#define STORE_F_MEM_GENERATE 135
#define STORE_F_MEM_LIST_NEXT 136
#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR 150
#define STORE_F_STORE_CERTIFICATE 100
#define STORE_F_STORE_CRL 101
+#define STORE_F_STORE_CTRL 161
#define STORE_F_STORE_DELETE_ARBITRARY 158
#define STORE_F_STORE_DELETE_CERTIFICATE 102
#define STORE_F_STORE_DELETE_CRL 103
#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP 156
#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT 124
#define STORE_F_STORE_LIST_PUBLIC_KEY_START 125
+#define STORE_F_STORE_MODIFY_ARBITRARY 162
+#define STORE_F_STORE_MODIFY_CERTIFICATE 163
+#define STORE_F_STORE_MODIFY_CRL 164
+#define STORE_F_STORE_MODIFY_NUMBER 165
+#define STORE_F_STORE_MODIFY_PRIVATE_KEY 166
+#define STORE_F_STORE_MODIFY_PUBLIC_KEY 167
#define STORE_F_STORE_NEW_ENGINE 133
#define STORE_F_STORE_NEW_METHOD 132
#define STORE_F_STORE_NUMBER 126
#define STORE_R_FAILED_GETTING_NUMBER 107
#define STORE_R_FAILED_LISTING_CERTIFICATES 108
#define STORE_R_FAILED_LISTING_KEYS 109
+#define STORE_R_FAILED_MODIFYING_ARBITRARY 138
+#define STORE_R_FAILED_MODIFYING_CERTIFICATE 139
+#define STORE_R_FAILED_MODIFYING_CRL 140
+#define STORE_R_FAILED_MODIFYING_NUMBER 141
+#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY 142
+#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY 143
#define STORE_R_FAILED_REVOKING_CERTIFICATE 110
#define STORE_R_FAILED_REVOKING_KEY 111
#define STORE_R_FAILED_STORING_ARBITRARY 134
#define STORE_R_FAILED_STORING_KEY 113
#define STORE_R_FAILED_STORING_NUMBER 114
#define STORE_R_NOT_IMPLEMENTED 128
+#define STORE_R_NO_CONTROL_FUNCTION 144
#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION 135
#define STORE_R_NO_DELETE_NUMBER_FUNCTION 115
#define STORE_R_NO_DELETE_OBJECT_FUNCTION 116
#define STORE_R_NO_LIST_OBJECT_END_FUNCTION 121
#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION 122
#define STORE_R_NO_LIST_OBJECT_START_FUNCTION 123
+#define STORE_R_NO_MODIFY_OBJECT_FUNCTION 145
#define STORE_R_NO_REVOKE_OBJECT_FUNCTION 124
#define STORE_R_NO_STORE 129
#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION 137
#ifndef OPENSSL_NO_ERR
static ERR_STRING_DATA STORE_str_functs[]=
{
+{ERR_PACK(0,STORE_F_CTRL,0), "CTRL"},
{ERR_PACK(0,STORE_F_MEM_DELETE,0), "MEM_DELETE"},
{ERR_PACK(0,STORE_F_MEM_GENERATE,0), "MEM_GENERATE"},
{ERR_PACK(0,STORE_F_MEM_LIST_NEXT,0), "MEM_LIST_NEXT"},
{ERR_PACK(0,STORE_F_STORE_ATTR_INFO_SET_SHA1STR,0), "STORE_ATTR_INFO_set_sha1str"},
{ERR_PACK(0,STORE_F_STORE_CERTIFICATE,0), "STORE_CERTIFICATE"},
{ERR_PACK(0,STORE_F_STORE_CRL,0), "STORE_CRL"},
+{ERR_PACK(0,STORE_F_STORE_CTRL,0), "STORE_ctrl"},
{ERR_PACK(0,STORE_F_STORE_DELETE_ARBITRARY,0), "STORE_delete_arbitrary"},
{ERR_PACK(0,STORE_F_STORE_DELETE_CERTIFICATE,0), "STORE_delete_certificate"},
{ERR_PACK(0,STORE_F_STORE_DELETE_CRL,0), "STORE_delete_crl"},
{ERR_PACK(0,STORE_F_STORE_LIST_PUBLIC_KEY_ENDP,0), "STORE_list_public_key_endp"},
{ERR_PACK(0,STORE_F_STORE_LIST_PUBLIC_KEY_NEXT,0), "STORE_list_public_key_next"},
{ERR_PACK(0,STORE_F_STORE_LIST_PUBLIC_KEY_START,0), "STORE_list_public_key_start"},
-{ERR_PACK(0,STORE_F_STORE_NEW_ENGINE,0), "STORE_NEW_ENGINE"},
+{ERR_PACK(0,STORE_F_STORE_MODIFY_ARBITRARY,0), "STORE_modify_arbitrary"},
+{ERR_PACK(0,STORE_F_STORE_MODIFY_CERTIFICATE,0), "STORE_modify_certificate"},
+{ERR_PACK(0,STORE_F_STORE_MODIFY_CRL,0), "STORE_modify_crl"},
+{ERR_PACK(0,STORE_F_STORE_MODIFY_NUMBER,0), "STORE_modify_number"},
+{ERR_PACK(0,STORE_F_STORE_MODIFY_PRIVATE_KEY,0), "STORE_modify_private_key"},
+{ERR_PACK(0,STORE_F_STORE_MODIFY_PUBLIC_KEY,0), "STORE_modify_public_key"},
+{ERR_PACK(0,STORE_F_STORE_NEW_ENGINE,0), "STORE_new_engine"},
{ERR_PACK(0,STORE_F_STORE_NEW_METHOD,0), "STORE_new_method"},
{ERR_PACK(0,STORE_F_STORE_NUMBER,0), "STORE_NUMBER"},
{ERR_PACK(0,STORE_F_STORE_PARSE_ATTRS_END,0), "STORE_parse_attrs_end"},
{STORE_R_FAILED_GETTING_NUMBER ,"failed getting number"},
{STORE_R_FAILED_LISTING_CERTIFICATES ,"failed listing certificates"},
{STORE_R_FAILED_LISTING_KEYS ,"failed listing keys"},
+{STORE_R_FAILED_MODIFYING_ARBITRARY ,"failed modifying arbitrary"},
+{STORE_R_FAILED_MODIFYING_CERTIFICATE ,"failed modifying certificate"},
+{STORE_R_FAILED_MODIFYING_CRL ,"failed modifying crl"},
+{STORE_R_FAILED_MODIFYING_NUMBER ,"failed modifying number"},
+{STORE_R_FAILED_MODIFYING_PRIVATE_KEY ,"failed modifying private key"},
+{STORE_R_FAILED_MODIFYING_PUBLIC_KEY ,"failed modifying public key"},
{STORE_R_FAILED_REVOKING_CERTIFICATE ,"failed revoking certificate"},
{STORE_R_FAILED_REVOKING_KEY ,"failed revoking key"},
{STORE_R_FAILED_STORING_ARBITRARY ,"failed storing arbitrary"},
{STORE_R_FAILED_STORING_KEY ,"failed storing key"},
{STORE_R_FAILED_STORING_NUMBER ,"failed storing number"},
{STORE_R_NOT_IMPLEMENTED ,"not implemented"},
+{STORE_R_NO_CONTROL_FUNCTION ,"no control function"},
{STORE_R_NO_DELETE_ARBITRARY_FUNCTION ,"no delete arbitrary function"},
{STORE_R_NO_DELETE_NUMBER_FUNCTION ,"no delete number function"},
{STORE_R_NO_DELETE_OBJECT_FUNCTION ,"no delete object function"},
{STORE_R_NO_LIST_OBJECT_END_FUNCTION ,"no list object end function"},
{STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION ,"no list object next function"},
{STORE_R_NO_LIST_OBJECT_START_FUNCTION ,"no list object start function"},
+{STORE_R_NO_MODIFY_OBJECT_FUNCTION ,"no modify object function"},
{STORE_R_NO_REVOKE_OBJECT_FUNCTION ,"no revoke object function"},
{STORE_R_NO_STORE ,"no store"},
{STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION,"no store object arbitrary function"},
OPENSSL_free(store);
}
+int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void))
+ {
+ if (store == NULL)
+ {
+ STOREerr(STORE_F_CTRL,ERR_R_PASSED_NULL_PARAMETER);
+ return 0;
+ }
+ if (store->meth->ctrl)
+ return store->meth->ctrl(store, cmd, i, p, f);
+ STOREerr(STORE_F_STORE_CTRL,STORE_R_NO_CONTROL_FUNCTION);
+ return 0;
+ }
+
int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
return 1;
}
+int STORE_modify_certificate(STORE *s, OPENSSL_ITEM search_attributes[],
+ OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
+ OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
+ {
+ check_store(s,STORE_F_STORE_MODIFY_CERTIFICATE,
+ modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
+
+ if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE,
+ search_attributes, add_attributes, modify_attributes,
+ delete_attributes, parameters))
+ {
+ STOREerr(STORE_F_STORE_MODIFY_CERTIFICATE,
+ STORE_R_FAILED_MODIFYING_CERTIFICATE);
+ return 0;
+ }
+ return 1;
+ }
+
int STORE_revoke_certificate(STORE *s, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[])
{
return i;
}
+int STORE_modify_private_key(STORE *s, OPENSSL_ITEM search_attributes[],
+ OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
+ OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
+ {
+ check_store(s,STORE_F_STORE_MODIFY_PRIVATE_KEY,
+ modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
+
+ if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY,
+ search_attributes, add_attributes, modify_attributes,
+ delete_attributes, parameters))
+ {
+ STOREerr(STORE_F_STORE_MODIFY_PRIVATE_KEY,
+ STORE_R_FAILED_MODIFYING_PRIVATE_KEY);
+ return 0;
+ }
+ return 1;
+ }
+
int STORE_revoke_private_key(STORE *s, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[])
{
return i;
}
+int STORE_modify_public_key(STORE *s, OPENSSL_ITEM search_attributes[],
+ OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
+ OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
+ {
+ check_store(s,STORE_F_STORE_MODIFY_PUBLIC_KEY,
+ modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
+
+ if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY,
+ search_attributes, add_attributes, modify_attributes,
+ delete_attributes, parameters))
+ {
+ STOREerr(STORE_F_STORE_MODIFY_PUBLIC_KEY,
+ STORE_R_FAILED_MODIFYING_PUBLIC_KEY);
+ return 0;
+ }
+ return 1;
+ }
+
int STORE_revoke_public_key(STORE *s, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[])
{
return i;
}
+int STORE_modify_crl(STORE *s, OPENSSL_ITEM search_attributes[],
+ OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
+ OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
+ {
+ check_store(s,STORE_F_STORE_MODIFY_CRL,
+ modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
+
+ if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_X509_CRL,
+ search_attributes, add_attributes, modify_attributes,
+ delete_attributes, parameters))
+ {
+ STOREerr(STORE_F_STORE_MODIFY_CRL,
+ STORE_R_FAILED_MODIFYING_CRL);
+ return 0;
+ }
+ return 1;
+ }
+
int STORE_delete_crl(STORE *s, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[])
{
return 1;
}
+int STORE_modify_number(STORE *s, OPENSSL_ITEM search_attributes[],
+ OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
+ OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
+ {
+ check_store(s,STORE_F_STORE_MODIFY_NUMBER,
+ modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
+
+ if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_NUMBER,
+ search_attributes, add_attributes, modify_attributes,
+ delete_attributes, parameters))
+ {
+ STOREerr(STORE_F_STORE_MODIFY_NUMBER,
+ STORE_R_FAILED_MODIFYING_NUMBER);
+ return 0;
+ }
+ return 1;
+ }
+
BIGNUM *STORE_get_number(STORE *s, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[])
{
return 1;
}
+int STORE_modify_arbitrary(STORE *s, OPENSSL_ITEM search_attributes[],
+ OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
+ OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
+ {
+ check_store(s,STORE_F_STORE_MODIFY_ARBITRARY,
+ modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
+
+ if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_ARBITRARY,
+ search_attributes, add_attributes, modify_attributes,
+ delete_attributes, parameters))
+ {
+ STOREerr(STORE_F_STORE_MODIFY_ARBITRARY,
+ STORE_R_FAILED_MODIFYING_ARBITRARY);
+ return 0;
+ }
+ return 1;
+ }
+
BUF_MEM *STORE_get_arbitrary(STORE *s, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[])
{
OPENSSL_ITEM parameters[]);
static int mem_unlock(STORE *s, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[]);
-static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)());
+static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)(void));
static STORE_METHOD store_memory =
{
{
return 1;
}
-static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)())
+static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)(void))
{
return 1;
}
OPENSSL_free(store_method);
}
+int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f)
+ {
+ sm->init = init_f;
+ return 1;
+ }
+
+int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f)
+ {
+ sm->clean = clean_f;
+ return 1;
+ }
+
int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f)
{
sm->generate_object = generate_f;
return 1;
}
+int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR modify_f)
+ {
+ sm->modify_object = modify_f;
+ return 1;
+ }
+
int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f)
{
sm->revoke_object = revoke_f;
return 1;
}
+STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm)
+ {
+ return sm->init;
+ }
+
+STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm)
+ {
+ return sm->clean;
+ }
+
STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm)
{
return sm->generate_object;
return sm->store_object;
}
+STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm)
+ {
+ return sm->modify_object;
+ }
+
STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm)
{
return sm->revoke_object;