Skip to content

Commit bee67ae

Browse files
Release: Use SHA-256 instead of MD5 for check sums
MD5 is an insecure hash, which can be used to protect only from unintentional file corruption. While that in general is ok for our GNU releases, since we don't expect people trying to replace them with anything malicious, I feel that it is time to move to a more secure hash, considering that Synopsys makes a lot of effort to increase security of its products. Signed-off-by: Anton Kolesov <[email protected]>
1 parent daa9b2c commit bee67ae

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

release.mk

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,11 @@ SSH = ssh
132132
WGET = wget
133133
# Always have `-nv`.
134134
override WGETFLAGS += -nv
135+
CHECKSUM := shasum -a256 -b
135136

136137
ifneq ($(HOST),macos)
137-
MD5SUM := md5sum
138138
LOCAL_CP := cp -al
139139
else
140-
MD5SUM := md5 -r
141140
# macOS' `cp` doesn't support hardlinks and `-l`.
142141
LOCAL_CP := cp -a
143142
endif
@@ -357,8 +356,7 @@ DEPLOY_BUILD_ARTIFACTS-$(ENABLE_WINDOWS_INSTALLER) += $(TOOLS_ELFBE_WIN_DIR)
357356
# processed, but linux_images doesn't conform to the convention expected by the
358357
# processing.
359358

360-
# md5sum
361-
MD5SUM_FILE := md5.sum
359+
CHECKSUM_FILE := checksum.txt
362360

363361
#
364362
# Human friendly aliases
@@ -402,14 +400,14 @@ BUILD_DEPS-$(ENABLE_LINUX_IMAGES) += $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTF
402400
build: $(BUILD_DEPS)
403401

404402
ifeq ($(ENABLE_WINDOWS_INSTALLER),y)
405-
$O/$(MD5SUM_FILE): $O/$(IDE_WIN_EXE)
403+
$O/$(CHECKSUM_FILE): $O/$(IDE_WIN_EXE)
406404
endif
407405

408-
$O/$(MD5SUM_FILE): $(BUILD_DEPS)
409-
cd $O && $(MD5SUM) $(UPLOAD_ARTIFACTS) > $@
406+
$O/$(CHECKSUM_FILE): $(BUILD_DEPS)
407+
cd $O && $(CHECKSUM) $(UPLOAD_ARTIFACTS) > $@
410408

411-
.PHONY: md5sum
412-
md5sum: $O/$(MD5SUM_FILE)
409+
.PHONY: checksum
410+
checksum: $O/$(CHECKSUM_FILE)
413411

414412
source-tarball: $O/.stamp_source_tarball
415413

@@ -1012,7 +1010,7 @@ endif
10121010
# Deploy to shared file system
10131011
#
10141012
.PHONY: deploy
1015-
deploy: $O/$(MD5SUM_FILE) $(addprefix $O/,$(DEPLOY_ARTIFACTS))
1013+
deploy: $O/$(CHECKUM_FILE) $(addprefix $O/,$(DEPLOY_ARTIFACTS))
10161014
ifeq ($(DEPLOY_DESTINATION),)
10171015
$(error DEPLOY_DESTINATION must be set to run 'deploy' target)
10181016
endif
@@ -1075,13 +1073,13 @@ endif
10751073
#
10761074
# This is not a part of a default target. Upload should be triggered manually.
10771075
# RELEASE_TAG and RELEASE_NAME mustbe set to something
1078-
upload: $O/$(MD5SUM_FILE)
1076+
upload: $O/$(CHECKSUM_FILE)
10791077
$(PYTHON) github/create-release.py --owner=foss-for-synopsys-dwc-arc-processors \
10801078
--project=toolchain --tag=$(RELEASE_TAG) --draft \
10811079
--release-id=$(RELEASE) \
10821080
--name="$(RELEASE_NAME)" \
10831081
--prerelease --oauth-token=$(shell cat ~/.github_oauth_token) \
1084-
--md5sum-file=$O/$(MD5SUM_FILE) \
1082+
--checksum-file=$O/$(CHECKSUM_FILE) \
10851083
$(addprefix $O/,$(UPLOAD_ARTIFACTS))
10861084

10871085
#

0 commit comments

Comments
 (0)