Fossil SCM
Update OpenSSL usage to avoid deprecated APIs.
Commit
0d239b52b0db10be0e8f6d8ac8a6ce76c658a580fe47fa688520f0a010bdccf3
Parent
98287b7b05d1b5f…
1 file changed
+5
-2
+5
-2
| --- src/http_ssl.c | ||
| +++ src/http_ssl.c | ||
| @@ -220,15 +220,18 @@ | ||
| 220 | 220 | if( !ASN1_TIME_check(asn1_time) ){ |
| 221 | 221 | return mprintf("Bad time value"); |
| 222 | 222 | }else{ |
| 223 | 223 | char res[20]; |
| 224 | 224 | char *pr = res; |
| 225 | - const char *pt = (char *)asn1_time->data; | |
| 225 | +#if OPENSSL_VERSION_NUMBER < 0x10100000L | |
| 226 | + #define ASN1_STRING_get0_data ASN1_STRING_data | |
| 227 | +#endif | |
| 228 | + const char *pt = (const char *)ASN1_STRING_get0_data(asn1_time); | |
| 226 | 229 | /* 0123456789 1234 |
| 227 | 230 | ** UTCTime: YYMMDDHHMMSSZ (YY >= 50 ? 19YY : 20YY) |
| 228 | 231 | ** GeneralizedTime: YYYYMMDDHHMMSSZ */ |
| 229 | - if( asn1_time->length < 15 ){ | |
| 232 | + if( ASN1_STRING_length(asn1_time) < 15 ){ | |
| 230 | 233 | /* UTCTime, fill out century digits */ |
| 231 | 234 | *pr++ = pt[0]>='5' ? '1' : '2'; |
| 232 | 235 | *pr++ = pt[0]>='5' ? '9' : '0'; |
| 233 | 236 | }else{ |
| 234 | 237 | /* GeneralizedTime, copy century digits and advance source */ |
| 235 | 238 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -220,15 +220,18 @@ | |
| 220 | if( !ASN1_TIME_check(asn1_time) ){ |
| 221 | return mprintf("Bad time value"); |
| 222 | }else{ |
| 223 | char res[20]; |
| 224 | char *pr = res; |
| 225 | const char *pt = (char *)asn1_time->data; |
| 226 | /* 0123456789 1234 |
| 227 | ** UTCTime: YYMMDDHHMMSSZ (YY >= 50 ? 19YY : 20YY) |
| 228 | ** GeneralizedTime: YYYYMMDDHHMMSSZ */ |
| 229 | if( asn1_time->length < 15 ){ |
| 230 | /* UTCTime, fill out century digits */ |
| 231 | *pr++ = pt[0]>='5' ? '1' : '2'; |
| 232 | *pr++ = pt[0]>='5' ? '9' : '0'; |
| 233 | }else{ |
| 234 | /* GeneralizedTime, copy century digits and advance source */ |
| 235 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -220,15 +220,18 @@ | |
| 220 | if( !ASN1_TIME_check(asn1_time) ){ |
| 221 | return mprintf("Bad time value"); |
| 222 | }else{ |
| 223 | char res[20]; |
| 224 | char *pr = res; |
| 225 | #if OPENSSL_VERSION_NUMBER < 0x10100000L |
| 226 | #define ASN1_STRING_get0_data ASN1_STRING_data |
| 227 | #endif |
| 228 | const char *pt = (const char *)ASN1_STRING_get0_data(asn1_time); |
| 229 | /* 0123456789 1234 |
| 230 | ** UTCTime: YYMMDDHHMMSSZ (YY >= 50 ? 19YY : 20YY) |
| 231 | ** GeneralizedTime: YYYYMMDDHHMMSSZ */ |
| 232 | if( ASN1_STRING_length(asn1_time) < 15 ){ |
| 233 | /* UTCTime, fill out century digits */ |
| 234 | *pr++ = pt[0]>='5' ? '1' : '2'; |
| 235 | *pr++ = pt[0]>='5' ? '9' : '0'; |
| 236 | }else{ |
| 237 | /* GeneralizedTime, copy century digits and advance source */ |
| 238 |