[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Adding sha256 support into jigdo tools (jigdo and jigit)



Hi Thomas!

I've just released jigit v1.22 with the embedded libjte 2.0.0. Here's
a (hopefully complete!) diff of the extra changes I've made on top of
xorriso 1.5.2, beyond simply copying in the libjte directory from my
new release. I've tested this for generating both jigdo formats and
all looks good here.

I'm juct committing the debian-cd changes to (optionally) use this as
well, for when we're ready to throw the switch.

Obviously, shout if you have any issues, and of course I'll be happy
to sponsor the 1.5.3(?) upload when you're read.

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
"Further comment on how I feel about IBM will appear once I've worked out
 whether they're being malicious or incompetent. Capital letters are forecast."
 Matthew Garrett, http://www.livejournal.com/users/mjg59/30675.html
diff -urbB --exclude libjte --exclude '*.texi' --exclude '*.info' xorriso-1.5.2.old/libisofs/libisofs.h xorriso-1.5.2/libisofs/libisofs.h
--- xorriso-1.5.2.old/libisofs/libisofs.h	2019-10-26 19:22:45.000000000 +0100
+++ xorriso-1.5.2/libisofs/libisofs.h	2019-11-21 16:09:34.704652769 +0000
@@ -2393,7 +2393,7 @@
     tests. It can be prevented by ./configure option --disable-libjte .
     @since 0.6.38
 */
-#define iso_libjte_req_major 1
+#define iso_libjte_req_major 2
 #define iso_libjte_req_minor 0
 #define iso_libjte_req_micro 0
 
diff -urbB --exclude libjte --exclude '*.texi' --exclude '*.info' xorriso-1.5.2.old/xorriso/emulators.c xorriso-1.5.2/xorriso/emulators.c
--- xorriso-1.5.2.old/xorriso/emulators.c	2019-10-26 19:22:45.000000000 +0100
+++ xorriso-1.5.2/xorriso/emulators.c	2019-11-21 13:54:41.136396703 +0000
@@ -657,8 +657,10 @@
     "-alpha-boot", "-hppa-cmdline", "-hppa-kernel-32", "-hppa-kernel-64",
     "-hppa-bootloader", "-hppa-ramdisk", "-mips-boot", "-mipsel-boot",
     "-jigdo-jigdo", "-jigdo-template", "-jigdo-min-file-size",
-    "-jigdo-force-md5", "-jigdo-exclude", "-jigdo-map", "-md5-list",
-    "-jigdo-template-compress",
+    "-jigdo-force-md5", "jigdo-force-checksum",
+    "-md5-list", "-checksum-list", 
+    "-jigdo-exclude", "-jigdo-map", 
+    "-jigdo-template-compress", "-jigdo-checksum-algorithm",
     "-checksum_algorithm_iso", "-checksum_algorithm_template",
     "--stdio_sync", "--quoted_path_list", "--efi-boot", "--embedded-boot",
     "-isohybrid-mbr", "-e", "-partition_offset", "-partition_hd_cyl",
@@ -853,10 +855,14 @@
 "  -jigdo-template FILE        Produce a jigdo .template file as well as the .iso",
 "  -jigdo-min-file-size SIZE   Minimum size for a file to be listed in the jigdo file", 
 "  -jigdo-force-md5 PATTERN    Pattern(s) where files MUST match an externally-supplied MD5sum",
+"  -jigdo-force-checksum PTRN  Pattern(s) where files MUST match an externally-supplied checksum",
 "  -jigdo-exclude PATTERN      Pattern(s) to exclude from the jigdo file",
 "  -jigdo-map PATTERN1=PATTERN2",
 "                              Pattern(s) to map paths (e.g. Debian=/mirror/debian)",
 "  -md5-list FILE              File containing MD5 sums of the files that should be checked",
+"  -checksum-list FILE         File containing checksums of the files that should be checked",
+"  -jigdo-checksum-algorithm ALGORITHM",
+"                              Choose to use md5 or sha256 checksums in jigdo date; default is md5",
 "  -jigdo-template-compress ALGORITHM",
 "                              Choose to use gzip or bzip2 compression for template data; default is gzip",
 "  -checksum_algorithm_iso alg1,alg2,...",
@@ -2097,11 +2103,14 @@
              strcmp(argpt, "-jigdo-min-file-size") == 0 ||     
              strcmp(argpt, "-jigdo-exclude") == 0 ||     
              strcmp(argpt, "-jigdo-force-md5") == 0 ||     
+             strcmp(argpt, "-jigdo-force-checksum") == 0 ||
              strcmp(argpt, "-jigdo-map") == 0 ||     
+             strcmp(argpt, "-jigdo-checksum-algorithm") == 0 ||
              strcmp(argpt, "-jigdo-template-compress") == 0 ||     
              strcmp(argpt, "-checksum_algorithm_iso") == 0 ||     
              strcmp(argpt, "-checksum_algorithm_template") == 0 ||     
-             strcmp(argpt, "-md5-list") == 0) {
+             strcmp(argpt, "-md5-list") == 0 ||
+             strcmp(argpt, "-checksum-list") == 0) {
      i++;
      ret= Xorriso_option_jigdo(xorriso, argpt, argv[i], 0);
      if(ret <= 0)
diff -urbB --exclude libjte --exclude '*.texi' --exclude '*.info' xorriso-1.5.2.old/xorriso/lib_mgt.c xorriso-1.5.2/xorriso/lib_mgt.c
--- xorriso-1.5.2.old/xorriso/lib_mgt.c	2019-10-26 19:22:45.000000000 +0100
+++ xorriso-1.5.2/xorriso/lib_mgt.c	2019-11-21 15:08:54.274180525 +0000
@@ -765,8 +765,11 @@
      goto jte_failed;
    xorriso->libjte_params_given|= 8;
  } else if(strcmp(aspect, "md5_path") == 0 ||
-           strcmp(aspect, "-md5-list") == 0) {
-   ret= libjte_set_md5_path(jte, arg);
+           strcmp(aspect, "-md5-list") == 0 ||
+           strcmp(aspect, "checksum_path") == 0 ||
+           strcmp(aspect, "-checksum-list") == 0)
+ {
+   ret= libjte_set_checksum_path(jte, arg);
    if(ret <= 0)
      goto jte_failed;
    xorriso->libjte_params_given|= 16;
@@ -802,8 +805,10 @@
      goto jte_failed;
    xorriso->libjte_params_given|= 512;
  } else if(strcmp(aspect, "demand_md5") == 0 ||
-           strcmp(aspect, "-jigdo-force-md5") == 0) {
-   ret= libjte_add_md5_demand(jte, arg);
+	   strcmp(aspect, "-jigdo-force-md5") == 0 ||
+	   strcmp(aspect, "demand_checksum") == 0 ||
+	   strcmp(aspect, "-jigdo-force-checksum") == 0) {
+   ret= libjte_add_checksum_demand(jte, arg);
    if(ret <= 0)
      goto jte_failed;
    xorriso->libjte_params_given|= 1024;
@@ -813,6 +818,21 @@
    if(ret <= 0)
      goto jte_failed;
    xorriso->libjte_params_given|= 2048;
+ } else if(strcmp(aspect, "checksum_algorithm") == 0 ||
+           strcmp(aspect, "-jigdo-checksum-algorithm") == 0) {
+   int ck_size;
+   ret= libjte_set_checksum_algorithm(jte, arg, &ck_size);
+   if(ret <= 0)
+   {
+     msg= libjte_get_next_message(jte);
+     if (msg != NULL)
+     {
+        sprintf(xorriso->info_text, "%s", msg);
+        Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
+     }
+     goto jte_failed;
+   }
+   xorriso->libjte_params_given|= 4096;
  } else {
    sprintf(xorriso->info_text, "-jigdo: unknown aspect '%s'", aspect); 
    Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
diff -urbB --exclude libjte --exclude '*.texi' --exclude '*.info' xorriso-1.5.2.old/xorriso/opts_d_h.c xorriso-1.5.2/xorriso/opts_d_h.c
--- xorriso-1.5.2.old/xorriso/opts_d_h.c	2019-10-26 19:22:45.000000000 +0100
+++ xorriso-1.5.2/xorriso/opts_d_h.c	2019-11-21 15:03:24.588561161 +0000
@@ -1881,6 +1881,7 @@
 "         |\"min_size\"|\"checksum_iso\"|\"checksum_template\"",
 "         |\"compression\"|\"exclude\"|\"demand_md5\"|\"mapping\"",
 "         |\"checksum_iso\"|\"checksum_template\"",
+"         |\"checksum_path\"|\"demand_checksum\"|\"checksum_algorithm\"",
 "         value",
 "                 Clear Jigdo Template Extraction parameter list or add a",
 "                 parameter with its value to that list.",

Reply to: