int x509_main(int argc, char **argv)
{
ASN1_INTEGER *sno = NULL;
- ASN1_OBJECT *objtmp;
+ ASN1_OBJECT *objtmp = NULL;
BIO *out = NULL;
CONF *extconf = NULL;
EVP_PKEY *Upkey = NULL, *CApkey = NULL, *fkey = NULL;
if (trust == NULL && (trust = sk_ASN1_OBJECT_new_null()) == NULL)
goto end;
sk_ASN1_OBJECT_push(trust, objtmp);
+ objtmp = NULL;
trustout = 1;
break;
case OPT_ADDREJECT:
&& (reject = sk_ASN1_OBJECT_new_null()) == NULL)
goto end;
sk_ASN1_OBJECT_push(reject, objtmp);
+ objtmp = NULL;
trustout = 1;
break;
case OPT_SETALIAS:
objtmp = sk_ASN1_OBJECT_value(trust, i);
X509_add1_trust_object(x, objtmp);
}
+ objtmp = NULL;
}
if (reject) {
objtmp = sk_ASN1_OBJECT_value(reject, i);
X509_add1_reject_object(x, objtmp);
}
+ objtmp = NULL;
+ }
+
+ if (badsig) {
+ ASN1_BIT_STRING *signature;
+ X509_get0_signature(&signature, NULL, x);
+ if (!corrupt_signature(signature))
+ goto end;
}
if (num) {
for (i = 1; i <= num; i++) {
if (issuer == i) {
- print_name(out, "issuer= ", X509_get_issuer_name(x), nmflag);
+ print_name(out, "issuer=", X509_get_issuer_name(x), nmflag);
} else if (subject == i) {
- print_name(out, "subject= ",
+ print_name(out, "subject=",
X509_get_subject_name(x), nmflag);
} else if (serial == i) {
BIO_printf(out, "serial=");
BIO_printf(out, "Modulus=");
#ifndef OPENSSL_NO_RSA
if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) {
- BIGNUM *n;
+ const BIGNUM *n;
RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, NULL, NULL);
BN_print(out, n);
} else
#endif
#ifndef OPENSSL_NO_DSA
if (EVP_PKEY_id(pkey) == EVP_PKEY_DSA) {
- BIGNUM *dsapub = NULL;
+ const BIGNUM *dsapub = NULL;
DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &dsapub, NULL);
BN_print(out, dsapub);
} else
goto end;
}
- if (badsig) {
- ASN1_BIT_STRING *signature;
- unsigned char *s;
- X509_get0_signature(&signature, NULL, x);
- s = ASN1_STRING_data(signature);
- s[ASN1_STRING_length(signature) - 1] ^= 0x1;
- }
-
if (outformat == FORMAT_ASN1)
i = i2d_X509_bio(out, x);
else if (outformat == FORMAT_PEM) {
ASN1_INTEGER_free(sno);
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
+ ASN1_OBJECT_free(objtmp);
OPENSSL_free(passin);
return (ret);
}
EVP_PKEY *upkey;
upkey = X509_get0_pubkey(xca);
+ if (upkey == NULL) {
+ BIO_printf(bio_err, "Error obtaining CA X509 public key\n");
+ goto end;
+ }
EVP_PKEY_copy_parameters(upkey, pkey);
xsc = X509_STORE_CTX_new();
static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt)
{
int id, i, idret;
- char *pname;
+ const char *pname;
id = X509_PURPOSE_get_id(pt);
pname = X509_PURPOSE_get0_name(pt);
for (i = 0; i < 2; i++) {