Use X509_LOOKUP_TYPE for lookup type consistently.
Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
parent
4c4a2f670b
commit
0946a19886
4 changed files with 41 additions and 34 deletions
|
@ -48,8 +48,8 @@ static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
|
|||
static int new_dir(X509_LOOKUP *lu);
|
||||
static void free_dir(X509_LOOKUP *lu);
|
||||
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type);
|
||||
static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
|
||||
X509_OBJECT *ret);
|
||||
static int get_cert_by_subject(X509_LOOKUP *xl, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, X509_OBJECT *ret);
|
||||
static X509_LOOKUP_METHOD x509_dir_lookup = {
|
||||
"Load certs from files in a directory",
|
||||
new_dir, /* new */
|
||||
|
|
|
@ -74,15 +74,16 @@ struct x509_lookup_method_st {
|
|||
int (*shutdown) (X509_LOOKUP *ctx);
|
||||
int (*ctrl) (X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
|
||||
char **ret);
|
||||
int (*get_by_subject) (X509_LOOKUP *ctx, int type, X509_NAME *name,
|
||||
X509_OBJECT *ret);
|
||||
int (*get_by_issuer_serial) (X509_LOOKUP *ctx, int type, X509_NAME *name,
|
||||
ASN1_INTEGER *serial, X509_OBJECT *ret);
|
||||
int (*get_by_fingerprint) (X509_LOOKUP *ctx, int type,
|
||||
int (*get_by_subject) (X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, X509_OBJECT *ret);
|
||||
int (*get_by_issuer_serial) (X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, ASN1_INTEGER *serial,
|
||||
X509_OBJECT *ret);
|
||||
int (*get_by_fingerprint) (X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
unsigned char *bytes, int len,
|
||||
X509_OBJECT *ret);
|
||||
int (*get_by_alias) (X509_LOOKUP *ctx, int type, char *str, int len,
|
||||
X509_OBJECT *ret);
|
||||
int (*get_by_alias) (X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
char *str, int len, X509_OBJECT *ret);
|
||||
};
|
||||
|
||||
/* This is the functions plus an instance of the local variables. */
|
||||
|
|
|
@ -81,8 +81,8 @@ int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
|
|||
return 1;
|
||||
}
|
||||
|
||||
int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
|
||||
X509_OBJECT *ret)
|
||||
int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, X509_OBJECT *ret)
|
||||
{
|
||||
if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL))
|
||||
return X509_LU_FAIL;
|
||||
|
@ -91,15 +91,16 @@ int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
|
|||
return ctx->method->get_by_subject(ctx, type, name, ret);
|
||||
}
|
||||
|
||||
int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
|
||||
ASN1_INTEGER *serial, X509_OBJECT *ret)
|
||||
int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, ASN1_INTEGER *serial,
|
||||
X509_OBJECT *ret)
|
||||
{
|
||||
if ((ctx->method == NULL) || (ctx->method->get_by_issuer_serial == NULL))
|
||||
return X509_LU_FAIL;
|
||||
return ctx->method->get_by_issuer_serial(ctx, type, name, serial, ret);
|
||||
}
|
||||
|
||||
int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
|
||||
int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
unsigned char *bytes, int len,
|
||||
X509_OBJECT *ret)
|
||||
{
|
||||
|
@ -108,8 +109,8 @@ int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
|
|||
return ctx->method->get_by_fingerprint(ctx, type, bytes, len, ret);
|
||||
}
|
||||
|
||||
int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len,
|
||||
X509_OBJECT *ret)
|
||||
int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
char *str, int len, X509_OBJECT *ret)
|
||||
{
|
||||
if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL))
|
||||
return X509_LU_FAIL;
|
||||
|
@ -256,7 +257,8 @@ X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
|
|||
}
|
||||
}
|
||||
|
||||
X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, int type,
|
||||
X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs,
|
||||
X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name)
|
||||
{
|
||||
X509_OBJECT *ret = X509_OBJECT_new();
|
||||
|
@ -399,7 +401,7 @@ X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a)
|
|||
return a->data.crl;
|
||||
}
|
||||
|
||||
int X509_OBJECT_get_type(const X509_OBJECT *a)
|
||||
X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a)
|
||||
{
|
||||
return a->type;
|
||||
}
|
||||
|
@ -434,7 +436,7 @@ void X509_OBJECT_free(X509_OBJECT *a)
|
|||
OPENSSL_free(a);
|
||||
}
|
||||
|
||||
static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type,
|
||||
static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, int *pnmatch)
|
||||
{
|
||||
X509_OBJECT stmp;
|
||||
|
@ -473,14 +475,15 @@ static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type,
|
|||
return idx;
|
||||
}
|
||||
|
||||
int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
|
||||
int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name)
|
||||
{
|
||||
return x509_object_idx_cnt(h, type, name, NULL);
|
||||
}
|
||||
|
||||
X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,
|
||||
int type, X509_NAME *name)
|
||||
X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name)
|
||||
{
|
||||
int idx;
|
||||
idx = X509_OBJECT_idx_by_subject(h, type, name);
|
||||
|
|
|
@ -243,16 +243,17 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
|
|||
| X509_V_FLAG_INHIBIT_ANY \
|
||||
| X509_V_FLAG_INHIBIT_MAP)
|
||||
|
||||
int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
|
||||
int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name);
|
||||
X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,
|
||||
int type, X509_NAME *name);
|
||||
X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name);
|
||||
X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
|
||||
X509_OBJECT *x);
|
||||
int X509_OBJECT_up_ref_count(X509_OBJECT *a);
|
||||
X509_OBJECT *X509_OBJECT_new(void);
|
||||
void X509_OBJECT_free(X509_OBJECT *a);
|
||||
int X509_OBJECT_get_type(const X509_OBJECT *a);
|
||||
X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a);
|
||||
X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a);
|
||||
X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a);
|
||||
X509_STORE *X509_STORE_new(void);
|
||||
|
@ -362,9 +363,10 @@ X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
|
|||
int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
|
||||
int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
|
||||
|
||||
int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
|
||||
X509_OBJECT *ret);
|
||||
X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, int type,
|
||||
int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, X509_OBJECT *ret);
|
||||
X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs,
|
||||
X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name);
|
||||
|
||||
int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
|
||||
|
@ -377,15 +379,16 @@ int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);
|
|||
X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
|
||||
void X509_LOOKUP_free(X509_LOOKUP *ctx);
|
||||
int X509_LOOKUP_init(X509_LOOKUP *ctx);
|
||||
int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
|
||||
X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
|
||||
ASN1_INTEGER *serial, X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
|
||||
int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, ASN1_INTEGER *serial,
|
||||
X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
unsigned char *bytes, int len,
|
||||
X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len,
|
||||
X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
char *str, int len, X509_OBJECT *ret);
|
||||
int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
|
||||
|
||||
int X509_STORE_load_locations(X509_STORE *ctx,
|
||||
|
|
Loading…
Reference in a new issue