diff options
| author | markus <> | 2002-09-05 12:51:50 +0000 | 
|---|---|---|
| committer | markus <> | 2002-09-05 12:51:50 +0000 | 
| commit | 15b5d84f9da2ce4bfae8580e56e34a859f74ad71 (patch) | |
| tree | bf939e82d7fd73cc8a01cf6959002209972091bc /src/lib/libcrypto/asn1/x_long.c | |
| parent | 027351f729b9e837200dae6e1520cda6577ab930 (diff) | |
| download | openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.gz openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.bz2 openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.zip | |
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/asn1/x_long.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/x_long.c | 10 | 
1 files changed, 2 insertions, 8 deletions
| diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c index c5f25956cb..c04b192794 100644 --- a/src/lib/libcrypto/asn1/x_long.c +++ b/src/lib/libcrypto/asn1/x_long.c | |||
| @@ -104,12 +104,7 @@ static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const A | |||
| 104 | long ltmp; | 104 | long ltmp; | 
| 105 | unsigned long utmp; | 105 | unsigned long utmp; | 
| 106 | int clen, pad, i; | 106 | int clen, pad, i; | 
| 107 | /* this exists to bypass broken gcc optimization */ | 107 | ltmp = *(long *)pval; | 
| 108 | char *cp = (char *)pval; | ||
| 109 | |||
| 110 | /* use memcpy, because we may not be long aligned */ | ||
| 111 | memcpy(<mp, cp, sizeof(long)); | ||
| 112 | |||
| 113 | if(ltmp == it->size) return -1; | 108 | if(ltmp == it->size) return -1; | 
| 114 | /* Convert the long to positive: we subtract one if negative so | 109 | /* Convert the long to positive: we subtract one if negative so | 
| 115 | * we can cleanly handle the padding if only the MSB of the leading | 110 | * we can cleanly handle the padding if only the MSB of the leading | 
| @@ -141,7 +136,6 @@ static int long_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, | |||
| 141 | int neg, i; | 136 | int neg, i; | 
| 142 | long ltmp; | 137 | long ltmp; | 
| 143 | unsigned long utmp = 0; | 138 | unsigned long utmp = 0; | 
| 144 | char *cp = (char *)pval; | ||
| 145 | if(len > sizeof(long)) { | 139 | if(len > sizeof(long)) { | 
| 146 | ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); | 140 | ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); | 
| 147 | return 0; | 141 | return 0; | 
| @@ -164,6 +158,6 @@ static int long_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, | |||
| 164 | ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); | 158 | ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); | 
| 165 | return 0; | 159 | return 0; | 
| 166 | } | 160 | } | 
| 167 | memcpy(cp, <mp, sizeof(long)); | 161 | *(long *)pval = ltmp; | 
| 168 | return 1; | 162 | return 1; | 
| 169 | } | 163 | } | 
