8000 Merge pull request #6986 from libgit2/ethomson/warn_sha1 · libgit2/libgit2@a8fbbf7 · GitHub
[go: up one dir, main page]

Skip to content

Commit a8fbbf7

Browse files
authored
Merge pull request #6986 from libgit2/ethomson/warn_sha1
cmake: warn for not using sha1dc
2 parents d85c1a1 + 550cf62 commit a8fbbf7

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,9 @@ endif()
150150

151151
feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
152152
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
153+
154+
# warn for not using sha1dc
155+
156+
foreach(WARNING ${WARNINGS})
157+
message(WARNING ${WARNING})
158+
endforeach()

cmake/SelectHashes.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,10 @@ endif()
112112

113113
add_feature_info(SHA1 ON "using ${USE_SHA1}")
114114
add_feature_info(SHA256 ON "using ${USE_SHA256}")
115+
116+
# warn for users who do not use sha1dc
117+
118+
if(NOT "${USE_SHA1}" STREQUAL "CollisionDetection")
119+
list(APPEND WARNINGS "SHA1 support is set to ${USE_SHA1} which is not recommended - git's hash algorithm is sha1dc, it is *not* SHA1. Using SHA1 may leave you and your users susceptible to SHAttered-style attacks.")
120+
set(WARNINGS ${WARNINGS} PARENT_SCOPE)
121+
endif()

docs/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ will introduce a number of breaking changes in v2.0:
252252
https://github.com/libgit2/libgit2/pull/6924
253253
* ci: port latest fixes to nightlies by @ethomson in
254254
https://github.com/libgit2/libgit2/pull/6926
255+
* cmake: warn for not using sha1dc by @ethomson in
256+
https://github.com/libgit2/libgit2/pull/6986
255257

256258
### Documentation improvements
257259

0 commit comments

Comments
 (0)
0