@@ -1326,14 +1326,17 @@ if not meson.is_cross_build() and fs.exists('/dev/tty')
1326
1326
endif
1327
1327
1328
1328
https_backend = get_option (' https_backend' )
1329
+ sha1_backend = get_option (' sha1_backend' )
1330
+ sha1_unsafe_backend = get_option (' sha1_unsafe_backend' )
1331
+ sha256_backend = get_option (' sha256_backend' )
1329
1332
1330
- security_framework = dependency (' Security' , required : https_backend == ' CommonCrypto' )
1333
+ security_framework = dependency (' Security' , required : ' CommonCrypto' in [https_backend, sha1_backend, sha1_unsafe_backend] )
1331
1334
core_foundation_framework = dependency (' CoreFoundation' , required : security_framework.found())
1332
1335
if https_backend == ' auto' and security_framework.found()
1333
1336
https_backend = ' CommonCrypto'
1334
1337
endif
1335
1338
1336
- openssl_required = https_backend == ' openssl' or get_option ( ' sha1_backend' ) == ' openssl ' or get_option ( ' sha256_backend' ) == ' openssl '
1339
+ openssl_required = ' openssl' in [https_backend, sha1_backend, sha1_unsafe_backend, sha256_backend]
1337
1340
openssl = dependency (' openssl' , required : openssl_required, default_options : [' default_library=static' ])
1338
1341
if https_backend == ' auto' and openssl.found()
1339
1342
https_backend = ' openssl'
@@ -1354,7 +1357,6 @@ if https_backend != 'openssl'
1354
1357
libgit_c_args += ' -DNO_OPENSSL'
1355
1358
endif
1356
1359
1357
- sha1_backend = get_option (' sha1_backend' )
1358
1360
if sha1_backend == ' sha1dc'
1359
1361
libgit_c_args += ' -DSHA1_DC'
1360
1362
libgit_c_args += ' -DSHA1DC_NO_STANDARD_INCLUDES=1'
@@ -1367,22 +1369,40 @@ if sha1_backend == 'sha1dc'
1367
1369
' sha1dc/sha1.c' ,
1368
1370
' sha1dc/ubc_check.c' ,
1369
1371
]
1370
- elif sha1_backend == ' common-crypto'
1372
+ endif
1373
+ if sha1_backend == ' CommonCrypto' or sha1_unsafe_backend == ' CommonCrypto'
1374
+ if sha1_backend == ' CommonCrypto'
1375
+ libgit_c_args += ' -DSHA1_APPLE'
1376
+ endif
1377
+ if sha1_unsafe_backend == ' CommonCrypto'
1378
+ libgit_c_args += ' -DSHA1_APPLE_UNSAFE'
1379
+ endif
1380
+
1371
1381
libgit_c_args += ' -DCOMMON_DIGEST_FOR_OPENSSL'
1372
- libgit_c_args += ' -DSHA1_APPLE'
1373
1382
# Apple CommonCrypto requires chunking
1374
1383
libgit_c_args += ' -DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
1375
- elif sha1_backend == ' openssl'
1376
- libgit_c_args += ' -DSHA1_OPENSSL'
1384
+ endif
1385
+ if sha1_backend == ' openssl' or sha1_unsafe_backend == ' openssl'
1386
+ if sha1_backend == ' openssl'
1387
+ libgit_c_args += ' -DSHA1_OPENSSL'
1388
+ endif
1389
+ if sha1_unsafe_backend == ' openssl'
1390
+ libgit_c_args += ' -DSHA1_OPENSSL_UNSAFE'
1391
+ endif
1392
+
1377
1393
libgit_dependencies += openssl
1378
- elif sha1_backend == ' block'
1379
- libgit_c_args += ' -DSHA1_BLK'
1394
+ endif
1395
+ if sha1_backend == ' block' or sha1_unsafe_backend == ' block'
1396
+ if sha1_backend == ' block'
1397
+ libgit_c_args += ' -DSHA1_BLK'
1398
+ endif
1399
+ if sha1_unsafe_backend == ' block'
1400
+ libgit_c_args += ' -DSHA1_BLK_UNSAFE'
1401
+ endif
1402
+
1380
1403
libgit_sources += ' block-sha1/sha1.c'
1381
- else
1382
- error (' Unhandled SHA1 backend ' + sha1_backend)
1383
1404
endif
1384
1405
1385
- sha256_backend = get_option (' sha256_backend' )
1386
1406
if sha256_backend == ' openssl'
1387
1407
libgit_c_args += ' -DSHA256_OPENSSL'
1388
1408
libgit_dependencies += openssl
@@ -1923,3 +1943,10 @@ summary({
1923
1943
' perl' : perl_features_enabled,
1924
1944
' python' : python.found(),
1925
1945
}, section : ' Auto-detected features' )
1946
+
1947
+ summary ({
1948
+ ' https' : https_backend,
1949
+ ' sha1' : sha1_backend,
1950
+ ' sha1_unsafe' : sha1_unsafe_backend,
1951
+ ' sha256' : sha256_backend,
1952
+ }, section : ' Backends' )
0 commit comments