[checksum] enable toggling of SHA512 (Alt-H)

* Also fix overflow digest test into message length
* Also switch log font to Consolas
* Also update version to rufus-next
This commit is contained in:
Pete Batard 2020-06-25 11:58:56 +01:00
parent e011cc8201
commit 2d6a73e4f4
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
11 changed files with 87 additions and 53 deletions

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for rufus 3.11. # Generated by GNU Autoconf 2.69 for rufus 3.12.
# #
# Report bugs to <https://github.com/pbatard/rufus/issues>. # Report bugs to <https://github.com/pbatard/rufus/issues>.
# #
@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='rufus' PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus' PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='3.11' PACKAGE_VERSION='3.12'
PACKAGE_STRING='rufus 3.11' PACKAGE_STRING='rufus 3.12'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='https://rufus.ie' PACKAGE_URL='https://rufus.ie'
@ -1228,7 +1228,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures rufus 3.11 to adapt to many kinds of systems. \`configure' configures rufus 3.12 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1294,7 +1294,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of rufus 3.11:";; short | recursive ) echo "Configuration of rufus 3.12:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1385,7 +1385,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
rufus configure 3.11 rufus configure 3.12
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@ -1440,7 +1440,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by rufus $as_me 3.11, which was It was created by rufus $as_me 3.12, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@ -2303,7 +2303,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='rufus' PACKAGE='rufus'
VERSION='3.11' VERSION='3.12'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -4484,7 +4484,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by rufus $as_me 3.11, which was This file was extended by rufus $as_me 3.12, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -4538,7 +4538,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
rufus config.status 3.11 rufus config.status 3.12
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([rufus], [3.11], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie]) AC_INIT([rufus], [3.12], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c]) AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])

View file

@ -8,7 +8,7 @@
for an interesting struggle, when you also happen to have a comma in one of the fields... --> for an interesting struggle, when you also happen to have a comma in one of the fields... -->
<Identity <Identity
Name="Rufus" Name="Rufus"
Version="3.11.1678.0" Version="3.12.1678.0"
ProcessorArchitecture="@ARCH@" ProcessorArchitecture="@ARCH@"
Publisher='CN=Akeo Consulting, O=Akeo Consulting, STREET=24 Grey Rock, L=Milford, S=Co. Donegal, PostalCode=F92 D667, C=IE' /> Publisher='CN=Akeo Consulting, O=Akeo Consulting, STREET=24 Grey Rock, L=Milford, S=Co. Donegal, PostalCode=F92 D667, C=IE' />
<Properties> <Properties>

View file

@ -1,6 +1,6 @@
@echo off @echo off
setlocal EnableExtensions DisableDelayedExpansion setlocal EnableExtensions DisableDelayedExpansion
set VERSION=3.11 set VERSION=3.12
del /q *.appx >NUL 2>&1 del /q *.appx >NUL 2>&1
del /q *.appxbundle >NUL 2>&1 del /q *.appxbundle >NUL 2>&1

View file

@ -570,6 +570,8 @@ t MSG_309 "Compressed archive"
t MSG_310 "The ISO you have selected uses UEFI and is small enough to be written as an EFI System Partition (ESP). " t MSG_310 "The ISO you have selected uses UEFI and is small enough to be written as an EFI System Partition (ESP). "
"Writing to an ESP, instead of writing to a generic data partition occupying the whole disk, can be preferable " "Writing to an ESP, instead of writing to a generic data partition occupying the whole disk, can be preferable "
"for some types of installations.\n\nPlease select the mode that you want to use to write this image:" "for some types of installations.\n\nPlease select the mode that you want to use to write this image:"
t MSG_311 "Use %s in the main application window to enable."
t MSG_312 "Extra hashes (SHA512)"
######################################################################### #########################################################################
l "ar-SA" "Arabic (العربية)" 0x0401, 0x0801, 0x0c01, 0x1001, 0x1401, 0x1801, 0x1c01, 0x2001, 0x2401, 0x2801, 0x2c01, 0x3001, 0x3401, 0x3801, 0x3c01, 0x4001 l "ar-SA" "Arabic (العربية)" 0x0401, 0x0801, 0x0c01, 0x1001, 0x1401, 0x1801, 0x1c01, 0x2001, 0x2401, 0x2801, 0x2c01, 0x3001, 0x3401, 0x3801, 0x3c01, 0x4001

View file

@ -91,6 +91,7 @@ char sum_str[CHECKSUM_MAX][150];
uint32_t bufnum, sum_count[CHECKSUM_MAX] = { MD5_HASHSIZE, SHA1_HASHSIZE, SHA256_HASHSIZE, SHA512_HASHSIZE }; uint32_t bufnum, sum_count[CHECKSUM_MAX] = { MD5_HASHSIZE, SHA1_HASHSIZE, SHA256_HASHSIZE, SHA512_HASHSIZE };
HANDLE data_ready[CHECKSUM_MAX] = { 0 }, thread_ready[CHECKSUM_MAX] = { 0 }; HANDLE data_ready[CHECKSUM_MAX] = { 0 }, thread_ready[CHECKSUM_MAX] = { 0 };
DWORD read_size[2]; DWORD read_size[2];
BOOL enable_extra_hashes = FALSE;
uint8_t ALIGNED(64) buffer[2][BUFFER_SIZE]; uint8_t ALIGNED(64) buffer[2][BUFFER_SIZE];
/* /*
@ -408,7 +409,11 @@ static __inline void sha256_transform(SUM_CONTEXT *ctx, const uint8_t *data)
ctx->state[7] += h; ctx->state[7] += h;
} }
/* Transform the message X which consists of 16 64-bit-words (SHA-512) */ /*
* Transform the message X which consists of 16 64-bit-words (SHA-512)
* This is an algorithm that *REALLY* benefits from being executed as 64-bit
* code rather than 32-bit, as it's more than twice as fast then...
*/
static __inline void sha512_transform(SUM_CONTEXT* ctx, const uint8_t* data) static __inline void sha512_transform(SUM_CONTEXT* ctx, const uint8_t* data)
{ {
uint64_t a, b, c, d, e, f, g, h, W[80]; uint64_t a, b, c, d, e, f, g, h, W[80];
@ -435,7 +440,11 @@ static __inline void sha512_transform(SUM_CONTEXT* ctx, const uint8_t* data)
for (i = 0; i < 80; i++) { for (i = 0; i < 80; i++) {
if (i < 16) if (i < 16)
#ifdef BIG_ENDIAN_HOST
W[i] = *((uint64_t*)&data[8 * i]));
#else
W[i] = read_swap64(&data[8 * i]); W[i] = read_swap64(&data[8 * i]);
#endif
else else
W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16];
} }
@ -1017,9 +1026,14 @@ INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
SendDlgItemMessageA(hDlg, IDC_MD5, WM_SETFONT, (WPARAM)hFont, TRUE); SendDlgItemMessageA(hDlg, IDC_MD5, WM_SETFONT, (WPARAM)hFont, TRUE);
SendDlgItemMessageA(hDlg, IDC_SHA1, WM_SETFONT, (WPARAM)hFont, TRUE); SendDlgItemMessageA(hDlg, IDC_SHA1, WM_SETFONT, (WPARAM)hFont, TRUE);
SendDlgItemMessageA(hDlg, IDC_SHA256, WM_SETFONT, (WPARAM)hFont, TRUE); SendDlgItemMessageA(hDlg, IDC_SHA256, WM_SETFONT, (WPARAM)hFont, TRUE);
SendDlgItemMessageA(hDlg, IDC_SHA512, WM_SETFONT, (WPARAM)hFont, TRUE);
SetWindowTextA(GetDlgItem(hDlg, IDC_MD5), sum_str[0]); SetWindowTextA(GetDlgItem(hDlg, IDC_MD5), sum_str[0]);
SetWindowTextA(GetDlgItem(hDlg, IDC_SHA1), sum_str[1]); SetWindowTextA(GetDlgItem(hDlg, IDC_SHA1), sum_str[1]);
SetWindowTextA(GetDlgItem(hDlg, IDC_SHA256), sum_str[2]); SetWindowTextA(GetDlgItem(hDlg, IDC_SHA256), sum_str[2]);
if (enable_extra_hashes)
SetWindowTextA(GetDlgItem(hDlg, IDC_SHA512), sum_str[3]);
else
SetWindowTextU(GetDlgItem(hDlg, IDC_SHA512), lmprintf(MSG_311, "<Alt>-<H>"));
// Move/Resize the controls as needed to fit our text // Move/Resize the controls as needed to fit our text
hDC = GetDC(GetDlgItem(hDlg, IDC_MD5)); hDC = GetDC(GetDlgItem(hDlg, IDC_MD5));
@ -1032,6 +1046,7 @@ INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
dw = rc.right - rc.left - dw + 12; // Ideally we'd compute the field borders from the system, but hey... dw = rc.right - rc.left - dw + 12; // Ideally we'd compute the field borders from the system, but hey...
dh = rc.bottom - rc.top - dh + 6; dh = rc.bottom - rc.top - dh + 6;
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SHA256), 0, 0, dw, dh, 1.0f); ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SHA256), 0, 0, dw, dh, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SHA512), 0, 0, dw, dh, 1.0f);
GetWindowRect(GetDlgItem(hDlg, IDC_SHA1), &rc); GetWindowRect(GetDlgItem(hDlg, IDC_SHA1), &rc);
dw = rc.right - rc.left; dw = rc.right - rc.left;
@ -1088,12 +1103,12 @@ DWORD WINAPI IndividualSumThread(void* param)
sum_final[i](&sum_ctx); sum_final[i](&sum_ctx);
memset(&sum_str[i], 0, ARRAYSIZE(sum_str[i])); memset(&sum_str[i], 0, ARRAYSIZE(sum_str[i]));
for (j = 0; j < sum_count[i]; j++) { for (j = 0; j < sum_count[i]; j++) {
val[0] = ((sum_ctx.buf[j] >> 4) < 10) ? ((sum_ctx.buf[j] >> 4) + '0') : ((sum_ctx.buf[j] >> 4) - 0xa + 'a'); sum_str[i][2 * j] = ((sum_ctx.buf[j] >> 4) < 10) ?
val[1] = ((sum_ctx.buf[j] & 15) < 10) ? ((sum_ctx.buf[j] & 15) + '0') : ((sum_ctx.buf[j] & 15) - 0xa + 'a'); ((sum_ctx.buf[j] >> 4) + '0') : ((sum_ctx.buf[j] >> 4) - 0xa + 'a');
static_strcat(sum_str[i], val); sum_str[i][2 * j + 1] = ((sum_ctx.buf[j] & 15) < 10) ?
if (j == 31) ((sum_ctx.buf[j] & 15) + '0') : ((sum_ctx.buf[j] & 15) - 0xa + 'a');
static_strcat(sum_str[i], "\r\n ");
} }
sum_str[i][2 * j] = 0;
return 0; return 0;
} }
} }
@ -1105,10 +1120,11 @@ error:
DWORD WINAPI SumThread(void* param) DWORD WINAPI SumThread(void* param)
{ {
DWORD_PTR* thread_affinity = (DWORD_PTR*)param; DWORD_PTR* thread_affinity = (DWORD_PTR*)param;
HANDLE sum_thread[CHECKSUM_MAX] = { NULL, NULL, NULL }; HANDLE sum_thread[CHECKSUM_MAX] = { NULL, NULL, NULL, NULL };
HANDLE h = INVALID_HANDLE_VALUE; HANDLE h = INVALID_HANDLE_VALUE;
uint64_t rb; uint64_t rb;
int i, _bufnum, r = -1; int i, _bufnum, r = -1;
int num_checksums = CHECKSUM_MAX - (enable_extra_hashes ? 0 : 1);
if ((image_path == NULL) || (thread_affinity == NULL)) if ((image_path == NULL) || (thread_affinity == NULL))
ExitThread(r); ExitThread(r);
@ -1122,7 +1138,7 @@ DWORD WINAPI SumThread(void* param)
// is usually in this first mask, for other tasks. // is usually in this first mask, for other tasks.
SetThreadAffinityMask(GetCurrentThread(), thread_affinity[0]); SetThreadAffinityMask(GetCurrentThread(), thread_affinity[0]);
for (i = 0; i < CHECKSUM_MAX; i++) { for (i = 0; i < num_checksums; i++) {
// NB: Can't use a single manual-reset event for data_ready as we // NB: Can't use a single manual-reset event for data_ready as we
// wouldn't be able to ensure the event is reset before the thread // wouldn't be able to ensure the event is reset before the thread
// gets into its next wait loop // gets into its next wait loop
@ -1164,7 +1180,7 @@ DWORD WINAPI SumThread(void* param)
// Toggle the read buffer // Toggle the read buffer
_bufnum = (bufnum + 1) % 2; _bufnum = (bufnum + 1) % 2;
// Signal the waiting threads // Signal the waiting threads
for (i = 0; i < CHECKSUM_MAX; i++) { for (i = 0; i < num_checksums; i++) {
if (!SetEvent(data_ready[i])) { if (!SetEvent(data_ready[i])) {
uprintf("Could not signal checksum thread %d: %s", i, WindowsErrorString()); uprintf("Could not signal checksum thread %d: %s", i, WindowsErrorString());
goto out; goto out;
@ -1184,14 +1200,14 @@ DWORD WINAPI SumThread(void* param)
} }
// Wait for the thread to signal they are ready to process data // Wait for the thread to signal they are ready to process data
if (WaitForMultipleObjects(CHECKSUM_MAX, thread_ready, TRUE, WAIT_TIME) != WAIT_OBJECT_0) { if (WaitForMultipleObjects(num_checksums, thread_ready, TRUE, WAIT_TIME) != WAIT_OBJECT_0) {
uprintf("Checksum threads failed to signal: %s", WindowsErrorString()); uprintf("Checksum threads failed to signal: %s", WindowsErrorString());
goto out; goto out;
} }
} }
// Our last event with read_size=0 signaled the threads to exit - wait for that to happen // Our last event with read_size=0 signaled the threads to exit - wait for that to happen
if (WaitForMultipleObjects(CHECKSUM_MAX, sum_thread, TRUE, WAIT_TIME) != WAIT_OBJECT_0) { if (WaitForMultipleObjects(num_checksums, sum_thread, TRUE, WAIT_TIME) != WAIT_OBJECT_0) {
uprintf("Checksum threads did not finalize: %s", WindowsErrorString()); uprintf("Checksum threads did not finalize: %s", WindowsErrorString());
goto out; goto out;
} }
@ -1199,11 +1215,17 @@ DWORD WINAPI SumThread(void* param)
uprintf(" MD5: %s", sum_str[0]); uprintf(" MD5: %s", sum_str[0]);
uprintf(" SHA1: %s", sum_str[1]); uprintf(" SHA1: %s", sum_str[1]);
uprintf(" SHA256: %s", sum_str[2]); uprintf(" SHA256: %s", sum_str[2]);
uprintf(" SHA512: %s", sum_str[3]); if (enable_extra_hashes) {
char c = sum_str[3][SHA512_HASHSIZE];
sum_str[3][SHA512_HASHSIZE] = 0;
uprintf(" SHA512: %s", sum_str[3]);
sum_str[3][SHA512_HASHSIZE] = c;
uprintf(" %s", &sum_str[3][SHA512_HASHSIZE]);
}
r = 0; r = 0;
out: out:
for (i = 0; i < CHECKSUM_MAX; i++) { for (i = 0; i < num_checksums; i++) {
if (sum_thread[i] != NULL) if (sum_thread[i] != NULL)
TerminateThread(sum_thread[i], 1); TerminateThread(sum_thread[i], 1);
safe_closehandle(data_ready[i]); safe_closehandle(data_ready[i]);
@ -1287,22 +1309,19 @@ const char* test_hash[CHECKSUM_MAX][4] = {
{ {
"d41d8cd98f00b204e9800998ecf8427e", "d41d8cd98f00b204e9800998ecf8427e",
"74cac558072300385f7ab4dff7465e3c", "74cac558072300385f7ab4dff7465e3c",
"88c7cb90ea8c60be51e8e20875b4d912", "f99d37d3bee20f9c0ca3204991be2698",
"e0ea372ac14a3574167543b851d4babb" "e0ea372ac14a3574167543b851d4babb"
}, }, {
{
"da39a3ee5e6b4b0d3255bfef95601890afd80709", "da39a3ee5e6b4b0d3255bfef95601890afd80709",
"a5bac908bf3e51ff0036a94d43b4f3bd2d01a75d", "a5bac908bf3e51ff0036a94d43b4f3bd2d01a75d",
"8af850c7238f320cba940299e0f4f2da66bd75f9", "8aa6c0064b013b8a6f4e88a0421d39bbf07e2e1b",
"09463ec0b5917706c9cb1d6b164b2582c04018e0" "09463ec0b5917706c9cb1d6b164b2582c04018e0"
}, }, {
{
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"62c1a97974dfe6848942794be4f2f027b5f4815e1eb76db63a30f0e290b5c1c4", "62c1a97974dfe6848942794be4f2f027b5f4815e1eb76db63a30f0e290b5c1c4",
"662a80c59d2a44023d3b111b5242bb7fc0bc7e50ab3ae986df005a630dd7ddb5", "dbca61af192edba49ea215c49a23feee302c98cc4d2c018347fe78db572f07a5",
"c9b43c1058bc7f7661619e9d983fc9d31356e97f9195a2405ab972d0737b11bf" "c9b43c1058bc7f7661619e9d983fc9d31356e97f9195a2405ab972d0737b11bf"
}, }, {
{
"cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e",
"4913ace12f1169e5a5f524ef87ab8fc39dff0418851fbbbb1f609d3261b2b4072bd1746e6accb91bf38f3b1b3d59b0a60af5de67aab87b76c2456fde523efc1c", "4913ace12f1169e5a5f524ef87ab8fc39dff0418851fbbbb1f609d3261b2b4072bd1746e6accb91bf38f3b1b3d59b0a60af5de67aab87b76c2456fde523efc1c",
"33df8a16dd624cbc4613b5ae902b722411c7e90f37dd3947c9a86e01c51ada68fcf5a0cd4ca928d7cc1ed469bb34c2ed008af069d8b28cc4512e6c8b2e7a5592", "33df8a16dd624cbc4613b5ae902b722411c7e90f37dd3947c9a86e01c51ada68fcf5a0cd4ca928d7cc1ed469bb34c2ed008af069d8b28cc4512e6c8b2e7a5592",
@ -1313,6 +1332,7 @@ const char* test_hash[CHECKSUM_MAX][4] = {
/* Tests the message digest aglorithms */ /* Tests the message digest aglorithms */
int TestChecksum(void) int TestChecksum(void)
{ {
const uint32_t blocksize[CHECKSUM_MAX] = { MD5_BLOCKSIZE, SHA1_BLOCKSIZE, SHA256_BLOCKSIZE, SHA512_BLOCKSIZE };
const char* hash_name[4] = { "MD5 ", "SHA1 ", "SHA256", "SHA512" }; const char* hash_name[4] = { "MD5 ", "SHA1 ", "SHA256", "SHA512" };
int i, j, errors = 0; int i, j, errors = 0;
uint8_t sum[MAX_HASHSIZE], *sum_expected; uint8_t sum[MAX_HASHSIZE], *sum_expected;
@ -1327,7 +1347,7 @@ int TestChecksum(void)
copy_msg_len[1] = 3; copy_msg_len[1] = 3;
// Designed to test the case where we pad into the total message length area // Designed to test the case where we pad into the total message length area
// For SHA-512 this is 128 - 16 = 112 bytes, for others 64 - 8 = 56 bytes // For SHA-512 this is 128 - 16 = 112 bytes, for others 64 - 8 = 56 bytes
copy_msg_len[2] = SHA512_BLOCKSIZE - (SHA512_BLOCKSIZE >> 3); copy_msg_len[2] = blocksize[j] - (blocksize[j] >> 3);
copy_msg_len[3] = full_msg_len; copy_msg_len[3] = full_msg_len;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
memset(msg, 0, full_msg_len); memset(msg, 0, full_msg_len);

View file

@ -389,7 +389,7 @@ char* lmprintf(uint32_t msg_id, ...)
pos += sizeof(RIGHT_TO_LEFT_EMBEDDING) - 1; pos += sizeof(RIGHT_TO_LEFT_EMBEDDING) - 1;
} }
va_start(args, msg_id); va_start(args, msg_id);
safe_vsnprintf(&buf[buf_id][pos], LOC_MESSAGE_SIZE- 1 - 2*pos, format, args); safe_vsnprintf(&buf[buf_id][pos], LOC_MESSAGE_SIZE - 1 - 2*pos, format, args);
va_end(args); va_end(args);
if (right_to_left_mode && (msg_table != default_msg_table)) { if (right_to_left_mode && (msg_table != default_msg_table)) {
safe_strcat(buf[buf_id], LOC_MESSAGE_SIZE - 1, POP_DIRECTIONAL_FORMATTING); safe_strcat(buf[buf_id], LOC_MESSAGE_SIZE - 1, POP_DIRECTIONAL_FORMATTING);

View file

@ -158,6 +158,7 @@
#define IDC_MD5 1071 #define IDC_MD5 1071
#define IDC_SHA1 1072 #define IDC_SHA1 1072
#define IDC_SHA256 1073 #define IDC_SHA256 1073
#define IDC_SHA512 1112
#define IDC_SELECTION_ICON 1074 #define IDC_SELECTION_ICON 1074
#define IDC_SELECTION_TEXT 1075 #define IDC_SELECTION_TEXT 1075
#define IDC_SELECTION_LINE 1076 #define IDC_SELECTION_LINE 1076

View file

@ -84,7 +84,7 @@ static unsigned int timer;
static char uppercase_select[2][64], uppercase_start[64], uppercase_close[64], uppercase_cancel[64]; static char uppercase_select[2][64], uppercase_start[64], uppercase_close[64], uppercase_cancel[64];
extern HANDLE update_check_thread; extern HANDLE update_check_thread;
extern BOOL enable_iso, enable_joliet, enable_rockridge; extern BOOL enable_iso, enable_joliet, enable_rockridge, enable_extra_hashes;
extern BYTE* fido_script; extern BYTE* fido_script;
extern HWND hFidoDlg; extern HWND hFidoDlg;
extern uint8_t* grub2_buf; extern uint8_t* grub2_buf;
@ -927,10 +927,10 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
PostMessage(hLog, EM_LIMITTEXT, MAX_LOG_SIZE , 0); PostMessage(hLog, EM_LIMITTEXT, MAX_LOG_SIZE , 0);
// Set the font to Unicode so that we can display anything // Set the font to Unicode so that we can display anything
hDC = GetDC(NULL); hDC = GetDC(NULL);
lfHeight = -MulDiv(8, GetDeviceCaps(hDC, LOGPIXELSY), 72); lfHeight = -MulDiv(9, GetDeviceCaps(hDC, LOGPIXELSY), 72);
safe_release_dc(NULL, hDC); safe_release_dc(NULL, hDC);
hf = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, hf = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
DEFAULT_CHARSET, 0, 0, PROOF_QUALITY, 0, "Arial Unicode MS"); DEFAULT_CHARSET, 0, 0, PROOF_QUALITY, 0, "Consolas");
SendDlgItemMessageA(hDlg, IDC_LOG_EDIT, WM_SETFONT, (WPARAM)hf, TRUE); SendDlgItemMessageA(hDlg, IDC_LOG_EDIT, WM_SETFONT, (WPARAM)hf, TRUE);
// Set 'Close Log' as the selected button // Set 'Close Log' as the selected button
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, IDCANCEL), TRUE); SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, IDCANCEL), TRUE);
@ -3164,6 +3164,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
enable_vmdk = ReadSettingBool(SETTING_ENABLE_VMDK_DETECTION); enable_vmdk = ReadSettingBool(SETTING_ENABLE_VMDK_DETECTION);
enable_file_indexing = ReadSettingBool(SETTING_ENABLE_FILE_INDEXING); enable_file_indexing = ReadSettingBool(SETTING_ENABLE_FILE_INDEXING);
enable_VHDs = !ReadSettingBool(SETTING_DISABLE_VHDS); enable_VHDs = !ReadSettingBool(SETTING_DISABLE_VHDS);
enable_extra_hashes = ReadSettingBool(SETTING_ENABLE_EXTRA_HASHES);
// Initialize the global scaling, in case we need it before we initialize the dialog // Initialize the global scaling, in case we need it before we initialize the dialog
hDC = GetDC(NULL); hDC = GetDC(NULL);
@ -3331,7 +3332,7 @@ relaunch:
while(GetMessage(&msg, NULL, 0, 0)) { while(GetMessage(&msg, NULL, 0, 0)) {
static BOOL ctrl_without_focus = FALSE; static BOOL ctrl_without_focus = FALSE;
BOOL no_focus = (msg.message == WM_SYSKEYDOWN) && !(msg.lParam & 0x20000000); BOOL no_focus = (msg.message == WM_SYSKEYDOWN) && !(msg.lParam & 0x20000000);
// ** ****** **** ************* // ** *********** *************
// .,ABCDEFGHIJKLMNOPQRSTUVWXYZ // .,ABCDEFGHIJKLMNOPQRSTUVWXYZ
// Sigh... The things one need to do to detect standalone use of the 'Alt' key. // Sigh... The things one need to do to detect standalone use of the 'Alt' key.
@ -3451,6 +3452,13 @@ relaunch:
GetDevices(0); GetDevices(0);
continue; continue;
} }
// Alt-H => Toggle computation of SHA512 digest
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'H')) {
enable_extra_hashes = !enable_extra_hashes;
WriteSettingBool(SETTING_ENABLE_EXTRA_HASHES, enable_extra_hashes);
PrintStatusTimeout(lmprintf(MSG_312), enable_extra_hashes);
continue;
}
// Alt-I => Toggle ISO support // Alt-I => Toggle ISO support
// This is useful if you have an ISOHybrid image and you want to force Rufus to use // This is useful if you have an ISOHybrid image and you want to force Rufus to use
// DD-mode when writing the data. // DD-mode when writing the data.

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.11.1684" CAPTION "Rufus 3.12.1685"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -95,18 +95,20 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,253,216,50,12,WS_GROUP DEFPUSHBUTTON "OK",IDOK,253,216,50,12,WS_GROUP
END END
IDD_CHECKSUM DIALOGEX 0, 0, 301, 70 IDD_CHECKSUM DIALOGEX 0, 0, 301, 110
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Checksums" CAPTION "Checksums"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "MD5:",IDC_STATIC,9,10,18,8 LTEXT "MD5:",IDC_STATIC,9,10,18,8
EDITTEXT IDC_MD5,40,9,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY EDITTEXT IDC_MD5,40,9,197,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "SHA1:",IDC_STATIC,9,26,20,8 LTEXT "SHA1:",IDC_STATIC,9,26,20,8
EDITTEXT IDC_SHA1,40,25,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY EDITTEXT IDC_SHA1,40,25,197,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "SHA256:",IDC_STATIC,9,42,27,8 LTEXT "SHA256:",IDC_STATIC,9,42,27,8
EDITTEXT IDC_SHA256,40,41,197,22,ES_MULTILINE | ES_LOWERCASE | ES_READONLY EDITTEXT IDC_SHA256,40,41,197,22,ES_MULTILINE | ES_READONLY
DEFPUSHBUTTON "OK",IDOK,243,49,50,12,WS_GROUP DEFPUSHBUTTON "OK",IDOK,243,86,50,12,WS_GROUP
LTEXT "SHA512:",IDC_STATIC,9,69,27,8
EDITTEXT IDC_SHA512,40,67,197,35,ES_MULTILINE | ES_READONLY
END END
IDD_LICENSE DIALOGEX 0, 0, 335, 213 IDD_LICENSE DIALOGEX 0, 0, 335, 213
@ -395,8 +397,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,11,1684,0 FILEVERSION 3,12,1685,0
PRODUCTVERSION 3,11,1684,0 PRODUCTVERSION 3,12,1685,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -414,13 +416,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.11.1684" VALUE "FileVersion", "3.12.1685"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.11.exe" VALUE "OriginalFilename", "rufus-3.12.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.11.1684" VALUE "ProductVersion", "3.12.1685"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -35,6 +35,7 @@ extern char* ini_file;
#define SETTING_DISABLE_LGP "DisableLGP" #define SETTING_DISABLE_LGP "DisableLGP"
#define SETTING_DISABLE_SECURE_BOOT_NOTICE "DisableSecureBootNotice" #define SETTING_DISABLE_SECURE_BOOT_NOTICE "DisableSecureBootNotice"
#define SETTING_DISABLE_VHDS "DisableVHDs" #define SETTING_DISABLE_VHDS "DisableVHDs"
#define SETTING_ENABLE_EXTRA_HASHES "EnableExtraHashes"
#define SETTING_ENABLE_FILE_INDEXING "EnableFileIndexing" #define SETTING_ENABLE_FILE_INDEXING "EnableFileIndexing"
#define SETTING_ENABLE_USB_DEBUG "EnableUsbDebug" #define SETTING_ENABLE_USB_DEBUG "EnableUsbDebug"
#define SETTING_ENABLE_VMDK_DETECTION "EnableVmdkDetection" #define SETTING_ENABLE_VMDK_DETECTION "EnableVmdkDetection"