@@ -1326,14 +1326,17 @@ if not meson.is_cross_build() and fs.exists('/dev/tty')
13261326endif
13271327
13281328https_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' )
13291332
1330- security_framework = dependency (' Security' , required : https_backend == ' CommonCrypto' )
1333+ security_framework = dependency (' Security' , required : ' CommonCrypto' in [https_backend, sha1_backend, sha1_unsafe_backend] )
13311334core_foundation_framework = dependency (' CoreFoundation' , required : security_framework.found())
13321335if https_backend == ' auto' and security_framework.found()
13331336 https_backend = ' CommonCrypto'
13341337endif
13351338
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]
13371340openssl = dependency (' openssl' , required : openssl_required, default_options : [' default_library=static' ])
13381341if https_backend == ' auto' and openssl.found()
13391342 https_backend = ' openssl'
@@ -1354,7 +1357,6 @@ if https_backend != 'openssl'
13541357 libgit_c_args += ' -DNO_OPENSSL'
13551358endif
13561359
1357- sha1_backend = get_option (' sha1_backend' )
13581360if sha1_backend == ' sha1dc'
13591361 libgit_c_args += ' -DSHA1_DC'
13601362 libgit_c_args += ' -DSHA1DC_NO_STANDARD_INCLUDES=1'
@@ -1367,22 +1369,40 @@ if sha1_backend == 'sha1dc'
13671369 ' sha1dc/sha1.c' ,
13681370 ' sha1dc/ubc_check.c' ,
13691371 ]
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+
13711381 libgit_c_args += ' -DCOMMON_DIGEST_FOR_OPENSSL'
1372- libgit_c_args += ' -DSHA1_APPLE'
13731382 # Apple CommonCrypto requires chunking
13741383 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+
13771393 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+
13801403 libgit_sources += ' block-sha1/sha1.c'
1381- else
1382- error (' Unhandled SHA1 backend ' + sha1_backend)
13831404endif
13841405
1385- sha256_backend = get_option (' sha256_backend' )
13861406if sha256_backend == ' openssl'
13871407 libgit_c_args += ' -DSHA256_OPENSSL'
13881408 libgit_dependencies += openssl
@@ -1923,3 +1943,10 @@ summary({
19231943 ' perl' : perl_features_enabled,
19241944 ' python' : python.found(),
19251945}, 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