Skip to content

Adding -text arg for crl command#109

Merged
JacobBarthelmeh merged 2 commits intowolfSSL:mainfrom
lealem47:crlPrint
Sep 2, 2022
Merged

Adding -text arg for crl command#109
JacobBarthelmeh merged 2 commits intowolfSSL:mainfrom
lealem47:crlPrint

Conversation

@lealem47
Copy link
Copy Markdown
Contributor

lealem@ubuntu:~/HOME/wolfCLU$ ./wolfssl crl -in crl.pem -text -noout
Certificate Revocation List (CRL):
        Version: 2 (0x1)
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com, emailAddress=info@wolfssl.com
        Last Update: Dec 20 23:07:25 2021 GMT
        Next Update: Sep 15 23:07:25 2024 GMT
        CRL extensions:
            X509v3 CRL Number:
                2
Revoked Certificates:
    Serial Number: 2 (0x2)
        Revocation Date: Dec 20 23:07:25 2021 GMT
    Signature Algorithm: sha256WithRSAEncryption
         8b:c0:b8:cb:03:5c:8c:d1:53:b2:c5:b1:4d:f3:b3:e8:13:bf:
         5f:a7:1a:cc:74:e8:06:66:c1:cb:89:c3:e3:b3:fb:68:4e:8f:
         d0:5b:33:d8:ed:5e:14:b3:21:c8:c0:06:66:97:6d:69:96:78:
         bd:a9:d1:59:85:0f:13:29:2d:2f:49:87:94:84:14:94:38:74:
         04:16:94:10:ea:f2:31:d8:34:b7:65:e8:5e:52:4f:96:ac:bf:
         5f:4f:6c:ee:5d:04:2a:26:b2:29:7c:9d:06:82:b3:b5:e6:5b:
         d5:11:72:56:d5:34:75:82:5e:2a:f3:c6:67:72:94:c6:02:83:
         e8:58:85:2d:73:db:55:30:a2:c2:b1:bb:4c:bf:f6:a2:d8:b3:
         fc:1b:bd:51:97:4e:f4:c2:04:4f:04:ee:61:e7:51:4b:4f:09:
         fe:10:5c:3c:1e:e0:cb:51:1f:54:f4:38:3f:6c:58:ee:4e:f8:
         ca:34:cd:37:ee:bb:06:53:14:c7:60:a4:89:ac:9a:50:4a:b5:
         9e:b3:59:97:9b:27:5e:5c:fa:14:74:3d:a2:76:62:63:ae:e8:
         d2:f9:b7:ad:0c:3f:07:40:50:5c:e4:fb:95:3c:3d:df:2e:81:
         f2:6a:9e:01:69:c3:a2:1e:d7:00:2b:6d:6c:67:f0:fb:13:ce:
         f1:a5:08:d6

Won't pass tests until wolfSSL/wolfssl#5388 is merged.

@lealem47 lealem47 self-assigned this Jul 28, 2022
@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

Lets add something like this

--- a/configure.ac
+++ b/configure.ac
@@ -98,6 +98,11 @@ AC_CHECK_LIB([wolfssl],[wolfCrypt_Init],,[AC_MSG_ERROR([libwolfssl is required a
 # since we have autoconf available, we can use wolfssl options header
 AM_CFLAGS="$AM_CFLAGS -DHAVE_WOLFSSL_OPTIONS"
 
+# check for some conditional functions
+AC_CHECK_FUNC([wolfSSL_X509_CRL_print],
+    [AM_CFLAGS="$AM_CFLAGS -DHAVE_WOLFSSL_CRL_PRINT"],
+    [])
+
 ###############################################
 #                                             #
 #     Need a genKey check                     #

And

--- a/src/sign-verify/clu_crl_verify.c
+++ b/src/sign-verify/clu_crl_verify.c
@@ -219,6 +219,7 @@ int wolfCLU_CRLVerify(int argc, char** argv)
     }
 
     if (ret == WOLFCLU_SUCCESS && text != 0) {
+    #ifdef HAVE_WOLFSSL_CRL_PRINT
         /* set to stdout if no output is set */
         if (bioOut == NULL) {
             bioOut = wolfSSL_BIO_new(wolfSSL_BIO_s_file());
@@ -233,6 +234,10 @@ int wolfCLU_CRLVerify(int argc, char** argv)
             }
         }
         wolfSSL_X509_CRL_print(bioOut, test);
+    #else
+        wolfCLU_LogError("CRL print not available in version of wolfSSL");
+        ret = WOLFCLU_FATAL_ERROR;
+    #endif
     }
 

Then it will conditionally print out depending on if it finds the function available in the wolfSSL library linked to. Also a help menu print out should be added for -text.

@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

The reverse of assuming the function is available till not found maybe better (cases without autoconf could just assume it exits), using something like NO_WOLFSSL_CRL_PRINT.

lealem47 added a commit to lealem47/wolfCLU that referenced this pull request Aug 12, 2022
@lealem47 lealem47 assigned JacobBarthelmeh and unassigned lealem47 Aug 19, 2022
@JacobBarthelmeh JacobBarthelmeh merged commit 4e4f464 into wolfSSL:main Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants