Bugfix: replace MD5SUM with SHA256SUMs 99/30999/1
authorRoss Brattain <ross.b.brattain@intel.com>
Mon, 20 Mar 2017 08:49:18 +0000 (01:49 -0700)
committerRoss Brattain <ross.b.brattain@intel.com>
Mon, 20 Mar 2017 08:54:59 +0000 (01:54 -0700)
MD5 is broken and should not be used

Change-Id: Ib168932387f58f0a538d865f8ef4e3cda046a35a
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
tools/yardstick-img-dpdk-modify
tools/yardstick-img-lxd-modify
tools/yardstick-img-modify

index ec2672d..9f3d119 100644 (file)
@@ -44,8 +44,8 @@ host=${HOST:-"cloud-images.ubuntu.com"}
 release=${RELEASE:-"wily"}
 image_path="${release}/current/${release}-server-cloudimg-amd64-disk1.img"
 image_url=${IMAGE_URL:-"https://${host}/${image_path}"}
-md5sums_path="${release}/current/MD5SUMS"
-md5sums_url=${MD5SUMS_URL:-"https://${host}/${md5sums_path}"}
+sha256sums_path="${release}/current/SHA256SUMS"
+sha256sums_url=${SHA256SUMS_URL:-"https://${host}/${sha256sums_path}"}
 
 imgfile="${workspace}/yardstick-${release}-server"
 raw_imgfile="${workspace}/yardstick-${release}-server.raw"
@@ -55,14 +55,14 @@ filename=$(basename $image_url)
 download() {
     test -d $workspace || mkdir -p $workspace
     cd $workspace
-    rm -f MD5SUMS # always download the checksum file to a detect stale image
-    wget $md5sums_url
+    rm -f SHA256SUMS # always download the checksum file to a detect stale image
+    wget $sha256sums_url
     test -e $filename || wget -nc $image_url
-    grep $filename MD5SUMS | md5sum -c ||
+    grep $filename SHA256SUMS | sha256sum -c ||
     if [ $? -ne 0 ]; then
         rm $filename
         wget -nc $image_url
-        grep $filename MD5SUMS | md5sum -c
+        grep $filename SHA256SUMS | sha256sum -c
     fi
     qemu-img convert $filename $raw_imgfile
     cd -
index 4ca4eb4..b977d2a 100755 (executable)
@@ -44,8 +44,8 @@ host=${HOST:-"cloud-images.ubuntu.com"}
 release=${RELEASE:-"xenial"}
 image_path="${release}/current/${release}-server-cloudimg-amd64-root.tar.gz"
 image_url=${IMAGE_URL:-"https://${host}/${image_path}"}
-md5sums_path="${release}/current/MD5SUMS"
-md5sums_url=${MD5SUMS_URL:-"https://${host}/${md5sums_path}"}
+sha256sums_path="${release}/current/SHA256SUMS"
+sha256sums_url=${SHA256SUMS_URL:-"https://${host}/${sha256sums_path}"}
 
 imgfile="${workspace}/yardstick-image.tar.gz"
 filename=$(basename $image_url)
@@ -54,14 +54,14 @@ filename=$(basename $image_url)
 download() {
     test -d $workspace || mkdir -p $workspace
     cd $workspace
-    rm -f MD5SUMS # always download the checksum file to a detect stale image
-    wget $md5sums_url
+    rm -f SHA256SUMS # always download the checksum file to a detect stale image
+    wget $sha256sums_url
     test -e $filename || wget -nc --progress=dot:giga $image_url
-    grep $filename MD5SUMS | md5sum -c ||
+    grep $filename SHA256SUMS | sha256sum -c ||
     if [ $? -ne 0 ]; then
         rm $filename
         wget -nc --progress=dot:giga $image_url
-        grep $filename MD5SUMS | md5sum -c
+        grep $filename SHA256SUMS | sha256sum -c
     fi
     cd -
 }
index b4f632b..658717c 100755 (executable)
@@ -48,8 +48,8 @@ fi
 
 image_path="${release}/current/${release}-server-cloudimg-${YARD_IMG_ARCH}-${boot_mode}.img"
 image_url=${IMAGE_URL:-"https://${host}/${image_path}"}
-md5sums_path="${release}/current/MD5SUMS"
-md5sums_url=${MD5SUMS_URL:-"https://${host}/${md5sums_path}"}
+sha256sums_path="${release}/current/SHA256SUMS"
+sha256sums_url=${SHA256SUMS_URL:-"https://${host}/${sha256sums_path}"}
 
 imgfile="${workspace}/yardstick-image.img"
 raw_imgfile_basename="yardstick-${release}-server.raw"
@@ -62,14 +62,14 @@ apt-get install -y parted
 download() {
     test -d $workspace || mkdir -p $workspace
     cd $workspace
-    rm -f MD5SUMS # always download the checksum file to a detect stale image
-    wget $md5sums_url
+    rm -f SHA256SUMS # always download the checksum file to a detect stale image
+    wget $sha256sums_url
     test -e $filename || wget -nc --progress=dot:giga $image_url
-    grep $filename MD5SUMS | md5sum -c ||
+    grep $filename SHA256SUMS | sha256sum -c ||
     if [ $? -ne 0 ]; then
         rm $filename
         wget -nc --progress=dot:giga $image_url
-        grep $filename MD5SUMS | md5sum -c
+        grep $filename SHA256SUMS | sha256sum -c
     fi
 
     for i in $(seq 0 9); do