Dump PE32 module MD5 sums in lowercase for compaibility with md5sum(1).
authorshort <>
Wed, 3 Sep 2003 14:38:50 +0000 (14:38 +0000)
committershort <>
Wed, 3 Sep 2003 14:38:50 +0000 (14:38 +0000)
src/libcaptive/client/options-module.c

index 4b4ba7d..dae5d70 100644 (file)
@@ -56,7 +56,7 @@ gboolean captive_options_module_load(struct captive_options_module *options_modu
                        && (('M'<<8U)|('Z'<<0U))==GUINT16_FROM_BE(*(const guint16 *)options_module->u.pe32.base)) {
 unsigned char md5_bin[1+128/8];        /* 128 bits==16 bytes; '1+' for leading stub to prevent shorter output of BN_bn2hex() */
 BIGNUM *bignum;
-char *hex;
+char *hex,*s;
 
                /* already done above */
                /* Calculate MD5 sum and convert it to hex string: */
@@ -68,6 +68,13 @@ char *hex;
                options_module->u.pe32.md5=g_strdup(hex+2);
                OPENSSL_free(hex);
                BN_free(bignum);
+               /* BN_bn2hex() returns uppercased string: */
+               g_assert(strlen(options_module->u.pe32.md5)==32);
+               for (s=options_module->u.pe32.md5;*s;s++) {
+                       g_assert(isxdigit(*s));
+                       *s=tolower(*s);
+                       g_assert(isxdigit(*s));
+                       }
                }
        else {
                captive_rtl_file_munmap(options_module->u.pe32.base);