Implement missing functions.

Have the f parameter to _ctrl functions have the prototype (*)(void)
rather than (*)(), for the sake of C++ compilers.
Disable unimplemented functionality.
This commit is contained in:
Richard Levitte 2003-06-26 10:26:42 +00:00
parent d55141ed7a
commit ed5fae580e
5 changed files with 196 additions and 9 deletions

View File

@ -91,7 +91,7 @@ void STORE_free(STORE *ui);
/* 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. */
@ -123,6 +123,7 @@ const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth);
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);
@ -130,7 +131,7 @@ 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 */
@ -331,11 +332,11 @@ typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OP
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);
@ -429,6 +430,7 @@ void ERR_load_STORE_strings(void);
/* 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
@ -449,6 +451,7 @@ void ERR_load_STORE_strings(void);
#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
@ -479,6 +482,12 @@ void ERR_load_STORE_strings(void);
#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
@ -504,6 +513,12 @@ void ERR_load_STORE_strings(void);
#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
@ -511,6 +526,7 @@ void ERR_load_STORE_strings(void);
#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
@ -523,6 +539,7 @@ void ERR_load_STORE_strings(void);
#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

View File

@ -66,6 +66,7 @@
#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"},
@ -86,6 +87,7 @@ static ERR_STRING_DATA STORE_str_functs[]=
{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"},
@ -116,7 +118,13 @@ static ERR_STRING_DATA STORE_str_functs[]=
{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"},
@ -144,6 +152,12 @@ static ERR_STRING_DATA STORE_str_reasons[]=
{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"},
@ -151,6 +165,7 @@ static ERR_STRING_DATA STORE_str_reasons[]=
{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"},
@ -163,6 +178,7 @@ static ERR_STRING_DATA STORE_str_reasons[]=
{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"},

View File

@ -184,6 +184,19 @@ void STORE_free(STORE *store)
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)
@ -297,6 +310,24 @@ int STORE_store_certificate(STORE *s, X509 *data, OPENSSL_ITEM attributes[],
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[])
{
@ -496,6 +527,24 @@ int STORE_store_private_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[],
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[])
{
@ -673,6 +722,24 @@ int STORE_store_public_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[],
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[])
{
@ -869,6 +936,24 @@ int STORE_store_crl(STORE *s, X509_CRL *data, OPENSSL_ITEM attributes[],
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[])
{
@ -989,6 +1074,24 @@ int STORE_store_number(STORE *s, BIGNUM *data, OPENSSL_ITEM attributes[],
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[])
{
@ -1061,6 +1164,24 @@ int STORE_store_arbitrary(STORE *s, BUF_MEM *data, OPENSSL_ITEM attributes[],
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[])
{

View File

@ -126,7 +126,7 @@ static int mem_lock(STORE *s, OPENSSL_ITEM attributes[],
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 =
{
@ -351,7 +351,7 @@ static int mem_unlock(STORE *s, OPENSSL_ITEM attributes[],
{
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;
}

View File

@ -81,6 +81,18 @@ void STORE_destroy_method(STORE_METHOD *store_method)
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;
@ -99,6 +111,12 @@ int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PT
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;
@ -153,6 +171,16 @@ int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_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;
@ -168,6 +196,11 @@ STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm)
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;