diff options
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 | } |