diff options
Diffstat (limited to 'tests/pkcs7.c')
-rw-r--r-- | tests/pkcs7.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/tests/pkcs7.c b/tests/pkcs7.c index de0de736d9..11bb2f121d 100644 --- a/tests/pkcs7.c +++ b/tests/pkcs7.c @@ -21,7 +21,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif #include <gnutls/gnutls.h> @@ -40,7 +40,7 @@ #define CERT_DIR "pkcs7-interesting" -static int getnextfile(DIR **dirp, gnutls_datum_t *der, int *exp_ret) +static int getnextfile(DIR ** dirp, gnutls_datum_t * der, int *exp_ret) { struct dirent *d; char path[256]; @@ -65,14 +65,15 @@ static int getnextfile(DIR **dirp, gnutls_datum_t *der, int *exp_ret) d = readdir(*dirp); if (d != NULL #ifdef _DIRENT_HAVE_D_TYPE - && d->d_type == DT_REG + && d->d_type == DT_REG #endif - ) { + ) { if (strstr(d->d_name, ".der") == 0) continue; if (strstr(d->d_name, ".err") != 0) continue; - snprintf(path, sizeof(path), "%s/%s", cert_dir, d->d_name); + snprintf(path, sizeof(path), "%s/%s", cert_dir, + d->d_name); success("Loading %s\n", path); ret = gnutls_load_file(path, der); @@ -80,23 +81,24 @@ static int getnextfile(DIR **dirp, gnutls_datum_t *der, int *exp_ret) return -1; } - snprintf(path, sizeof(path), "%s/%s.err", cert_dir, d->d_name); + snprintf(path, sizeof(path), "%s/%s.err", cert_dir, + d->d_name); success("Loading errfile %s\n", path); ret = gnutls_load_file(path, &local); - if (ret < 0) { /* not found assume success */ + if (ret < 0) { /* not found assume success */ *exp_ret = 0; } else { - *exp_ret = atoi((char*)local.data); + *exp_ret = atoi((char *)local.data); success("expecting error code %d\n", *exp_ret); gnutls_free(local.data); } return 0; } - } while(d != NULL); + } while (d != NULL); closedir(*dirp); - return -1; /* finished */ + return -1; /* finished */ } void doit(void) @@ -110,7 +112,7 @@ void doit(void) if (ret < 0) fail("init %d\n", ret); - while (getnextfile(&dirp, &der, &exp_ret)==0) { + while (getnextfile(&dirp, &der, &exp_ret) == 0) { ret = gnutls_pkcs7_init(&cert); if (ret < 0) fail("crt_init %d\n", ret); @@ -123,7 +125,9 @@ void doit(void) if (ret == 0) { /* attempt to fully decode */ gnutls_datum_t out; - ret = gnutls_pkcs7_print(cert, GNUTLS_CRT_PRINT_FULL, &out); + ret = + gnutls_pkcs7_print(cert, GNUTLS_CRT_PRINT_FULL, + &out); if (ret < 0) { fail("print: %s\n", gnutls_strerror(ret)); } |