projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make sure we get the definition of OPENSSL_NO_BIO and OPENSSL_NO_RSA.
[oweals/openssl.git]
/
crypto
/
asn1
/
t_x509.c
diff --git
a/crypto/asn1/t_x509.c
b/crypto/asn1/t_x509.c
index 17ed9f2f7fae137851e2de7faa6e4abdfb3e583d..36cef4605db72e938c6ca5673339c40feec1cfc4 100644
(file)
--- a/
crypto/asn1/t_x509.c
+++ b/
crypto/asn1/t_x509.c
@@
-66,6
+66,9
@@
#ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h>
#endif
#ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h>
#endif
+#ifndef OPENSSL_NO_EC
+#include <openssl/ec.h>
+#endif
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
@@
-176,7
+179,7
@@
int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
if(!(cflag & X509_FLAG_NO_ISSUER))
{
if (BIO_printf(bp," Issuer:%c",mlch) <= 0) 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 (BIO_write(bp,"\n",1) <= 0) goto err;
}
if(!(cflag & X509_FLAG_NO_VALIDITY))
@@
-191,7
+194,7
@@
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 (BIO_write(bp,"\n",1) <= 0) goto err;
}
if(!(cflag & X509_FLAG_NO_PUBKEY))
@@
-228,6
+231,14
@@
int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
DSA_print(bp,pkey->pkey.dsa,16);
}
else
DSA_print(bp,pkey->pkey.dsa,16);
}
else
+#endif
+#ifndef OPENSSL_NO_EC
+ if (pkey->type == EVP_PKEY_EC)
+ {
+ BIO_printf(bp, "%12sEC Public Key:\n","");
+ EC_KEY_print(bp, pkey->pkey.eckey, 16);
+ }
+ else
#endif
BIO_printf(bp,"%12sUnknown Public Key:\n","");
#endif
BIO_printf(bp,"%12sUnknown Public Key:\n","");
@@
-259,7
+270,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
@@
-271,9
+281,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(), NULL);
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;
@@
-286,10
+294,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(), NULL);
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,13
+444,17
@@
err:
int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
{
int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
{
- char *s,*c;
+ char *s,*c
,*b
;
int ret=0,l,ll,i,first=1;
int ret=0,l,ll,i,first=1;
- char buf[256];
ll=80-2-obase;
ll=80-2-obase;
- s=X509_NAME_oneline(name,buf,256);
+ b=s=X509_NAME_oneline(name,NULL,0);
+ if (!*s)
+ {
+ OPENSSL_free(b);
+ return 1;
+ }
s++; /* skip the first slash */
l=ll;
s++; /* skip the first slash */
l=ll;
@@
-500,6
+510,7
@@
int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
err:
X509err(X509_F_X509_NAME_PRINT,ERR_R_BUF_LIB);
}
err:
X509err(X509_F_X509_NAME_PRINT,ERR_R_BUF_LIB);
}
+ OPENSSL_free(b);
return(ret);
}
return(ret);
}