Fossil SCM

Update OpenSSL usage to avoid deprecated APIs.

drh 2025-12-05 16:04 trunk
Commit 0d239b52b0db10be0e8f6d8ac8a6ce76c658a580fe47fa688520f0a010bdccf3
1 file changed +5 -2
+5 -2
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -220,15 +220,18 @@
220220
if( !ASN1_TIME_check(asn1_time) ){
221221
return mprintf("Bad time value");
222222
}else{
223223
char res[20];
224224
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);
226229
/* 0123456789 1234
227230
** UTCTime: YYMMDDHHMMSSZ (YY >= 50 ? 19YY : 20YY)
228231
** GeneralizedTime: YYYYMMDDHHMMSSZ */
229
- if( asn1_time->length < 15 ){
232
+ if( ASN1_STRING_length(asn1_time) < 15 ){
230233
/* UTCTime, fill out century digits */
231234
*pr++ = pt[0]>='5' ? '1' : '2';
232235
*pr++ = pt[0]>='5' ? '9' : '0';
233236
}else{
234237
/* GeneralizedTime, copy century digits and advance source */
235238
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button