From 56cf56465857e79e814b1e2d50f13e176170fcb3 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Fri, 19 Aug 2016 17:43:45 -0400 Subject: twrpDigest refactor This patch is to refactor twrpDigest using polymorphism and inheritance to use the same call patterns for creating and reading a digest. Now a library. Use SHA2 from libcrypto. SHA2 is default if device has libcrypto. Change string MD5 everywhere to use digest or Digest instead. Updated string tags to digest. Translation will be required. Switch out digest code into a driver class from partitionmanager. SHA2 is better for digest creation due to decreased collision space compared to MD5 and SHA1. See https://en.wikipedia.org/wiki/SHA-2 Change-Id: I74b5546789990b12aa4ce2e389d25f80a3fe213f --- Android.mk | 19 +- adbbu/Android.mk | 7 +- adbbu/twrpback.cpp | 38 +- data.cpp | 14 +- digest/md5.c | 257 ----- digest/md5.h | 29 - gui/pages.cpp | 2 +- gui/theme/common/landscape.xml | 16 +- gui/theme/common/languages/cz.xml | 36 +- gui/theme/common/languages/de.xml | 38 +- gui/theme/common/languages/el.xml | 38 +- gui/theme/common/languages/en.xml | 40 +- gui/theme/common/languages/es.xml | 36 +- gui/theme/common/languages/fr.xml | 38 +- gui/theme/common/languages/hu.xml | 38 +- gui/theme/common/languages/it.xml | 38 +- gui/theme/common/languages/nl.xml | 38 +- gui/theme/common/languages/pl.xml | 40 +- gui/theme/common/languages/pt_BR.xml | 36 +- gui/theme/common/languages/ru.xml | 38 +- gui/theme/common/languages/sk.xml | 1280 +++++++++++------------ gui/theme/common/languages/sl.xml | 36 +- gui/theme/common/languages/sv.xml | 10 +- gui/theme/common/languages/tr.xml | 20 +- gui/theme/common/languages/uk.xml | 1351 ++++++++++++------------- gui/theme/common/portrait.xml | 20 +- gui/theme/common/watch.xml | 24 +- gui/theme/extra-languages/languages/ja.xml | 38 +- gui/theme/extra-languages/languages/zh_CN.xml | 38 +- gui/theme/extra-languages/languages/zh_TW.xml | 38 +- gui/theme/landscape_hdpi/splash.xml | 2 +- gui/theme/landscape_hdpi/ui.xml | 2 +- gui/theme/landscape_mdpi/splash.xml | 2 +- gui/theme/landscape_mdpi/ui.xml | 2 +- gui/theme/portrait_hdpi/splash.xml | 2 +- gui/theme/portrait_hdpi/ui.xml | 2 +- gui/theme/portrait_mdpi/splash.xml | 2 +- gui/theme/portrait_mdpi/ui.xml | 2 +- gui/theme/watch_mdpi/splash.xml | 2 +- gui/theme/watch_mdpi/ui.xml | 2 +- openrecoveryscript.cpp | 16 +- partition.cpp | 47 +- partitionmanager.cpp | 125 +-- partitions.hpp | 3 +- prebuilt/Android.mk | 1 + twinstall.cpp | 50 +- twrp-functions.cpp | 1 - twrp-functions.hpp | 2 + twrpDigest.cpp | 161 --- twrpDigest.hpp | 52 - twrpDigest/Android.mk | 29 + twrpDigest/digest/md5/md5.c | 257 +++++ twrpDigest/digest/md5/md5.h | 29 + twrpDigest/twrpDigest.cpp | 33 + twrpDigest/twrpDigest.hpp | 35 + twrpDigest/twrpMD5.cpp | 47 + twrpDigest/twrpMD5.hpp | 42 + twrpDigest/twrpSHA.cpp | 69 ++ twrpDigest/twrpSHA.hpp | 54 + twrpDigestDriver.cpp | 218 ++++ twrpDigestDriver.hpp | 33 + variables.h | 12 +- 62 files changed, 2650 insertions(+), 2377 deletions(-) delete mode 100644 digest/md5.c delete mode 100644 digest/md5.h delete mode 100644 twrpDigest.cpp delete mode 100644 twrpDigest.hpp create mode 100644 twrpDigest/Android.mk create mode 100644 twrpDigest/digest/md5/md5.c create mode 100644 twrpDigest/digest/md5/md5.h create mode 100644 twrpDigest/twrpDigest.cpp create mode 100644 twrpDigest/twrpDigest.hpp create mode 100644 twrpDigest/twrpMD5.cpp create mode 100644 twrpDigest/twrpMD5.hpp create mode 100644 twrpDigest/twrpSHA.cpp create mode 100644 twrpDigest/twrpSHA.hpp create mode 100644 twrpDigestDriver.cpp create mode 100644 twrpDigestDriver.hpp diff --git a/Android.mk b/Android.mk index 3d3428fa9..85cdd325b 100644 --- a/Android.mk +++ b/Android.mk @@ -51,18 +51,15 @@ LOCAL_SRC_FILES := \ fixContexts.cpp \ twrpTar.cpp \ exclude.cpp \ - twrpDigest.cpp \ - digest/md5.c \ find_file.cpp \ - infomanager.cpp - -LOCAL_SRC_FILES += \ + infomanager.cpp \ data.cpp \ partition.cpp \ partitionmanager.cpp \ progresstracking.cpp \ twinstall.cpp \ twrp-functions.cpp \ + twrpDigestDriver.cpp \ openrecoveryscript.cpp \ tarWrite.c @@ -112,9 +109,11 @@ LOCAL_C_INCLUDES += \ system/core/libsparse \ external/zlib -LOCAL_C_INCLUDES += bionic external/openssl/include +LOCAL_C_INCLUDES += bionic ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) - LOCAL_C_INCLUDES += external/stlport/stlport + LOCAL_C_INCLUDES += external/stlport/stlport external/openssl/include +else + LOCAL_C_INCLUDES += external/boringssl/include endif LOCAL_STATIC_LIBRARIES := @@ -122,10 +121,11 @@ LOCAL_SHARED_LIBRARIES := LOCAL_STATIC_LIBRARIES += libguitwrp LOCAL_SHARED_LIBRARIES += libaosprecovery libz libc libcutils libstdc++ libtar libblkid libminuitwrp libminadbd libmtdutils libminzip libtwadbbu libbootloader_message -LOCAL_SHARED_LIBRARIES += libcrecovery +LOCAL_SHARED_LIBRARIES += libcrecovery libtwadbbu libtwrpdigest ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) LOCAL_SHARED_LIBRARIES += libstlport + LOCAL_CFLAGS += -DTW_NO_SHA2_LIBRARY endif ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0) LOCAL_SHARED_LIBRARIES += libmincrypttwrp @@ -159,10 +159,8 @@ ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) #LOCAL_STATIC_LIBRARIES += liblz4 endif endif - LOCAL_C_INCLUDES += external/libselinux/include LOCAL_SHARED_LIBRARIES += libselinux -LOCAL_CFLAGS += -g ifneq ($(TARGET_USERIMAGES_USE_EXT4), true) LOCAL_CFLAGS += -DUSE_EXT4 LOCAL_C_INCLUDES += system/extras/ext4_utils @@ -682,6 +680,7 @@ include $(commands_recovery_local_path)/injecttwrp/Android.mk \ $(commands_recovery_local_path)/simg2img/Android.mk \ $(commands_recovery_local_path)/adbbu/Android.mk \ $(commands_recovery_local_path)/libpixelflinger/Android.mk \ + $(commands_recovery_local_path)/twrpDigest/Android.mk \ $(commands_recovery_local_path)/attr/Android.mk ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0) diff --git a/adbbu/Android.mk b/adbbu/Android.mk index 10faf6f65..33d3ad7d3 100644 --- a/adbbu/Android.mk +++ b/adbbu/Android.mk @@ -2,10 +2,9 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - twrpback.cpp \ - ../twrpDigest.cpp \ - ../digest/md5.c -LOCAL_SHARED_LIBRARIES += libstdc++ libz libselinux + twrpback.cpp + +LOCAL_SHARED_LIBRARIES += libstdc++ libz libtwrpdigest ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) LOCAL_C_INCLUDES += external/stlport/stlport LOCAL_SHARED_LIBRARIES += libstlport diff --git a/adbbu/twrpback.cpp b/adbbu/twrpback.cpp index 1c98a1b5c..8652de2ac 100644 --- a/adbbu/twrpback.cpp +++ b/adbbu/twrpback.cpp @@ -34,9 +34,8 @@ #include "twadbstream.h" #include "twrpback.hpp" -#include "../variables.h" -#include "../twcommon.h" -#include "../twrpDigest.hpp" +#include "../twrpDigest/twrpDigest.hpp" +#include "../twrpDigest/twrpMD5.hpp" twrpback::twrpback(void) { read_fd = 0; @@ -94,7 +93,7 @@ void twrpback::close_restore_fds() { } int twrpback::backup(std::string command) { - twrpDigest adb_md5; + twrpMD5 digest; bool breakloop = false; int bytes = 0, errctr = 0; char result[MAX_ADB_READ]; @@ -215,8 +214,7 @@ int twrpback::backup(std::string command) { struct twfilehdr twimghdr; adblogwrite("Writing TWIMG\n"); - adb_md5.initMD5(); - + digest.init(); memset(&twimghdr, 0, sizeof(twimghdr)); memcpy(&twimghdr, cmd, sizeof(cmd)); md5fnsize = twimghdr.size; @@ -234,7 +232,7 @@ int twrpback::backup(std::string command) { struct twfilehdr twfilehdr; adblogwrite("Writing TWFN\n"); - adb_md5.initMD5(); + digest.init(); ADBSTRUCT_STATIC_ASSERT(sizeof(twfilehdr) == MAX_ADB_READ); @@ -269,8 +267,7 @@ int twrpback::backup(std::string command) { totalbytes += bytes; char *writeresult = new char [bytes]; memcpy(writeresult, result, bytes); - if (adb_md5.updateMD5stream((unsigned char *) writeresult, bytes) == -1) - adblogwrite("failed to update md5 stream\n"); + digest.update((unsigned char *) writeresult, bytes); if (fwrite(writeresult, 1, bytes, adbd_fp) != bytes) { adblogwrite("Error writing backup data to adbd\n"); close_backup_fds(); @@ -290,8 +287,7 @@ int twrpback::backup(std::string command) { close_backup_fds(); return -1; } - if (adb_md5.updateMD5stream((unsigned char *) padding, sizeof(padding)) == -1) - adblogwrite("failed to update md5 stream\n"); + digest.update((unsigned char *) padding, sizeof(padding)); fflush(adbd_fp); totalbytes = 0; } @@ -299,9 +295,8 @@ int twrpback::backup(std::string command) { AdbBackupFileTrailer md5trailer; memset(&md5trailer, 0, sizeof(md5trailer)); - adb_md5.finalizeMD5stream(); - std::string md5string = adb_md5.createMD5string(); + std::string md5string = digest.return_digest_string(); strncpy(md5trailer.start_of_trailer, TWRP, sizeof(md5trailer.start_of_trailer)); strncpy(md5trailer.type, MD5TRAILER, sizeof(md5trailer.type)); @@ -350,8 +345,7 @@ int twrpback::backup(std::string command) { char *writeresult = new char [bytes]; memcpy(writeresult, result, bytes); - if (adb_md5.updateMD5stream((unsigned char *) writeresult, bytes) == -1) - adblogwrite("failed to update md5 stream\n"); + digest.update((unsigned char *) writeresult, bytes); totalbytes += bytes; dataChunkBytes += bytes; @@ -399,7 +393,8 @@ int twrpback::backup(std::string command) { } int twrpback::restore(void) { - twrpDigest adb_md5; + twrpMD5 digest; + char cmd[MAX_ADB_READ]; char result[MAX_ADB_READ]; struct AdbBackupControlType structcmd; int adb_control_twrp_fd, errctr = 0; @@ -591,8 +586,8 @@ int twrpback::restore(void) { struct twfilehdr twimghdr; uint32_t crc, twimghdrcrc; + digest.init(); totalbytes -= sizeof(result); - adb_md5.initMD5(); adblogwrite("Restoring TWIMG\n"); memset(&twimghdr, 0, sizeof(twimghdr)); memcpy(&twimghdr, result, sizeof(result)); @@ -623,9 +618,9 @@ int twrpback::restore(void) { else if (cmdtype == TWFN) { struct twfilehdr twfilehdr; uint32_t crc, twfilehdrcrc; + digest.init(); totalbytes -= sizeof(result); - adb_md5.initMD5(); adblogwrite("Restoring TWFN\n"); memset(&twfilehdr, 0, sizeof(twfilehdr)); memcpy(&twfilehdr, result, sizeof(result)); @@ -703,15 +698,13 @@ int twrpback::restore(void) { close_restore_fds(); return -1; } - adblogwrite("md5 finalize stream\n"); - adb_md5.finalizeMD5stream(); AdbBackupFileTrailer md5; memset(&md5, 0, sizeof(md5)); strncpy(md5.start_of_trailer, TWRP, sizeof(md5.start_of_trailer)); strncpy(md5.type, TWMD5, sizeof(md5.type)); - std::string md5string = adb_md5.createMD5string(); + std::string md5string = digest.return_digest_string(); strncpy(md5.md5, md5string.c_str(), sizeof(md5.md5)); adblogwrite("Sending MD5Check\n"); @@ -726,8 +719,7 @@ int twrpback::restore(void) { break; } } - if (adb_md5.updateMD5stream((unsigned char*)result, sizeof(result)) == -1) - adblogwrite("failed to update md5 stream\n"); + digest.update((unsigned char*)result, sizeof(result)); dataChunkBytes += readbytes; if (write(adb_write_fd, result, sizeof(result)) < 0) { diff --git a/data.cpp b/data.cpp index 20b608918..5d05d2bad 100644 --- a/data.cpp +++ b/data.cpp @@ -679,14 +679,14 @@ void DataManager::SetDefaultValues() mPersist.SetValue(TW_INSTALL_REBOOT_VAR, "0"); mPersist.SetValue(TW_SIGNED_ZIP_VERIFY_VAR, "0"); - mPersist.SetValue(TW_FORCE_MD5_CHECK_VAR, "0"); mPersist.SetValue(TW_DISABLE_FREE_SPACE_VAR, "0"); + mPersist.SetValue(TW_FORCE_DIGEST_CHECK_VAR, "0"); mPersist.SetValue(TW_USE_COMPRESSION_VAR, "0"); mPersist.SetValue(TW_TIME_ZONE_VAR, "CST6CDT,M3.2.0,M11.1.0"); mPersist.SetValue(TW_GUI_SORT_ORDER, "1"); mPersist.SetValue(TW_RM_RF_VAR, "0"); - mPersist.SetValue(TW_SKIP_MD5_CHECK_VAR, "0"); - mPersist.SetValue(TW_SKIP_MD5_GENERATE_VAR, "0"); + mPersist.SetValue(TW_SKIP_DIGEST_CHECK_VAR, "0"); + mPersist.SetValue(TW_SKIP_DIGEST_GENERATE_VAR, "0"); mPersist.SetValue(TW_SDEXT_SIZE, "0"); mPersist.SetValue(TW_SWAP_SIZE, "0"); mPersist.SetValue(TW_SDPART_FILE_SYSTEM, "ext3"); @@ -708,6 +708,14 @@ void DataManager::SetDefaultValues() mData.SetValue("tw_background_thread_running", "0"); mData.SetValue(TW_RESTORE_FILE_DATE, "0"); mPersist.SetValue("tw_military_time", "0"); + +#ifdef TW_INCLUDE_CRYPTO + mConst.SetValue(TW_USE_SHA2, "1"); + mConst.SetValue(TW_NO_SHA2, "0"); +#else + mConst.SetValue(TW_NO_SHA2, "1"); +#endif + #ifdef TW_NO_SCREEN_TIMEOUT mConst.SetValue("tw_screen_timeout_secs", "0"); mConst.SetValue("tw_no_screen_timeout", "1"); diff --git a/digest/md5.c b/digest/md5.c deleted file mode 100644 index 488d16ef6..000000000 --- a/digest/md5.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * This code implements the MD5 message-digest algorithm. - * The algorithm is due to Ron Rivest. This code was - * written by Colin Plumb in 1993, no copyright is claimed. - * This code is in the public domain; do with it what you wish. - * - * Equivalent code is available from RSA Data Security, Inc. - * This code has been tested against that, and is equivalent, - * except that you don't need to include two pages of legalese - * with every copy. - * - * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which - * will fill a supplied 16-byte array with the digest. - */ -#include /* for memcpy() */ - -#include "md5.h" - -#if !defined(WORDS_BIGENDIAN) -#define byteReverse(buf, len) /* Nothing */ -#else -void byteReverse(unsigned char *buf, unsigned longs); - -#ifndef ASM_MD5 -/* - * Note: this code is harmless on little-endian machines. - */ -void byteReverse(unsigned char *buf, unsigned longs) -{ - uint32_t t; - do { - t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | - ((unsigned) buf[1] << 8 | buf[0]); - *(uint32_t *) buf = t; - buf += 4; - } while (--longs); -} -#endif -#endif - -/* - * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious - * initialization constants. - */ -void MD5Init(struct MD5Context *ctx) -{ - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; - - ctx->bits[0] = 0; - ctx->bits[1] = 0; -} - -/* - * Update context to reflect the concatenation of another buffer full - * of bytes. - */ -void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) -{ - uint32_t t; - - /* Update bitcount */ - - t = ctx->bits[0]; - if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) - ctx->bits[1]++; /* Carry from low to high */ - ctx->bits[1] += len >> 29; - - t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ - - /* Handle any leading odd-sized chunks */ - - if (t) { - unsigned char *p = (unsigned char *) ctx->in + t; - - t = 64 - t; - if (len < t) { - memcpy(p, buf, len); - return; - } - memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - buf += t; - len -= t; - } - /* Process data in 64-byte chunks */ - - while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - buf += 64; - len -= 64; - } - - /* Handle any remaining bytes of data. */ - - memcpy(ctx->in, buf, len); -} - -/* - * Final wrapup - pad to 64-byte boundary with the bit pattern - * 1 0* (64-bit count of bits processed, MSB-first) - */ -void MD5Final(unsigned char digest[MD5LENGTH], struct MD5Context *ctx) -{ - unsigned count; - unsigned char *p; - - /* Compute number of bytes mod 64 */ - count = (ctx->bits[0] >> 3) & 0x3F; - - /* Set the first char of padding to 0x80. This is safe since there is - always at least one byte free */ - p = ctx->in + count; - *p++ = 0x80; - - /* Bytes of padding needed to make 64 bytes */ - count = 64 - 1 - count; - - /* Pad out to 56 mod 64 */ - if (count < 8) { - /* Two lots of padding: Pad the first block to 64 bytes */ - memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - - /* Now fill the next block with 56 bytes */ - memset(ctx->in, 0, 56); - } else { - /* Pad block to 56 bytes */ - memset(p, 0, count - 8); - } - byteReverse(ctx->in, 14); - - /* Append length in bits and transform. - * Use memcpy to avoid aliasing problems. On most systems, - * this will be optimized away to the same code. - */ - memcpy(&ctx->in[14 * sizeof(uint32_t)], &ctx->bits[0], 4); - memcpy(&ctx->in[15 * sizeof(uint32_t)], &ctx->bits[1], 4); - - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - byteReverse((unsigned char *) ctx->buf, 4); - memcpy(digest, ctx->buf, MD5LENGTH); - memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ -} - -#ifndef ASM_MD5 - -/* The four core functions - F1 is optimized somewhat */ - -/* #define F1(x, y, z) (x & y | ~x & z) */ -#define F1(x, y, z) (z ^ (x & (y ^ z))) -#define F2(x, y, z) F1(z, x, y) -#define F3(x, y, z) (x ^ y ^ z) -#define F4(x, y, z) (y ^ (x | ~z)) - -/* This is the central step in the MD5 algorithm. */ -#define MD5STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) - -/* - * The core of the MD5 algorithm, this alters an existing MD5 hash to - * reflect the addition of 16 longwords of new data. MD5Update blocks - * the data and converts bytes into longwords for this routine. - */ -void MD5Transform(uint32_t buf[4], uint32_t const in[16]) -{ - register uint32_t a, b, c, d; - - a = buf[0]; - b = buf[1]; - c = buf[2]; - d = buf[3]; - - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; -} - -#endif - diff --git a/digest/md5.h b/digest/md5.h deleted file mode 100644 index cf306881f..000000000 --- a/digest/md5.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef MD5_H -#define MD5_H - -#ifdef HAVE_STDINT_H -#include -#else -typedef unsigned int uint32_t; -#endif - -#define MD5LENGTH 16 - -struct MD5Context { - uint32_t buf[4]; - uint32_t bits[2]; - unsigned char in[64]; -}; - -void MD5Init(struct MD5Context *context); -void MD5Update(struct MD5Context *context, unsigned char const *buf, - unsigned len); -void MD5Final(unsigned char digest[MD5LENGTH], struct MD5Context *context); -void MD5Transform(uint32_t buf[4], uint32_t const in[16]); - -/* - * This is needed to make RSAREF happy on some MS-DOS compilers. - */ -//typedef struct MD5Context MD5_CTX; - -#endif /* !MD5_H */ diff --git a/gui/pages.cpp b/gui/pages.cpp index bf6c6921c..b901526ff 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -52,7 +52,7 @@ extern "C" { #include "blanktimer.hpp" // version 2 requires theme to handle power button as action togglebacklight -#define TW_THEME_VERSION 2 +#define TW_THEME_VERSION 3 #define TW_THEME_VER_ERR -2 diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml index 3039252b2..0b8860e25 100644 --- a/gui/theme/common/landscape.xml +++ b/gui/theme/common/landscape.xml @@ -1676,8 +1676,8 @@ - {@skip_md5_backup_chk=Skip MD5 generation during backup} - + {@skip_digest_backup_chk=Skip Digest generation during backup} + @@ -2272,8 +2272,8 @@ - {@restore_enable_md5_chk=Enable MD5 Verification of Backup Files} - + {@restore_enable_digest_chk=Enable Digest Verification of Backup Files} +