From 688fbf547568f6440cadbbf31cc9da1576a57f67 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Tue, 19 Sep 2000 17:51:11 +0000 Subject: [PATCH] Fix a typo in apps/pkcs12.c which was using the wrong part of ASN1_TYPE (though they are both ASN1_STRING so it didn't cause any problems). Make 'siglen' an int in apps/dgst.c so we can check the return value of BIO_read() etc. --- apps/dgst.c | 10 +++++----- apps/pkcs12.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/dgst.c b/apps/dgst.c index 5d5ab94aea..d7e524a883 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -74,7 +74,7 @@ #define PROG dgst_main void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout, - EVP_PKEY *key, unsigned char *sigin, unsigned int siglen); + EVP_PKEY *key, unsigned char *sigin, int siglen); int MAIN(int, char **); @@ -96,7 +96,7 @@ int MAIN(int argc, char **argv) char out_bin = -1, want_pub = 0, do_verify = 0; EVP_PKEY *sigkey = NULL; unsigned char *sigbuf = NULL; - unsigned int siglen = 0; + int siglen = 0; apps_startup(); @@ -280,7 +280,7 @@ int MAIN(int argc, char **argv) } siglen = BIO_read(sigbio, sigbuf, siglen); BIO_free(sigbio); - if(siglen == 0) { + if(siglen <= 0) { BIO_printf(bio_err, "Error reading signature file %s\n", sigfile); ERR_print_errors(bio_err); @@ -331,7 +331,7 @@ end: } void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout, - EVP_PKEY *key, unsigned char *sigin, unsigned int siglen) + EVP_PKEY *key, unsigned char *sigin, int siglen) { int len; int i; @@ -345,7 +345,7 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout, { EVP_MD_CTX *ctx; BIO_get_md_ctx(bp, &ctx); - i = EVP_VerifyFinal(ctx, sigin, siglen, key); + i = EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key); if(i > 0) BIO_printf(out, "Verified OK\n"); else if(i == 0) BIO_printf(out, "Verification Failure\n"); else diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 261139565d..070993de30 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -880,14 +880,14 @@ int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name) break; case V_ASN1_OCTET_STRING: - hex_prin(out, av->value.bit_string->data, - av->value.bit_string->length); + hex_prin(out, av->value.octet_string->data, + av->value.octet_string->length); BIO_printf(out, "\n"); break; case V_ASN1_BIT_STRING: - hex_prin(out, av->value.octet_string->data, - av->value.octet_string->length); + hex_prin(out, av->value.bit_string->data, + av->value.bit_string->length); BIO_printf(out, "\n"); break;