projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Start to reduce some of the header bloat.
[oweals/openssl.git]
/
crypto
/
asn1
/
t_x509.c
diff --git
a/crypto/asn1/t_x509.c
b/crypto/asn1/t_x509.c
index f142f65900670998679aaf22e4912be491a1c7ff..454c695eb2aa43d62fb07880b730fc067c75df59 100644
(file)
--- a/
crypto/asn1/t_x509.c
+++ b/
crypto/asn1/t_x509.c
@@
-112,7
+112,7
@@
int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
mlch = '\n';
if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
mlch = '\n';
- nmindent = 1
6
;
+ nmindent = 1
2
;
}
if(nmflags == X509_FLAG_COMPAT)
}
if(nmflags == X509_FLAG_COMPAT)
@@
-165,20
+165,23
@@
int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
if(!(cflag & X509_FLAG_NO_SIGNAME))
{
if(!(cflag & X509_FLAG_NO_SIGNAME))
{
- i=OBJ_obj2nid(ci->signature->algorithm);
- if (BIO_printf(bp,"%8sSignature Algorithm: %s\n","",
- (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0)
+ if (BIO_printf(bp,"%8sSignature Algorithm: ","") <= 0)
+ goto err;
+ if (i2a_ASN1_OBJECT(bp, ci->signature->algorithm) <= 0)
+ goto err;
+ if (BIO_puts(bp, "\n") <= 0)
goto err;
}
if(!(cflag & X509_FLAG_NO_ISSUER))
{
if (BIO_printf(bp," Issuer:%c",mlch) <= 0) goto err;
goto err;
}
if(!(cflag & X509_FLAG_NO_ISSUER))
{
if (BIO_printf(bp," Issuer:%c",mlch) <= 0) goto err;
- if (!X509_NAME_print_ex(bp,X509_get_issuer_name(x),nmindent, nmflags)) goto err;
+ if (X509_NAME_print_ex(bp,X509_get_issuer_name(x),nmindent, nmflags) < 0) goto err;
+ if (BIO_write(bp,"\n",1) <= 0) goto err;
}
if(!(cflag & X509_FLAG_NO_VALIDITY))
{
}
if(!(cflag & X509_FLAG_NO_VALIDITY))
{
- if (BIO_write(bp,"
\n Validity\n",18
) <= 0) goto err;
+ if (BIO_write(bp,"
Validity\n",17
) <= 0) goto err;
if (BIO_write(bp," Not Before: ",24) <= 0) goto err;
if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err;
if (BIO_write(bp," Not Before: ",24) <= 0) goto err;
if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err;
@@
-188,15
+191,19
@@
int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
if(!(cflag & X509_FLAG_NO_SUBJECT))
{
if (BIO_printf(bp," Subject:%c",mlch) <= 0) goto err;
if(!(cflag & X509_FLAG_NO_SUBJECT))
{
if (BIO_printf(bp," Subject:%c",mlch) <= 0) goto err;
- if (!X509_NAME_print_ex(bp,X509_get_subject_name(x),nmindent, nmflags)) goto err;
+ if (X509_NAME_print_ex(bp,X509_get_subject_name(x),nmindent, nmflags) < 0) goto err;
+ if (BIO_write(bp,"\n",1) <= 0) goto err;
}
if(!(cflag & X509_FLAG_NO_PUBKEY))
{
}
if(!(cflag & X509_FLAG_NO_PUBKEY))
{
- if (BIO_write(bp,"\n Subject Public Key Info:\n",34) <= 0)
+ if (BIO_write(bp," Subject Public Key Info:\n",33) <= 0)
+ goto err;
+ if (BIO_printf(bp,"%12sPublic Key Algorithm: ","") <= 0)
+ goto err;
+ if (i2a_ASN1_OBJECT(bp, ci->key->algor->algorithm) <= 0)
+ goto err;
+ if (BIO_puts(bp, "\n") <= 0)
goto err;
goto err;
- i=OBJ_obj2nid(ci->key->algor->algorithm);
- if (BIO_printf(bp,"%12sPublic Key Algorithm: %s\n","",
- (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err;
pkey=X509_get_pubkey(x);
if (pkey == NULL)
pkey=X509_get_pubkey(x);
if (pkey == NULL)
@@
-252,7
+259,6
@@
int X509_ocspid_print (BIO *bp, X509 *x)
unsigned char *dertmp;
int derlen;
int i;
unsigned char *dertmp;
int derlen;
int i;
- SHA_CTX SHA1buf ;
unsigned char SHA1md[SHA_DIGEST_LENGTH];
/* display the hash of the subject as it would appear
unsigned char SHA1md[SHA_DIGEST_LENGTH];
/* display the hash of the subject as it would appear
@@
-264,9
+270,7
@@
int X509_ocspid_print (BIO *bp, X509 *x)
goto err;
i2d_X509_NAME(x->cert_info->subject, &dertmp);
goto err;
i2d_X509_NAME(x->cert_info->subject, &dertmp);
- SHA1_Init(&SHA1buf);
- SHA1_Update(&SHA1buf, der, derlen);
- SHA1_Final(SHA1md,&SHA1buf);
+ EVP_Digest(der, derlen, SHA1md, NULL, EVP_sha1());
for (i=0; i < SHA_DIGEST_LENGTH; i++)
{
if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err;
for (i=0; i < SHA_DIGEST_LENGTH; i++)
{
if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err;
@@
-279,10
+283,8
@@
int X509_ocspid_print (BIO *bp, X509 *x)
if (BIO_printf(bp,"\n Public key OCSP hash: ") <= 0)
goto err;
if (BIO_printf(bp,"\n Public key OCSP hash: ") <= 0)
goto err;
- SHA1_Init(&SHA1buf);
- SHA1_Update(&SHA1buf, x->cert_info->key->public_key->data,
- x->cert_info->key->public_key->length);
- SHA1_Final(SHA1md,&SHA1buf);
+ EVP_Digest(x->cert_info->key->public_key->data,
+ x->cert_info->key->public_key->length, SHA1md, NULL, EVP_sha1());
for (i=0; i < SHA_DIGEST_LENGTH; i++)
{
if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0)
for (i=0; i < SHA_DIGEST_LENGTH; i++)
{
if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0)
@@
-438,6
+440,8
@@
int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
ll=80-2-obase;
s=X509_NAME_oneline(name,buf,256);
ll=80-2-obase;
s=X509_NAME_oneline(name,buf,256);
+ if (!*s)
+ return 1;
s++; /* skip the first slash */
l=ll;
s++; /* skip the first slash */
l=ll;