[Dev] Documenting Feathercoin Specific Software settings - Part 12
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch to implement Strict DER signature compliance : - commit
https://github.com/FeatherCoin/Feathercoin/commit/da745ff665342e69e102b09af43c169f502a9caf
src/main.cpp
+ if (!CheckInputs(tx, state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC |SCRIPT_VERIFY_DERSIG))
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch to implement Strict DER signature compliance : - commit
https://github.com/FeatherCoin/Feathercoin/commit/da745ff665342e69e102b09af43c169f502a9caf
src/script.cpp
+// BIP 66 defined signature encoding check. This largely overlaps with +// IsCanonicalSignature above, but lacks hashtype constraints, and uses the +// exact implementation code from BIP 66. +bool static IsValidSignatureEncoding(const std::vector<unsigned char> &sig) { + // Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] [sighash] + // * total-length: 1-byte length descriptor of everything that follows, + // excluding the sighash byte. + // * R-length: 1-byte length descriptor of the R value that follows. + // * R: arbitrary-length big-endian encoded R value. It must use the shortest + // possible encoding for a positive integers (which means no null bytes at + // the start, except a single one when the next byte has its highest bit set). + // * S-length: 1-byte length descriptor of the S value that follows. + // * S: arbitrary-length big-endian encoded S value. The same rules apply. + // * sighash: 1-byte value indicating what data is hashed (not part of the DER + // signature) + + // Minimum and maximum size constraints. + if (sig.size() < 9) return false; + if (sig.size() > 73) return false; + + // A signature is of type 0x30 (compound). + if (sig[0] != 0x30) return false; + + // Make sure the length covers the entire signature. + if (sig[1] != sig.size() - 3) return false; + + // Extract the length of the R element. + unsigned int lenR = sig[3]; + + // Make sure the length of the S element is still inside the signature. + if (5 + lenR >= sig.size()) return false; + + // Extract the length of the S element. + unsigned int lenS = sig[5 + lenR]; + + // Verify that the length of the signature matches the sum of the length + // of the elements. + if ((size_t)(lenR + lenS + 7) != sig.size()) return false; + + // Check whether the R element is an integer. + if (sig[2] != 0x02) return false; + + // Zero-length integers are not allowed for R. + if (lenR == 0) return false; + + // Negative numbers are not allowed for R. + if (sig[4] & 0x80) return false; + + // Null bytes at the start of R are not allowed, unless R would + // otherwise be interpreted as a negative number. + if (lenR > 1 && (sig[4] == 0x00) && !(sig[5] & 0x80)) return false; + + // Check whether the S element is an integer. + if (sig[lenR + 4] != 0x02) return false; + + // Zero-length integers are not allowed for S. + if (lenS == 0) return false; + + // Negative numbers are not allowed for S. + if (sig[lenR + 6] & 0x80) return false; + + // Null bytes at the start of S are not allowed, unless S would otherwise be + // interpreted as a negative number. + if (lenS > 1 && (sig[lenR + 6] == 0x00) && !(sig[lenR + 7] & 0x80)) return false; + + return true; +} + +bool static CheckSignatureEncoding(const valtype &vchSig, unsigned int flags) { + // Empty signature. Not strictly DER encoded, but allowed to provide a + // compact way to provide an invalid signature for use with CHECK(MULTI)SIG + if (vchSig.size() == 0) { + return true; + } + if ((flags & SCRIPT_VERIFY_DERSIG) != 0 && !IsValidSignatureEncoding(vchSig)) { + return false; + } + return true; +} + +
Code added
+ if (!CheckSignatureEncoding(vchSig, flags)) { + return false; + }
Code added
+ + if (!CheckSignatureEncoding(vchSig, flags)) { + return false; + }
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch to implement Strict DER signature compliance : - commit
https://github.com/FeatherCoin/Feathercoin/commit/da745ff665342e69e102b09af43c169f502a9caf
src/script.h
+ SCRIPT_VERIFY_DERSIG = (1U << 5),
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch to implement Strict DER signature compliance : - commit
https://github.com/FeatherCoin/Feathercoin/commit/da745ff665342e69e102b09af43c169f502a9caf
src/test/data/script_invalid.json
Large number Updates to test data
+ -["0x4c 0 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL"] +[ +"0x4c 0 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL"], +
Example of changes
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch to implement Strict DER signature compliance : - commit
https://github.com/FeatherCoin/Feathercoin/commit/da745ff665342e69e102b09af43c169f502a9caf
src/version.cpp
+ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-ftc" commit
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Patch to implement Strict DER signature compliance : - commit
https://github.com/FeatherCoin/Feathercoin/commit/da745ff665342e69e102b09af43c169f502a9caf
src/version.h
+static const int PROTOCOL_VERSION = 70003;
Protocol version number updated
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
update version in bitcoin-config.h : - commit
update version in bitcoin-config.h needs fix as autogen will reverse the change
https://github.com/FeatherCoin/Feathercoin/commit/281ed10b777107db278697c589ee8696d52e1b18
src/bitcoin-config.h
+#define CLIENT_VERSION_REVISION 3.1
Code replaced
+#define HAVE_BOOST_UNIT_TEST_FRAMEWORK /**/
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
version number updated : - commit
https://github.com/FeatherCoin/Feathercoin/commit/a95aa1c0a9a5697a6c898331f234a5f502377c2a
src/bitcoin-config.h
/* Build revision */ - #define CLIENT_VERSION_REVISION 3.1 +#define CLIENT_VERSION_REVISION 3
Code replaced
-#define HAVE_LIBQRENCODE 1 +/* #undef HAVE_LIBQRENCODE */
Code removed
-#define HAVE_LIBZXING 1 +/* #undef HAVE_LIBZXING */
Code removed
+/* #undef USE_DBUS */
Code removed
+/* #undef USE_ZXING */
Code removed commented out
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
git version number update only commit
https://github.com/FeatherCoin/Feathercoin/commit/57c6023f60e0abe4cbd1e494112053471a3153c9
+define(_CLIENT_VERSION_BUILD, 1)
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
gitignore allows compile time files to be ignored by the change control system
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
.gitignore
-Makefile.in -aclocal.m4
Code removed
-share/setup.nsi -share/qt/Info.plist
Code removed
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
New file, 1021 lines of code
+# Makefile.in generated by automake 1.13.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@
Start of code, is this needed? it is auto generated? review
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
aclocal.m4
+# generated automatically by aclocal 1.13.4 -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE.
Start of auto generated file, 1090 lines of code, review?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
m4/ax_boost_base.m4
+# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# DESCRIPTION +# +# Test for the Boost C++ libraries of a particular version (or newer) +# +# If no path to the installed boost library is given the macro searchs +# under /usr, /usr/local, /opt and /opt/local and evaluates the +# $BOOST_ROOT environment variable. Further documentation is available at +# <http://randspringer.de/boost/index.html>. +# +# This macro calls: +# +# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) +# +# And sets: +# +# HAVE_BOOST +# +# LICENSE
Start of autogenerated code 119 lines of code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
m4/ax_boost_filesystem.m4
+# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_FILESYSTEM +# +# DESCRIPTION +# +# Test for Filesystem library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. Further documentation is +# available at <http://randspringer.de/boost/index.html>. +# +# This macro calls: +# +# AC_SUBST(BOOST_FILESYSTEM_LIB) +# +# And sets: +# +# HAVE_BOOST_FILESYSTEM
Start of autogenerated code, 119 lines, review?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
m4/ax_boost_program_options.m4
m4/ax_boost_thread.m4
m4/ax_boost_unit_test_framework.m4
m4/ax_check_compile_flag.m4
m4/ax_check_link_flag.m4
m4/ax_check_preproc_flag.m4
m4/ax_pthread.m4
m4/bitcoin_find_bdb48.m4
m4/bitcoin_find_bdb51.m4
m4/bitcoin_qt.m4
m4/bitcoin_subdir_to_include.m4
share/qt/Info.plist
Autogenerated?
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
share/qt/Info.plist
New file 97 lines of code.
+<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>LSMinimumSystemVersion</key> + <string>10.6.0</string> + + <key>LSArchitecturePriority</key> + <array> + <string>x86_64</string> + </array> + + <key>CFBundleIconFile</key> + <string>bitcoin.icns</string> + + <key>CFBundlePackageType</key> + <string>APPL</string> + + <key>CFBundleGetInfoString</key> + <string>0.9, Copyright © 2009-2014 The Bitcoin Core developers</string> + + <key>CFBundleShortVersionString</key> + <string>0.9</string>
Start of new layout code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
share/setup.nsi
+Name "Feathercoin Core (-bit)" + +RequestExecutionLevel highest +SetCompressor /SOLID lzma + +# General Symbol Definitions +!define REGKEY "SOFTWARE\$(^Name)" +!define VERSION 0.9.3 +!define COMPANY "Bitcoin Core project" +!define URL http://www.bitcoin.org/ + +# MUI Symbol Definitions +!define MUI_ICON "/home/wolfgang/workspace/Feathercoin/share/pixmaps/bitcoin.ico" +!define MUI_WELCOMEFINISHPAGE_BITMAP "/home/wolfgang/workspace/Feathercoin/share/pixmaps/nsis-wizard.bmp" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_RIGHT +!define MUI_HEADERIMAGE_BITMAP "/home/wolfgang/workspace/Feathercoin/share/pixmaps/nsis-header.bmp" +!define MUI_FINISHPAGE_NOAUTOCLOSE +!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM +!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY} +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Feathercoin Core" +!define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin-qt.exe +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "/home/wolfgang/workspace/Feathercoin/share/pixmaps/nsis-wizard.bmp" +!define MUI_UNFINISHPAGE_NOAUTOCLOSE + +# Included files +!include Sections.nsh +!include MUI2.nsh +!if "" == "64" +!include x64.nsh +!endif + +# Variables +Var StartMenuGroup + +# Installer pages +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +# Installer languages +!insertmacro MUI_LANGUAGE English + +# Installer attributes +OutFile /home/wolfgang/workspace/Feathercoin/bitcoin-${VERSION}-win-setup.exe +!if "" == "64" +InstallDir $PROGRAMFILES64\Bitcoin +!else +InstallDir $PROGRAMFILES\Bitcoin +!endif +CRCCheck on +XPStyle on +BrandingText " " +ShowInstDetails show +VIProductVersion ${VERSION}.1 +VIAddVersionKey ProductName "Bitcoin Core" +VIAddVersionKey ProductVersion "${VERSION}" +VIAddVersionKey CompanyName "${COMPANY}" +VIAddVersionKey CompanyWebsite "${URL}" +VIAddVersionKey FileVersion "${VERSION}" +VIAddVersionKey FileDescription "" +VIAddVersionKey LegalCopyright "" +InstallDirRegKey HKCU "${REGKEY}" Path +ShowUninstDetails show + +# Installer sections +Section -Main SEC0000 + SetOutPath $INSTDIR + SetOverwrite on + File /home/wolfgang/workspace/Feathercoin/release/bitcoin-qt.exe + File /oname=COPYING.txt /home/wolfgang/workspace/Feathercoin/COPYING + File /oname=readme.txt /home/wolfgang/workspace/Feathercoin/doc/README_windows.txt + SetOutPath $INSTDIR\daemon + File /home/wolfgang/workspace/Feathercoin/release/bitcoind.exe + File /home/wolfgang/workspace/Feathercoin/release/bitcoin-cli.exe + SetOutPath $INSTDIR\doc + File /r /home/wolfgang/workspace/Feathercoin/doc\*.* + SetOutPath $INSTDIR + WriteRegStr HKCU "${REGKEY}\Components" Main 1 + + # Remove old wxwidgets-based-bitcoin executable and locales: + Delete /REBOOTOK $INSTDIR\bitcoin.exe + RMDir /r /REBOOTOK $INSTDIR\locale +SectionEnd + +Section -post SEC0001 + WriteRegStr HKCU "${REGKEY}" Path $INSTDIR + SetOutPath $INSTDIR + WriteUninstaller $INSTDIR\uninstall.exe + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory $SMPROGRAMS\$StartMenuGroup + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\bitcoin-qt.exe + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe + !insertmacro MUI_STARTMENU_WRITE_END + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe + WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1 + WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1 + WriteRegStr HKCR "bitcoin" "URL Protocol" "" + WriteRegStr HKCR "bitcoin" "" "URL:Bitcoin" + WriteRegStr HKCR "bitcoin\DefaultIcon" "" $INSTDIR\bitcoin-qt.exe + WriteRegStr HKCR "bitcoin\shell\open\command" "" '"$INSTDIR\bitcoin-qt.exe" "%1"' +SectionEnd + +# Macro for selecting uninstaller sections +!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID + Push $R0 + ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}" + StrCmp $R0 1 0 next${UNSECTION_ID} + !insertmacro SelectSection "${UNSECTION_ID}" + GoTo done${UNSECTION_ID} +next${UNSECTION_ID}: + !insertmacro UnselectSection "${UNSECTION_ID}" +done${UNSECTION_ID}: + Pop $R0 +!macroend + +# Uninstaller sections +Section /o -un.Main UNSEC0000 + Delete /REBOOTOK $INSTDIR\bitcoin-qt.exe + Delete /REBOOTOK $INSTDIR\COPYING.txt + Delete /REBOOTOK $INSTDIR\readme.txt + RMDir /r /REBOOTOK $INSTDIR\daemon + RMDir /r /REBOOTOK $INSTDIR\doc + DeleteRegValue HKCU "${REGKEY}\Components" Main +SectionEnd + +Section -un.post UNSEC0001 + DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" + Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk" + Delete /REBOOTOK $INSTDIR\uninstall.exe + Delete /REBOOTOK $INSTDIR\debug.log + Delete /REBOOTOK $INSTDIR\db.log + DeleteRegValue HKCU "${REGKEY}" StartMenuGroup + DeleteRegValue HKCU "${REGKEY}" Path + DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components" + DeleteRegKey /IfEmpty HKCU "${REGKEY}" + DeleteRegKey HKCR "bitcoin" + RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup + RmDir /REBOOTOK $INSTDIR + Push $R0 + StrCpy $R0 $StartMenuGroup 1 + StrCmp $R0 ">" no_smgroup +no_smgroup: + Pop $R0 +SectionEnd + +# Installer functions +Function .onInit + InitPluginsDir +!if "" == "64" + ${If} ${RunningX64} + ; disable registry redirection (enable access to 64-bit portion of registry) + SetRegView 64 + ${Else} + MessageBox MB_OK|MB_ICONSTOP "Cannot install 64-bit version on a 32-bit system." + Abort + ${EndIf} +!endif +FunctionEnd + +# Uninstaller functions +Function un.onInit + ReadRegStr $INSTDIR HKCU "${REGKEY}" Path + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup + !insertmacro SELECT_UNSECTION Main ${UNSEC0000} +FunctionEnd
New file 189 lines of code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
src/Makefile.in
Autogenerated file? review
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
src/bitcoin-config.h
-#define CLIENT_VERSION_BUILD 0 +#define CLIENT_VERSION_BUILD 1
Code replaced
-#define HAVE_BOOST_UNIT_TEST_FRAMEWORK /**/ +/* #undef HAVE_BOOST_UNIT_TEST_FRAMEWORK */
code removed commented out
+#define HAVE_LIBQRENCODE 1
Code uncommented
-/* #undef HAVE_LIBZXING */ +#define HAVE_LIBZXING 1 +#define USE_DBUS 1 +#define USE_QRCODE 1 +#define USE_ZXING 1
Code uncommented
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Cleaned needed files commit
https://github.com/FeatherCoin/Feathercoin/commit/fb1146b4e5a71e90c6867ff049d81bc21471d076
src/bitcoin-config.h.in
Autogenerated review?