aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorFrédéric Giudicelli <groups@newpki.org>2014-08-14 22:34:49 -0400
committerRich Salz <rsalz@akamai.com>2014-08-15 10:54:43 -0400
commitc753e71e0a0aea2c540dab96fb02c9c62c6ba7a2 (patch)
treecce8ea27ddebbcd656b329cf3b3e6bf101edeaa9 /crypto/asn1
parentcf8bac445660fca7a354f8cb78aeaac623afc12e (diff)
downloadopenssl-c753e71e0a0aea2c540dab96fb02c9c62c6ba7a2.tar.gz
RT783: Minor optimization to ASN1_INTEGER_set
Remove local variable and avoid extra assignment. Reviewed-by: Emilia Kasper <emilia@silkandcyanide.net>
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/a_int.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c
index 297c45a9ff..b9f2ac1b05 100644
--- a/crypto/asn1/a_int.c
+++ b/crypto/asn1/a_int.c
@@ -337,9 +337,7 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
int j,k;
unsigned int i;
unsigned char buf[sizeof(long)+1];
- long d;
- a->type=V_ASN1_INTEGER;
if (a->length < (int)(sizeof(long)+1))
{
if (a->data != NULL)
@@ -352,18 +350,19 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
ASN1err(ASN1_F_ASN1_INTEGER_SET,ERR_R_MALLOC_FAILURE);
return(0);
}
- d=v;
- if (d < 0)
+ if (v < 0)
{
- d= -d;
+ v= -v;
a->type=V_ASN1_NEG_INTEGER;
}
+ else
+ a->type=V_ASN1_INTEGER;
for (i=0; i<sizeof(long); i++)
{
- if (d == 0) break;
- buf[i]=(int)d&0xff;
- d>>=8;
+ if (v == 0) break;
+ buf[i]=(int)v&0xff;
+ v>>=8;
}
j=0;
for (k=i-1; k >=0; k--)