Using an enum with -Wswitch means all lookup routines handle
all cases. Remove X509_LU_PKEY which was never used.
Reviewed-by: Richard Levitte <levitte@openssl.org>
return 1;
}
-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)
{
BY_DIR *ctx;
union {
}
}
-int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
- X509_OBJECT *ret)
+int X509_STORE_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type,
+ X509_NAME *name, X509_OBJECT *ret)
{
X509_STORE *ctx = vs->ctx;
X509_LOOKUP *lu;
void X509_OBJECT_up_ref_count(X509_OBJECT *a)
{
switch (a->type) {
+ default:
+ break;
case X509_LU_X509:
CRYPTO_add(&a->data.x509->references, 1, CRYPTO_LOCK_X509);
break;
if (!a)
return;
switch (a->type) {
+ default:
+ break;
case X509_LU_X509:
X509_free(a->data.x509);
break;
certificate chain.
*/
-# define X509_LU_RETRY -1
-# define X509_LU_FAIL 0
-# define X509_LU_X509 1
-# define X509_LU_CRL 2
-# define X509_LU_PKEY 3
+typedef enum {
+ X509_LU_RETRY = -1,
+ X509_LU_FAIL, X509_LU_X509, X509_LU_CRL
+} X509_LOOKUP_TYPE;
typedef struct x509_object_st {
/* one of the above types */
- int type;
+ X509_LOOKUP_TYPE type;
union {
char *ptr;
X509 *x509;