[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Thu May 28 16:54:48 UTC 2015


The branch master has been updated
       via  bca3f06b84de3c0b428724ac535995064c54aee3 (commit)
      from  d9f1c639d5162617ab0aeec23865771dc4fbcbcd (commit)


- Log -----------------------------------------------------------------
commit bca3f06b84de3c0b428724ac535995064c54aee3
Author: Rich Salz <rsalz at akamai.com>
Date:   Tue May 26 15:42:01 2015 -0400

    Use enum for X509_LOOKUP_TYPE
    
    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 at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/x509/by_dir.c       |  4 ++--
 crypto/x509/x509_lu.c      |  8 ++++++--
 include/openssl/x509_vfy.h | 11 +++++------
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index ffd101c..cc91db8 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -247,8 +247,8 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
     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 {
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index 2086225..ae46df8 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -294,8 +294,8 @@ X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
     }
 }
 
-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;
@@ -403,6 +403,8 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
 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;
@@ -417,6 +419,8 @@ void X509_OBJECT_free_contents(X509_OBJECT *a)
     if (!a)
         return;
     switch (a->type) {
+    default:
+        break;
     case X509_LU_X509:
         X509_free(a->data.x509);
         break;
diff --git a/include/openssl/x509_vfy.h b/include/openssl/x509_vfy.h
index 0be9b5a..4ad2029 100644
--- a/include/openssl/x509_vfy.h
+++ b/include/openssl/x509_vfy.h
@@ -102,15 +102,14 @@ The X509_STORE then calls a function to actually verify the
 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;


More information about the openssl-commits mailing list