summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/crypto/asn1/f_string.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-04-18 00:58:49 +0000
committertedu <tedu@openbsd.org>2014-04-18 00:58:49 +0000
commitcc777fd461408b419899a04c31acaa3ed6dc4816 (patch)
tree0b9fb1d1f27465d1b71ccff3ce743eb4b868f7f8 /lib/libssl/src/crypto/asn1/f_string.c
parentputting most of the braces in the right column is the very least we can do. (diff)
downloadwireguard-openbsd-cc777fd461408b419899a04c31acaa3ed6dc4816.tar.xz
wireguard-openbsd-cc777fd461408b419899a04c31acaa3ed6dc4816.zip
lob a few more knf grenades in here to soften things up.
Diffstat (limited to 'lib/libssl/src/crypto/asn1/f_string.c')
-rw-r--r--lib/libssl/src/crypto/asn1/f_string.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/lib/libssl/src/crypto/asn1/f_string.c b/lib/libssl/src/crypto/asn1/f_string.c
index 7a59fa9f4f4..87d7aaa0dde 100644
--- a/lib/libssl/src/crypto/asn1/f_string.c
+++ b/lib/libssl/src/crypto/asn1/f_string.c
@@ -69,17 +69,12 @@ int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type)
if (a == NULL) return(0);
- if (a->length == 0)
- {
+ if (a->length == 0) {
if (BIO_write(bp,"0",1) != 1) goto err;
n=1;
- }
- else
- {
- for (i=0; i<a->length; i++)
- {
- if ((i != 0) && (i%35 == 0))
- {
+ } else {
+ for (i=0; i<a->length; i++) {
+ if ((i != 0) && (i%35 == 0)) {
if (BIO_write(bp,"\\\n",2) != 2) goto err;
n+=2;
}
@@ -103,10 +98,8 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
int num=0,slen=0,first=1;
bufsize=BIO_gets(bp,buf,size);
- for (;;)
- {
- if (bufsize < 1)
- {
+ for (;;) {
+ if (bufsize < 1) {
if (first)
break;
else
@@ -121,12 +114,10 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
if (i == 0) goto err_sl;
again=(buf[i-1] == '\\');
- for (j=i-1; j>0; j--)
- {
+ for (j=i-1; j>0; j--) {
if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
((buf[j] >= 'a') && (buf[j] <= 'f')) ||
- ((buf[j] >= 'A') && (buf[j] <= 'F'))))
- {
+ ((buf[j] >= 'A') && (buf[j] <= 'F')))) {
i=j;
break;
}
@@ -140,22 +131,19 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
k=0;
i-=again;
- if (i%2 != 0)
- {
+ if (i%2 != 0) {
ASN1err(ASN1_F_A2I_ASN1_STRING,ASN1_R_ODD_NUMBER_OF_CHARS);
goto err;
}
i/=2;
- if (num+i > slen)
- {
+ if (num+i > slen) {
if (s == NULL)
sp=(unsigned char *)malloc(
(unsigned int)num+i*2);
else
sp=(unsigned char *)realloc(s,
(unsigned int)num+i*2);
- if (sp == NULL)
- {
+ if (sp == NULL) {
ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE);
if (s != NULL) free(s);
goto err;
@@ -163,10 +151,8 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
s=sp;
slen=num+i*2;
}
- for (j=0; j<i; j++,k+=2)
- {
- for (n=0; n<2; n++)
- {
+ for (j=0; j<i; j++,k+=2) {
+ for (n=0; n<2; n++) {
m=bufp[k+n];
if ((m >= '0') && (m <= '9'))
m-='0';
@@ -174,8 +160,7 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
m=m-'a'+10;
else if ((m >= 'A') && (m <= 'F'))
m=m-'A'+10;
- else
- {
+ else {
ASN1err(ASN1_F_A2I_ASN1_STRING,ASN1_R_NON_HEX_CHARACTERS);
goto err;
}
@@ -193,8 +178,7 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
bs->data=s;
ret=1;
err:
- if (0)
- {
+ if (0) {
err_sl:
ASN1err(ASN1_F_A2I_ASN1_STRING,ASN1_R_SHORT_LINE);
}