summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/t_pkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/asn1/t_pkey.c')
-rw-r--r--crypto/asn1/t_pkey.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/crypto/asn1/t_pkey.c b/crypto/asn1/t_pkey.c
index e3e0739bbd..bd89c1dc11 100644
--- a/crypto/asn1/t_pkey.c
+++ b/crypto/asn1/t_pkey.c
@@ -141,14 +141,10 @@ int RSA_print(BIO *bp, const RSA *x, int off)
goto err;
}
- if (off)
- {
- if (off > 128) off=128;
- memset(str,' ',off);
- }
if (x->d != NULL)
{
- if (off && (BIO_write(bp,str,off) <= 0)) goto err;
+ if(!BIO_indent(bp,off,128))
+ goto err;
if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->n))
<= 0) goto err;
}
@@ -194,7 +190,6 @@ int DSA_print_fp(FILE *fp, const DSA *x, int off)
int DSA_print(BIO *bp, const DSA *x, int off)
{
- char str[128];
unsigned char *m=NULL;
int ret=0;
size_t buf_len=0,i;
@@ -221,14 +216,10 @@ int DSA_print(BIO *bp, const DSA *x, int off)
goto err;
}
- if (off)
- {
- if (off > 128) off=128;
- memset(str,' ',off);
- }
if (x->priv_key != NULL)
{
- if (off && (BIO_write(bp,str,off) <= 0)) goto err;
+ if(!BIO_indent(bp,off,128))
+ goto err;
if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->p))
<= 0) goto err;
}
@@ -612,9 +603,9 @@ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
{
if ((i%15) == 0)
{
- str[0]='\n';
- memset(&(str[1]),' ',off+4);
- if (BIO_write(bp,str,off+1+4) <= 0) return(0);
+ if(BIO_puts(bp,"\n") <= 0
+ || !BIO_indent(bp,off+4,128))
+ return 0;
}
if (BIO_printf(bp,"%02x%s",buf[i],((i+1) == n)?"":":")
<= 0) return(0);