├── carrier ├── Android ├── libssl.so ├── libcrypto.so ├── libusb1.0.so ├── res │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-ldpi │ │ └── icon.png │ └── drawable-mdpi │ │ └── icon.png ├── include │ └── openssl │ │ ├── ebcdic.h │ │ ├── comp.h │ │ ├── modes.h │ │ ├── pem2.h │ │ ├── ui_compat.h │ │ ├── pqueue.h │ │ ├── ssl23.h │ │ ├── rc4.h │ │ ├── opensslv.h │ │ ├── conf_api.h │ │ ├── ripemd.h │ │ ├── rc2.h │ │ ├── stack.h │ │ ├── hmac.h │ │ ├── txt_db.h │ │ ├── md4.h │ │ ├── md5.h │ │ ├── ecdh.h │ │ └── buffer.h └── AndroidManifest.xml ├── assets ├── sachesi.icns ├── sachesi.ico └── sachesi.png ├── qml └── generic │ ├── Thumbs.db │ ├── text.png │ ├── trash.png │ ├── showpass.png │ ├── UI │ ├── qmldir │ ├── TextCoupleSelect.qml │ ├── TextCouple.qml │ └── CircleProgress.qml │ ├── Device.qml │ ├── Downloader.qml │ ├── Boot.qml │ ├── USBConnect.qml │ └── Title.qml ├── translations.qrc ├── ext ├── zlib-win │ ├── inffast.h │ ├── gzclose.c │ ├── uncompr.c │ ├── compress.c │ └── inftrees.h └── quazip │ ├── quazip.pri │ ├── quacrc32.cpp │ ├── quacrc32.h │ ├── quaadler32.cpp │ ├── quaadler32.h │ ├── quazip_global.h │ ├── quachecksum32.h │ ├── quaziodevice.h │ ├── quagzipfile.h │ ├── quagzipfile.cpp │ └── crypt.h ├── QML.qrc ├── src ├── lzo.h ├── blitzinfo.h ├── fs │ ├── ifs.h │ ├── rcfs.h │ ├── qnx6.h │ ├── fs.h │ └── fs.cpp ├── search │ ├── discoveredrelease.h │ └── scanner.h ├── translator.h ├── apps.cpp ├── blitzinfo.cpp ├── installer_auth.cpp ├── installer_establish.cpp ├── autoloaderwriter.h ├── backupinfo.h ├── apps.h ├── deviceinfo.h ├── carrierinfo.h └── ports.h ├── UI.qrc ├── .gitignore ├── README.md └── Sachesi.pro /carrier: -------------------------------------------------------------------------------- 1 | 310 2 | 200 3 | 0 4 | 10.3.2.2789 5 | 10 6 | -------------------------------------------------------------------------------- /Android/libssl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/Android/libssl.so -------------------------------------------------------------------------------- /assets/sachesi.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/assets/sachesi.icns -------------------------------------------------------------------------------- /assets/sachesi.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/assets/sachesi.ico -------------------------------------------------------------------------------- /assets/sachesi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/assets/sachesi.png -------------------------------------------------------------------------------- /Android/libcrypto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/Android/libcrypto.so -------------------------------------------------------------------------------- /Android/libusb1.0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/Android/libusb1.0.so -------------------------------------------------------------------------------- /qml/generic/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/qml/generic/Thumbs.db -------------------------------------------------------------------------------- /qml/generic/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/qml/generic/text.png -------------------------------------------------------------------------------- /qml/generic/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/qml/generic/trash.png -------------------------------------------------------------------------------- /qml/generic/showpass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/qml/generic/showpass.png -------------------------------------------------------------------------------- /Android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/Android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /Android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/Android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /Android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsacha/Sachesi/HEAD/Android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /qml/generic/UI/qmldir: -------------------------------------------------------------------------------- 1 | Config 1.0 Config.qml 2 | TextCouple 1.0 TextCouple.qml 3 | TextCoupleSelect 1.0 TextCoupleSelect.qml 4 | TitleObject 1.0 TitleObject.qml 5 | -------------------------------------------------------------------------------- /translations.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | translations/English.ts 4 | translations/Russian.ts 5 | translations/French.ts 6 | translations/Spanish.ts 7 | translations/German.ts 8 | translations/Dutch.ts 9 | translations/Chinese.ts 10 | 11 | 12 | -------------------------------------------------------------------------------- /ext/zlib-win/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /Android/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | #define HEADER_EBCDIC_H 5 | 6 | #include 7 | 8 | /* Avoid name clashes with other applications */ 9 | #define os_toascii _openssl_os_toascii 10 | #define os_toebcdic _openssl_os_toebcdic 11 | #define ebcdic2ascii _openssl_ebcdic2ascii 12 | #define ascii2ebcdic _openssl_ascii2ebcdic 13 | 14 | extern const unsigned char os_toascii[256]; 15 | extern const unsigned char os_toebcdic[256]; 16 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 17 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /QML.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | C:\Qt54\5.4\mingw491_32\qml\Qt\labs\settings\qmldir 4 | C:\Qt54\5.4\mingw491_32\qml\QtQuick\Controls\qmldir 5 | C:\Qt54\5.4\mingw491_32\qml\QtQuick\Dialogs\qmldir 6 | C:\Qt54\5.4\mingw491_32\qml\QtQuick\Layouts\qmldir 7 | C:\Qt54\5.4\mingw491_32\qml\QtQuick\Window.2\qmldir 8 | C:\Qt54\5.4\mingw491_32\qml\QtQuick.2\qmldir 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/lzo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len, void* wrkmem /* NOT USED */); 4 | 5 | #define M2_MAX_OFFSET 0x0800 6 | 7 | #define LZO_E_OK 0 8 | #define LZO_E_ERROR (-1) 9 | #define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */ 10 | #define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ 11 | #define LZO_E_INPUT_OVERRUN (-4) 12 | #define LZO_E_OUTPUT_OVERRUN (-5) 13 | #define LZO_E_LOOKBEHIND_OVERRUN (-6) 14 | #define LZO_E_EOF_NOT_FOUND (-7) 15 | #define LZO_E_INPUT_NOT_CONSUMED (-8) 16 | #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ 17 | -------------------------------------------------------------------------------- /ext/zlib-win/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /qml/generic/Device.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.2 2 | import QtQuick.Controls 1.1 3 | 4 | 5 | Item { 6 | id: main 7 | TabView { 8 | id: deviceSubTabs 9 | anchors.fill: parent 10 | frameVisible: count > 1 11 | tabsVisible: count > 1 12 | 13 | // Placeholder. Todo: Add and Remove on wifi device from C++ Signal. 14 | // Somehow get the ip in the title too. 15 | //Component.onCompleted: deviceSubTabs.addTab(qsTr("Wifi"), deviceSubComponent ) 16 | 17 | // Permanent tab 18 | Tab { 19 | title: qsTr("USB") + translator.lang + ((i.device === null || i.device.battery < 0) ? (" [" + i.ip + "]") : "") 20 | DeviceSub { anchors.fill: parent } 21 | } 22 | } 23 | Component { 24 | id: deviceSubComponent 25 | DeviceSub { anchors.fill: parent } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/blitzinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef BLITZINFO_H 2 | #define BLITZINFO_H 3 | 4 | #include 5 | 6 | enum BarType { 7 | NotInstallableType = 0, 8 | AppType, 9 | RadioType, 10 | OSType, 11 | }; 12 | 13 | // Blitz means it has more than one OS or Radio. 14 | // In this situation we need to work out which one is intended instead of asking about every single one. 15 | // If there is only one good OS and Radio, the intention is clear. 16 | class BlitzInfo: public QObject { 17 | Q_OBJECT 18 | public: 19 | BlitzInfo(QList filenames, QString deviceOS, QString deviceRadio); 20 | void blitzCheck(QString name); 21 | bool isSafe() { return (osIsSafe && radioIsSafe); } 22 | bool isBlitz() { return (osCount > 1 || radioCount > 1); } 23 | bool osIsSafe, radioIsSafe; 24 | int radioCount, osCount; 25 | private: 26 | QString _deviceOS, _deviceRadio; 27 | }; 28 | 29 | #endif // BLITZINFO_H 30 | -------------------------------------------------------------------------------- /UI.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | qml/generic/Search.qml 4 | qml/generic/UI/CircleProgress.qml 5 | qml/generic/UI/TextCouple.qml 6 | qml/generic/UI/TextCoupleSelect.qml 7 | qml/generic/Title.qml 8 | qml/generic/USBConnect.qml 9 | qml/generic/Installer.qml 10 | qml/generic/Backup.qml 11 | qml/generic/Downloader.qml 12 | qml/generic/Boot.qml 13 | qml/generic/Extract.qml 14 | qml/generic/VersionLookup.qml 15 | qml/generic/showpass.png 16 | qml/generic/text.png 17 | qml/generic/trash.png 18 | qml/generic/Device.qml 19 | qml/generic/DeviceSub.qml 20 | 21 | 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Compiled Dynamic libraries 8 | *.so 9 | *.dylib 10 | *.dll 11 | 12 | # Compiled Static libraries 13 | *.lai 14 | *.la 15 | *.a 16 | *.lib 17 | 18 | # Executables 19 | *.exe 20 | *.out 21 | *.app 22 | *.bar 23 | 24 | # Qt 25 | *.user 26 | *.qm 27 | 28 | # Compiler Stuff 29 | /Makefile 30 | /Sachesi 31 | /moc_apps.cpp 32 | /moc_apps.cpp 33 | /moc_autoloaderwriter.cpp 34 | /moc_backupinfo.cpp 35 | /moc_blitzinfo.cpp 36 | /moc_boot.cpp 37 | /moc_carrierinfo.cpp 38 | /moc_deviceinfo.cpp 39 | /moc_discoveredrelease.cpp 40 | /moc_downloadinfo.cpp 41 | /moc_fs.cpp 42 | /moc_ifs.cpp 43 | /moc_installer.cpp 44 | /moc_mainnet.cpp 45 | /moc_qnx6.cpp 46 | /moc_quagzipfile.cpp 47 | /moc_quaziodevice.cpp 48 | /moc_quazipfile.cpp 49 | /moc_rcfs.cpp 50 | /moc_scanner.cpp 51 | /moc_splitter.cpp 52 | /moc_translator.cpp 53 | /qrc_UI.cpp 54 | /qrc_translations.cpp 55 | 56 | 57 | -------------------------------------------------------------------------------- /ext/quazip/quazip.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | DEPENDPATH += $$PWD 3 | HEADERS += \ 4 | $$PWD/crypt.h \ 5 | $$PWD/ioapi.h \ 6 | $$PWD/JlCompress.h \ 7 | $$PWD/quaadler32.h \ 8 | $$PWD/quachecksum32.h \ 9 | $$PWD/quacrc32.h \ 10 | $$PWD/quagzipfile.h \ 11 | $$PWD/quaziodevice.h \ 12 | $$PWD/quazipdir.h \ 13 | $$PWD/quazipfile.h \ 14 | $$PWD/quazipfileinfo.h \ 15 | $$PWD/quazip_global.h \ 16 | $$PWD/quazip.h \ 17 | $$PWD/quazipnewinfo.h \ 18 | $$PWD/unzip.h \ 19 | $$PWD/zip.h 20 | 21 | SOURCES += $$PWD/qioapi.cpp \ 22 | $$PWD/JlCompress.cpp \ 23 | $$PWD/quaadler32.cpp \ 24 | $$PWD/quacrc32.cpp \ 25 | $$PWD/quagzipfile.cpp \ 26 | $$PWD/quaziodevice.cpp \ 27 | $$PWD/quazip.cpp \ 28 | $$PWD/quazipdir.cpp \ 29 | $$PWD/quazipfile.cpp \ 30 | $$PWD/quazipfileinfo.cpp \ 31 | $$PWD/quazipnewinfo.cpp \ 32 | $$PWD/unzip.c \ 33 | $$PWD/zip.c 34 | -------------------------------------------------------------------------------- /qml/generic/UI/TextCoupleSelect.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.2 2 | import QtQuick.Controls 1.1 3 | import QtQuick.Layouts 1.1 4 | 5 | Item { 6 | id: comboBox 7 | property string type 8 | property string initialText 9 | property alias text: comboButton.currentText 10 | property alias subtext: subtextValue.text 11 | property alias listModel: comboButton.model 12 | property alias selectedItem: comboButton.currentIndex 13 | 14 | // Evil: hardcoded width/height 15 | height: (16.5) * 1.5 16 | width: (16.5) * 15 17 | ColumnLayout { 18 | RowLayout { 19 | id: topRow 20 | Layout.fillWidth: true 21 | Label { 22 | id: typeText 23 | text: type 24 | font.bold: true 25 | } 26 | ComboBox { 27 | id: comboButton 28 | currentIndex: selectedItem 29 | anchors { left: parent.left; leftMargin: comboBox.width / 2 - 10} 30 | } 31 | } 32 | Label { 33 | id: subtextValue 34 | anchors {left: parent.left; leftMargin: 10; top: parent.top; topMargin: topRow.implicitHeight - 2} 35 | text: "" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ext/quazip/quacrc32.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2005-2014 Sergey A. Tachenov 3 | 4 | This file is part of QuaZIP. 5 | 6 | QuaZIP is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2.1 of the License, or 9 | (at your option) any later version. 10 | 11 | QuaZIP is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with QuaZIP. If not, see . 18 | 19 | See COPYING file for the full LGPL text. 20 | 21 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 22 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 23 | */ 24 | 25 | #include "quacrc32.h" 26 | 27 | #include "zlib.h" 28 | 29 | QuaCrc32::QuaCrc32() 30 | { 31 | reset(); 32 | } 33 | 34 | quint32 QuaCrc32::calculate(const QByteArray &data) 35 | { 36 | return crc32( crc32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() ); 37 | } 38 | 39 | void QuaCrc32::reset() 40 | { 41 | checksum = crc32(0L, Z_NULL, 0); 42 | } 43 | 44 | void QuaCrc32::update(const QByteArray &buf) 45 | { 46 | checksum = crc32( checksum, (const Bytef*)buf.data(), buf.size() ); 47 | } 48 | 49 | quint32 QuaCrc32::value() 50 | { 51 | return checksum; 52 | } 53 | -------------------------------------------------------------------------------- /src/fs/ifs.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | 20 | #include "fs.h" 21 | 22 | namespace FS { 23 | 24 | struct binode { 25 | int mode; 26 | QString name; 27 | int offset; 28 | // TODO: Sizes greater than 16-bit? 29 | qint16 size; 30 | int time; 31 | QString path_to; 32 | int chunks; 33 | }; 34 | 35 | class IFS : public QFileSystem 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit IFS(QString filename, QIODevice* file, qint64 offset, qint64 size, QString path) 41 | : QFileSystem(filename, file, offset, size, path, ".ifs") {} 42 | 43 | binode createBNode(int offset, qint64 startPos); 44 | QString generateName(QString imageExt = ""); 45 | void extractDir(int offset, int numNodes, QString basedir, qint64 startPos); 46 | bool createContents(); 47 | 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /ext/quazip/quacrc32.h: -------------------------------------------------------------------------------- 1 | #ifndef QUACRC32_H 2 | #define QUACRC32_H 3 | 4 | /* 5 | Copyright (C) 2005-2014 Sergey A. Tachenov 6 | 7 | This file is part of QuaZIP. 8 | 9 | QuaZIP is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 2.1 of the License, or 12 | (at your option) any later version. 13 | 14 | QuaZIP is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with QuaZIP. If not, see . 21 | 22 | See COPYING file for the full LGPL text. 23 | 24 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 25 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 26 | */ 27 | 28 | #include "quachecksum32.h" 29 | 30 | ///CRC32 checksum 31 | /** \class QuaCrc32 quacrc32.h 32 | * This class wrappers the crc32 function with the QuaChecksum32 interface. 33 | * See QuaChecksum32 for more info. 34 | */ 35 | class QUAZIP_EXPORT QuaCrc32 : public QuaChecksum32 { 36 | 37 | public: 38 | QuaCrc32(); 39 | 40 | quint32 calculate(const QByteArray &data); 41 | 42 | void reset(); 43 | void update(const QByteArray &buf); 44 | quint32 value(); 45 | 46 | private: 47 | quint32 checksum; 48 | }; 49 | 50 | #endif //QUACRC32_H 51 | -------------------------------------------------------------------------------- /src/fs/rcfs.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | 20 | #include "fs.h" 21 | 22 | namespace FS { 23 | 24 | struct rinode { 25 | int mode; 26 | QString name; 27 | int nameoffset; 28 | int offset; 29 | int size; 30 | int time; 31 | QString path_to; 32 | int chunks; 33 | }; 34 | 35 | class RCFS : public QFileSystem 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit RCFS(QString filename, QIODevice* file, qint64 offset, qint64 size, QString path) 41 | : QFileSystem(filename, file, offset, size, path, ".rcfs") {} 42 | 43 | rinode createNode(int offset); 44 | QString generateName(QString imageExt = ""); 45 | QByteArray extractFile(qint64 node_offset, int node_size, int node_mode); 46 | void extractDir(int offset, int numNodes, QString basedir, qint64 startPos); 47 | 48 | bool createContents(); 49 | 50 | }; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /ext/quazip/quaadler32.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Adam Walczak 3 | Copyright (C) 2005-2014 Sergey A. Tachenov 4 | 5 | This file is part of QuaZIP. 6 | 7 | QuaZIP is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU Lesser General Public License as published by 9 | the Free Software Foundation, either version 2.1 of the License, or 10 | (at your option) any later version. 11 | 12 | QuaZIP is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public License 18 | along with QuaZIP. If not, see . 19 | 20 | See COPYING file for the full LGPL text. 21 | 22 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 23 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 24 | */ 25 | 26 | #include "quaadler32.h" 27 | 28 | #include "zlib.h" 29 | 30 | QuaAdler32::QuaAdler32() 31 | { 32 | reset(); 33 | } 34 | 35 | quint32 QuaAdler32::calculate(const QByteArray &data) 36 | { 37 | return adler32( adler32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() ); 38 | } 39 | 40 | void QuaAdler32::reset() 41 | { 42 | checksum = adler32(0L, Z_NULL, 0); 43 | } 44 | 45 | void QuaAdler32::update(const QByteArray &buf) 46 | { 47 | checksum = adler32( checksum, (const Bytef*)buf.data(), buf.size() ); 48 | } 49 | 50 | quint32 QuaAdler32::value() 51 | { 52 | return checksum; 53 | } 54 | -------------------------------------------------------------------------------- /ext/quazip/quaadler32.h: -------------------------------------------------------------------------------- 1 | #ifndef QUAADLER32_H 2 | #define QUAADLER32_H 3 | 4 | /* 5 | Copyright (C) 2010 Adam Walczak 6 | Copyright (C) 2005-2014 Sergey A. Tachenov 7 | 8 | This file is part of QuaZIP. 9 | 10 | QuaZIP is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published by 12 | the Free Software Foundation, either version 2.1 of the License, or 13 | (at your option) any later version. 14 | 15 | QuaZIP is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with QuaZIP. If not, see . 22 | 23 | See COPYING file for the full LGPL text. 24 | 25 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 26 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 27 | */ 28 | 29 | #include 30 | 31 | #include "quachecksum32.h" 32 | 33 | /// Adler32 checksum 34 | /** \class QuaAdler32 quaadler32.h 35 | * This class wrappers the adler32 function with the QuaChecksum32 interface. 36 | * See QuaChecksum32 for more info. 37 | */ 38 | class QUAZIP_EXPORT QuaAdler32 : public QuaChecksum32 39 | { 40 | 41 | public: 42 | QuaAdler32(); 43 | 44 | quint32 calculate(const QByteArray &data); 45 | 46 | void reset(); 47 | void update(const QByteArray &buf); 48 | quint32 value(); 49 | 50 | private: 51 | quint32 checksum; 52 | }; 53 | 54 | #endif //QUAADLER32_H 55 | -------------------------------------------------------------------------------- /src/search/discoveredrelease.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | class DiscoveredRelease : public QObject { 6 | Q_OBJECT 7 | Q_PROPERTY(QString osVersion READ osVersion WRITE setOsVersion NOTIFY osVersionChanged) 8 | Q_PROPERTY(QString srVersion READ srVersion WRITE setSrVersion NOTIFY srVersionChanged) 9 | Q_PROPERTY(int activeServers READ activeServers NOTIFY activeServersChanged) 10 | Q_PROPERTY(QString baseUrl READ baseUrl WRITE setBaseUrl NOTIFY baseUrlChanged) 11 | public: 12 | DiscoveredRelease() : QObject(), _activeServers(0) { } 13 | DiscoveredRelease(const DiscoveredRelease& release) 14 | : QObject() 15 | , _osVersion(release.osVersion()) 16 | , _srVersion(release.srVersion()) 17 | , _activeServers(release.activeServers()) {} 18 | 19 | QString osVersion() const { return _osVersion; } 20 | QString srVersion() const { return _srVersion; } 21 | int activeServers() const { return _activeServers; } 22 | QString baseUrl() const { return _baseUrl; } 23 | void setOsVersion(QString osVersion) { _osVersion = osVersion; emit osVersionChanged(); } 24 | void setSrVersion(QString srVersion) { _srVersion = srVersion; emit srVersionChanged(); } 25 | void setActiveServers(int activeServers) { _activeServers |= activeServers; emit activeServersChanged(); } 26 | void setBaseUrl(QString baseUrl) { _baseUrl = baseUrl; emit baseUrlChanged(); } 27 | 28 | signals: 29 | void osVersionChanged(); 30 | void srVersionChanged(); 31 | void activeServersChanged(); 32 | void baseUrlChanged(); 33 | 34 | private: 35 | QString _osVersion; 36 | QString _srVersion; 37 | int _activeServers; 38 | QString _baseUrl; 39 | }; 40 | Q_DECLARE_METATYPE(DiscoveredRelease* ); 41 | -------------------------------------------------------------------------------- /qml/generic/Downloader.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.2 2 | import QtQuick.Controls 1.1 3 | import "UI" 1.0 4 | 5 | // This page is hidden for now as it is not very useful. 6 | 7 | TabView { 8 | id: main 9 | Column { 10 | anchors {left: parent.left; leftMargin: 20; top: parent.top; topMargin: 20 } 11 | spacing: 20 12 | 13 | /* 14 | Text { 15 | text: qsTr("#1. Change PIN (Requires OS10.2)") + translator.lang 16 | font.pointSize: 12 17 | } 18 | Column { 19 | spacing: 20 20 | Button { 21 | text: qsTr("Sign NVRAM") + translator.lang 22 | enabled: i.completed 23 | onClicked: i.resignNVRAM(); 24 | } 25 | Text { 26 | x: 10 27 | text: qsTr("Current PIN %1").arg(i.knownPIN) + translator.lang 28 | font.pointSize: 10 29 | } 30 | Row { 31 | spacing: 20 32 | TextCouple { 33 | id: repin 34 | type: qsTr("New PIN") + translator.lang 35 | value: "2CCC0000" 36 | } 37 | Button { 38 | text: qsTr("Reassign") + translator.lang 39 | enabled: i.completed 40 | onClicked: i.newPin(repin.value); 41 | } 42 | } 43 | }*/ 44 | Text { 45 | text: qsTr("#1. Start RTAS (Requires OS10.2)") + translator.lang 46 | font.pointSize: 12 47 | } 48 | Button { 49 | text: qsTr("Start RTAS") + translator.lang 50 | enabled: i.completed 51 | onClicked: i.startRTAS(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ext/quazip/quazip_global.h: -------------------------------------------------------------------------------- 1 | #ifndef QUAZIP_GLOBAL_H 2 | #define QUAZIP_GLOBAL_H 3 | 4 | /* 5 | Copyright (C) 2005-2014 Sergey A. Tachenov 6 | 7 | This file is part of QuaZIP. 8 | 9 | QuaZIP is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 2.1 of the License, or 12 | (at your option) any later version. 13 | 14 | QuaZIP is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with QuaZIP. If not, see . 21 | 22 | See COPYING file for the full LGPL text. 23 | 24 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 25 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 26 | */ 27 | 28 | #include 29 | 30 | /** 31 | This is automatically defined when building a static library, but when 32 | including QuaZip sources directly into a project, QUAZIP_STATIC should 33 | be defined explicitly to avoid possible troubles with unnecessary 34 | importing/exporting. 35 | */ 36 | #ifdef QUAZIP_STATIC 37 | #define QUAZIP_EXPORT 38 | #else 39 | /** 40 | * When building a DLL with MSVC, QUAZIP_BUILD must be defined. 41 | * qglobal.h takes care of defining Q_DECL_* correctly for msvc/gcc. 42 | */ 43 | #if defined(QUAZIP_BUILD) 44 | #define QUAZIP_EXPORT Q_DECL_EXPORT 45 | #else 46 | #define QUAZIP_EXPORT Q_DECL_IMPORT 47 | #endif 48 | #endif // QUAZIP_STATIC 49 | 50 | #ifdef __GNUC__ 51 | #define QUAZIP_UNUSED __attribute__((__unused__)) 52 | #else 53 | #define QUAZIP_UNUSED 54 | #endif 55 | 56 | #define QUAZIP_EXTRA_NTFS_MAGIC 0x000Au 57 | #define QUAZIP_EXTRA_NTFS_TIME_MAGIC 0x0001u 58 | 59 | #endif // QUAZIP_GLOBAL_H 60 | -------------------------------------------------------------------------------- /qml/generic/UI/TextCouple.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.2 2 | import QtQuick.Controls 1.1 3 | import QtQuick.Layouts 1.1 4 | 5 | Item { 6 | id: itemroot 7 | property string type 8 | property alias value: textValue.text 9 | property alias subtext: subtextValue.text 10 | property alias thisid: textValue 11 | property alias textColor: textValue.textColor 12 | property alias restrictions: textValue.inputMethodHints 13 | property alias maxLength: textValue.maximumLength 14 | property string helpLink 15 | signal clicked(); 16 | // Evil: hardcoded width/height 17 | height: (16.5) * 1.5 18 | width: (16.5) * 15 19 | ColumnLayout { 20 | RowLayout { 21 | id: topRow 22 | Layout.fillWidth: true 23 | Label { 24 | text: type 25 | font.bold: true 26 | Rectangle { 27 | visible: helpLink.length > 0 28 | color: "#AAAAAA" 29 | anchors { left: parent.right; leftMargin: 5 } 30 | width: childrenRect.width 31 | height: childrenRect.height 32 | radius: 4 33 | Label { 34 | text: "?" 35 | font.bold: true 36 | font.pointSize: 12 37 | MouseArea { 38 | anchors.fill: parent 39 | onClicked: Qt.openUrlExternally(helpLink); 40 | } 41 | } 42 | } 43 | } 44 | TextField { 45 | id: textValue 46 | anchors {left: parent.left; leftMargin: itemroot.width / 2 - 10} 47 | text: value 48 | onAccepted: itemroot.clicked() 49 | } 50 | } 51 | Label { 52 | id: subtextValue 53 | anchors {left: parent.left; leftMargin: 10; top: parent.top; topMargin: topRow.implicitHeight - 2 } 54 | text: "" 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/translator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | class Translator : public QObject { 24 | Q_OBJECT 25 | 26 | Q_PROPERTY(bool exists MEMBER _exists NOTIFY existsChanged) 27 | Q_PROPERTY(QString lang MEMBER _lang NOTIFY langChanged) 28 | public: 29 | Translator() 30 | : QObject() 31 | , _exists(false) 32 | { 33 | // Install translator by locale language string 34 | // zh_HK is considered 'Chinese' language but the characters are entirely different. 35 | if ((QLocale().name() != "zh_HK") && _appTranslator.load(QString(":/translations/%1.qm") 36 | .arg(QLocale::languageToString(QLocale().language()))) 37 | ) { 38 | _exists = true; 39 | } 40 | emit existsChanged(); 41 | } 42 | Q_INVOKABLE void load() { 43 | if (_exists) { 44 | qApp->installTranslator(&_appTranslator); 45 | emit langChanged(); 46 | } 47 | } 48 | Q_INVOKABLE void remove() { 49 | qApp->removeTranslator(&_appTranslator); 50 | emit langChanged(); 51 | } 52 | 53 | signals: 54 | void existsChanged(); 55 | void langChanged(); 56 | 57 | private: 58 | bool _exists; 59 | QString _lang; 60 | QTranslator _appTranslator; 61 | }; 62 | -------------------------------------------------------------------------------- /ext/zlib-win/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. sourceLen is 13 | the byte length of the source buffer. Upon entry, destLen is the total 14 | size of the destination buffer, which must be large enough to hold the 15 | entire uncompressed data. (The size of the uncompressed data must have 16 | been saved previously by the compressor and transmitted to the decompressor 17 | by some mechanism outside the scope of this compression library.) 18 | Upon exit, destLen is the actual size of the compressed buffer. 19 | 20 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 21 | enough memory, Z_BUF_ERROR if there was not enough room in the output 22 | buffer, or Z_DATA_ERROR if the input data was corrupted. 23 | */ 24 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 25 | Bytef *dest; 26 | uLongf *destLen; 27 | const Bytef *source; 28 | uLong sourceLen; 29 | { 30 | z_stream stream; 31 | int err; 32 | 33 | stream.next_in = (z_const Bytef *)source; 34 | stream.avail_in = (uInt)sourceLen; 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | 45 | err = inflateInit(&stream); 46 | if (err != Z_OK) return err; 47 | 48 | err = inflate(&stream, Z_FINISH); 49 | if (err != Z_STREAM_END) { 50 | inflateEnd(&stream); 51 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 52 | return Z_DATA_ERROR; 53 | return err; 54 | } 55 | *destLen = stream.total_out; 56 | 57 | err = inflateEnd(&stream); 58 | return err; 59 | } 60 | -------------------------------------------------------------------------------- /Android/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | #define HEADER_COMP_H 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct comp_ctx_st COMP_CTX; 12 | 13 | typedef struct comp_method_st 14 | { 15 | int type; /* NID for compression library */ 16 | const char *name; /* A text string to identify the library */ 17 | int (*init)(COMP_CTX *ctx); 18 | void (*finish)(COMP_CTX *ctx); 19 | int (*compress)(COMP_CTX *ctx, 20 | unsigned char *out, unsigned int olen, 21 | unsigned char *in, unsigned int ilen); 22 | int (*expand)(COMP_CTX *ctx, 23 | unsigned char *out, unsigned int olen, 24 | unsigned char *in, unsigned int ilen); 25 | /* The following two do NOTHING, but are kept for backward compatibility */ 26 | long (*ctrl)(void); 27 | long (*callback_ctrl)(void); 28 | } COMP_METHOD; 29 | 30 | struct comp_ctx_st 31 | { 32 | COMP_METHOD *meth; 33 | unsigned long compress_in; 34 | unsigned long compress_out; 35 | unsigned long expand_in; 36 | unsigned long expand_out; 37 | 38 | CRYPTO_EX_DATA ex_data; 39 | }; 40 | 41 | 42 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 43 | void COMP_CTX_free(COMP_CTX *ctx); 44 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 45 | unsigned char *in, int ilen); 46 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 47 | unsigned char *in, int ilen); 48 | COMP_METHOD *COMP_rle(void ); 49 | COMP_METHOD *COMP_zlib(void ); 50 | void COMP_zlib_cleanup(void); 51 | 52 | #ifdef HEADER_BIO_H 53 | #ifdef ZLIB 54 | BIO_METHOD *BIO_f_zlib(void); 55 | #endif 56 | #endif 57 | 58 | /* BEGIN ERROR CODES */ 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes 60 | * made after this point may be overwritten when the script is next run. 61 | */ 62 | void ERR_load_COMP_strings(void); 63 | 64 | /* Error codes for the COMP functions. */ 65 | 66 | /* Function codes. */ 67 | #define COMP_F_BIO_ZLIB_FLUSH 99 68 | #define COMP_F_BIO_ZLIB_NEW 100 69 | #define COMP_F_BIO_ZLIB_READ 101 70 | #define COMP_F_BIO_ZLIB_WRITE 102 71 | 72 | /* Reason codes. */ 73 | #define COMP_R_ZLIB_DEFLATE_ERROR 99 74 | #define COMP_R_ZLIB_INFLATE_ERROR 100 75 | #define COMP_R_ZLIB_NOT_SUPPORTED 101 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif 81 | -------------------------------------------------------------------------------- /src/fs/qnx6.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include "fs.h" 24 | 25 | namespace FS { 26 | 27 | struct qinode { 28 | int size; 29 | QList sectors; 30 | quint8 tiers; 31 | int time; 32 | quint16 perms; 33 | }; 34 | 35 | class QNX6 : public QFileSystem 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit QNX6(QString filename, QIODevice* file, qint64 offset, qint64 size, QString path) 41 | : QFileSystem(filename, file, offset, size, path, ".qnx6") 42 | , currentZip(nullptr) {} 43 | 44 | inline qint64 findSector(qint64 sector) { 45 | return _offset + ((sector - sectorOffset) * sectorSize); 46 | } 47 | inline qint64 findNode(int node) { 48 | return _offset + (0x80 * (node - 1)); 49 | } 50 | qint64 findIndexFromSig(unsigned char* signature, int startFrom, int distanceFrom, unsigned int maxBlocks = -1, int num = 4); 51 | qinode createNode(int node); 52 | // TODO: Read ./.rootfs.os.version or ./var/pps/system/installer/coreos/0 53 | //QString generateName(QString imageExt = ""); 54 | void extractManifest(int nodenum); 55 | void extractDir(int offset, QString basedir, int numNodes); 56 | 57 | bool createContents(); 58 | 59 | // TODO: These need to have a better method of passing from Splitter 60 | bool extractApps; 61 | 62 | signals: 63 | void currentNameChanged(QString name); 64 | 65 | private: 66 | QPair nodeInfo(QNXStream* stream, qint64 offset); 67 | quint16 sectorSize; 68 | quint16 sectorOffset; 69 | QList lfn; 70 | QuaZip* currentZip; 71 | QList manifestApps; 72 | 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /Android/include/openssl/modes.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 3 | * 4 | * Rights for redistribution and usage in source and binary 5 | * forms are granted according to the OpenSSL license. 6 | */ 7 | 8 | #include 9 | 10 | typedef void (*block128_f)(const unsigned char in[16], 11 | unsigned char out[16], 12 | const void *key); 13 | 14 | typedef void (*cbc128_f)(const unsigned char *in, unsigned char *out, 15 | size_t len, const void *key, 16 | unsigned char ivec[16], int enc); 17 | 18 | void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, 19 | size_t len, const void *key, 20 | unsigned char ivec[16], block128_f block); 21 | void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, 22 | size_t len, const void *key, 23 | unsigned char ivec[16], block128_f block); 24 | 25 | void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, 26 | size_t len, const void *key, 27 | unsigned char ivec[16], unsigned char ecount_buf[16], 28 | unsigned int *num, block128_f block); 29 | 30 | void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, 31 | size_t len, const void *key, 32 | unsigned char ivec[16], int *num, 33 | block128_f block); 34 | 35 | void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, 36 | size_t len, const void *key, 37 | unsigned char ivec[16], int *num, 38 | int enc, block128_f block); 39 | void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, 40 | size_t length, const void *key, 41 | unsigned char ivec[16], int *num, 42 | int enc, block128_f block); 43 | void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, 44 | size_t bits, const void *key, 45 | unsigned char ivec[16], int *num, 46 | int enc, block128_f block); 47 | 48 | size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out, 49 | size_t len, const void *key, 50 | unsigned char ivec[16], block128_f block); 51 | size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, 52 | size_t len, const void *key, 53 | unsigned char ivec[16], cbc128_f cbc); 54 | size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out, 55 | size_t len, const void *key, 56 | unsigned char ivec[16], block128_f block); 57 | size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, 58 | size_t len, const void *key, 59 | unsigned char ivec[16], cbc128_f cbc); 60 | -------------------------------------------------------------------------------- /src/apps.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #include "apps.h" 19 | 20 | #define SET_QML2(type, name, caps) \ 21 | type Apps::name() const { \ 22 | return _ ## name; \ 23 | } \ 24 | void Apps::caps(const type &var) { \ 25 | if (var != _ ## name) { \ 26 | _ ## name = var; \ 27 | emit name ## Changed(); \ 28 | } \ 29 | } 30 | 31 | Apps::Apps(QObject *parent) 32 | : QObject(parent) 33 | , _name(""), _url(""), _friendlyName(""), _packageId("") 34 | , _code(0), _size(0) 35 | , _isMarked(false), _isAvailable(true), _isInstalled(false) 36 | , _type("") 37 | , _installedVersion(""), _version(""), _versionId("") 38 | , _checksum("") 39 | { } 40 | 41 | Apps::Apps(const Apps* app, QObject *parent) 42 | : QObject(parent) 43 | , _name(app->name()), _url(app->url()), _friendlyName(app->friendlyName()), _packageId(app->packageId()) 44 | , _code(app->code()), _size(app->size()) 45 | , _isMarked(app->isMarked()), _isAvailable(app->isAvailable()), _isInstalled(app->isInstalled()) 46 | , _type(app->type()) 47 | , _installedVersion(app->installedVersion()), _version(app->version()), _versionId(app->versionId()) 48 | , _checksum(app->checksum()) 49 | { } 50 | 51 | SET_QML2(QString, name, setName) 52 | SET_QML2(QString, url, setUrl) 53 | SET_QML2(QString, friendlyName, setFriendlyName) 54 | SET_QML2(QString, packageId, setPackageId) 55 | SET_QML2(int, code, setCode) 56 | SET_QML2(int, size, setSize) 57 | SET_QML2(bool, isMarked, setIsMarked) 58 | SET_QML2(bool, isAvailable, setIsAvailable) 59 | SET_QML2(bool, isInstalled, setIsInstalled) 60 | SET_QML2(QString, type, setType) 61 | SET_QML2(QString, installedVersion, setInstalledVersion) 62 | SET_QML2(QString, version, setVersion) 63 | SET_QML2(QString, versionId, setVersionId) 64 | SET_QML2(QString, checksum, setChecksum) 65 | -------------------------------------------------------------------------------- /ext/quazip/quachecksum32.h: -------------------------------------------------------------------------------- 1 | #ifndef QUACHECKSUM32_H 2 | #define QUACHECKSUM32_H 3 | 4 | /* 5 | Copyright (C) 2005-2014 Sergey A. Tachenov 6 | 7 | This file is part of QuaZIP. 8 | 9 | QuaZIP is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 2.1 of the License, or 12 | (at your option) any later version. 13 | 14 | QuaZIP is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with QuaZIP. If not, see . 21 | 22 | See COPYING file for the full LGPL text. 23 | 24 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 25 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 26 | */ 27 | 28 | #include 29 | #include "quazip_global.h" 30 | 31 | /// Checksum interface. 32 | /** \class QuaChecksum32 quachecksum32.h 33 | * This is an interface for 32 bit checksums. 34 | * Classes implementing this interface can calcunate a certin 35 | * checksum in a single step: 36 | * \code 37 | * QChecksum32 *crc32 = new QuaCrc32(); 38 | * rasoult = crc32->calculate(data); 39 | * \endcode 40 | * or by streaming the data: 41 | * \code 42 | * QChecksum32 *crc32 = new QuaCrc32(); 43 | * while(!fileA.atEnd()) 44 | * crc32->update(fileA.read(bufSize)); 45 | * resoultA = crc32->value(); 46 | * crc32->reset(); 47 | * while(!fileB.atEnd()) 48 | * crc32->update(fileB.read(bufSize)); 49 | * resoultB = crc32->value(); 50 | * \endcode 51 | */ 52 | class QUAZIP_EXPORT QuaChecksum32 53 | { 54 | 55 | public: 56 | ///Calculates the checksum for data. 57 | /** \a data source data 58 | * \return data checksum 59 | * 60 | * This function has no efect on the value returned by value(). 61 | */ 62 | virtual quint32 calculate(const QByteArray &data) = 0; 63 | 64 | ///Resets the calculation on a checksun for a stream. 65 | virtual void reset() = 0; 66 | 67 | ///Updates the calculated checksum for the stream 68 | /** \a buf next portion of data from the stream 69 | */ 70 | virtual void update(const QByteArray &buf) = 0; 71 | 72 | ///Value of the checksum calculated for the stream passed throw update(). 73 | /** \return checksum 74 | */ 75 | virtual quint32 value() = 0; 76 | }; 77 | 78 | #endif //QUACHECKSUM32_H 79 | -------------------------------------------------------------------------------- /qml/generic/Boot.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.2 2 | import QtQuick.Controls 1.1 3 | import "UI" 1.0 4 | 5 | // This page is unix-only as Windows has an outdated driver model which is not compatible 6 | 7 | Column { 8 | id: toolsColumn 9 | anchors {top: parent.top; topMargin: 20; left: parent.left; leftMargin: 20 } 10 | width: parent.width - 40; 11 | spacing: 15 12 | Text { 13 | text: qsTr("Boot Communication") + translator.lang 14 | font.pointSize: 14 15 | font.bold: true 16 | } 17 | Row { 18 | spacing: 20 19 | Button { 20 | text: qsTr("Info") + translator.lang 21 | onClicked: b.setCommandMode(1, postReboot.checked); 22 | } 23 | Button { 24 | text: qsTr("RimBoot") + translator.lang 25 | onClicked: b.setCommandMode(2, postReboot.checked); 26 | } 27 | Button { 28 | text: qsTr("Nuke") + translator.lang 29 | onClicked: b.setCommandMode(3, postReboot.checked); 30 | } 31 | Button { 32 | text: qsTr("Debug Mode") + translator.lang 33 | onClicked: b.setCommandMode(4, postReboot.checked); 34 | } 35 | } 36 | CheckBox { 37 | id: postReboot 38 | text: qsTr("Reboot after") + translator.lang 39 | } 40 | 41 | Row { 42 | visible: b.connecting 43 | spacing: 15 44 | Text { 45 | text: qsTr("Connecting to bootrom") + translator.lang 46 | } 47 | BusyIndicator { 48 | height: parent.implicitHeight 49 | width: height 50 | } 51 | Button { 52 | text: qsTr("Cancel") + translator.lang 53 | onClicked: b.disconnect(); 54 | } 55 | } 56 | GroupBox { 57 | title: qsTr("Detected devices:") + translator.lang 58 | ScrollView { 59 | frameVisible: true 60 | ListView { 61 | width: parent.width 62 | height: 50 63 | model: b.devices 64 | spacing: 3 65 | 66 | delegate: Label { 67 | text: switch (modelData) { 68 | case "1": 69 | return "BlackBerry Bootloader"; 70 | case "8013": 71 | return "BlackBerry USB (Unix)"; 72 | case "8017": 73 | return "BlackBerry USB (Autodetect)"; 74 | default: 75 | return "BlackBerry USB (Windows)"; 76 | } 77 | font.pointSize: 12 78 | } 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/blitzinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "blitzinfo.h" 2 | #include 3 | #include 4 | #include 5 | 6 | BlitzInfo::BlitzInfo(QList filenames, QString deviceOS, QString deviceRadio) 7 | : QObject() 8 | , osIsSafe(false) 9 | , radioIsSafe(false) 10 | , radioCount(0) 11 | , osCount(0) 12 | , _deviceOS(deviceOS) 13 | , _deviceRadio(deviceRadio) 14 | { 15 | foreach(QString barFile, filenames) 16 | blitzCheck(barFile); 17 | } 18 | 19 | void BlitzInfo::blitzCheck(QString name) 20 | { 21 | BarType fileType = NotInstallableType; 22 | // Check if it's a 'hidden' file as we use these for temporary file downloads. 23 | if (QFileInfo(name).fileName().startsWith('.')) 24 | return; 25 | 26 | QuaZipFile manifest(name, "META-INF/MANIFEST.MF", QuaZip::csSensitive); 27 | if (!manifest.open(QIODevice::ReadOnly)) 28 | return; 29 | QString appName, type; 30 | while (!manifest.atEnd()) { 31 | QByteArray newLine = manifest.readLine(); 32 | if (newLine.startsWith("Package-Name:") || newLine.startsWith("Patch-Package-Name:")) { 33 | appName = newLine.split(':').last().simplified(); 34 | if (newLine.startsWith("Patch") && type == "system") { 35 | if (appName.contains("radio")) 36 | fileType = RadioType; 37 | else 38 | fileType = OSType; 39 | } 40 | } 41 | else if (newLine.startsWith("Package-Type:") || newLine.startsWith("Patch-Package-Type:")) { 42 | type = newLine.split(':').last().simplified(); 43 | if (type == "system" && fileType == NotInstallableType) 44 | fileType = OSType; 45 | else if (type != "patch") 46 | break; 47 | } 48 | else if (newLine.startsWith("System-Type:")) { 49 | if (newLine.split(':').last().simplified() == "radio") 50 | fileType = RadioType; 51 | break; 52 | } 53 | } 54 | if (fileType != OSType && fileType != RadioType) 55 | return; 56 | 57 | if (fileType == OSType) { 58 | osCount++; 59 | QString installableOS = appName.split("os.").last().remove(".desktop").replace("verizon", "factory"); 60 | if (_deviceOS == "" || installableOS == _deviceOS || (installableOS.contains("8974") && _deviceOS.contains("8974"))) { 61 | osIsSafe = true; 62 | } 63 | } else if (fileType == RadioType) { 64 | radioCount++; 65 | QString installableRadio = appName.split("radio.").last().remove(".omadm"); 66 | if (_deviceRadio == "" || installableRadio == _deviceRadio) { 67 | radioIsSafe = true; 68 | } 69 | } 70 | return; 71 | } 72 | -------------------------------------------------------------------------------- /ext/zlib-win/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2005 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) 23 | Bytef *dest; 24 | uLongf *destLen; 25 | const Bytef *source; 26 | uLong sourceLen; 27 | int level; 28 | { 29 | z_stream stream; 30 | int err; 31 | 32 | stream.next_in = (z_const Bytef *)source; 33 | stream.avail_in = (uInt)sourceLen; 34 | #ifdef MAXSEG_64K 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | #endif 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | stream.opaque = (voidpf)0; 45 | 46 | err = deflateInit(&stream, level); 47 | if (err != Z_OK) return err; 48 | 49 | err = deflate(&stream, Z_FINISH); 50 | if (err != Z_STREAM_END) { 51 | deflateEnd(&stream); 52 | return err == Z_OK ? Z_BUF_ERROR : err; 53 | } 54 | *destLen = stream.total_out; 55 | 56 | err = deflateEnd(&stream); 57 | return err; 58 | } 59 | 60 | /* =========================================================================== 61 | */ 62 | int ZEXPORT compress (dest, destLen, source, sourceLen) 63 | Bytef *dest; 64 | uLongf *destLen; 65 | const Bytef *source; 66 | uLong sourceLen; 67 | { 68 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 69 | } 70 | 71 | /* =========================================================================== 72 | If the default memLevel or windowBits for deflateInit() is changed, then 73 | this function needs to be updated. 74 | */ 75 | uLong ZEXPORT compressBound (sourceLen) 76 | uLong sourceLen; 77 | { 78 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 79 | (sourceLen >> 25) + 13; 80 | } 81 | -------------------------------------------------------------------------------- /src/installer_auth.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #include "installer.h" 19 | 20 | void InstallNet::requestAuthenticate() 21 | { 22 | logadd(QString("8. Request Authenticate")); 23 | QByteArray buffer; 24 | QDataStream config(&buffer, QIODevice::WriteOnly); 25 | config << qint16(6) /*messageSize*/ << qint16(2) /*version*/ << qint16(8) /*code*/; 26 | sock->write(buffer); 27 | } 28 | 29 | void InstallNet::AESEncryptSend(QByteArray &plain, int code) 30 | { 31 | /* Encrypt Plain Text */ 32 | unsigned char* iv = new unsigned char[16]; 33 | RAND_bytes(iv, 16); 34 | int ilen, tlen; 35 | unsigned char* encrypt = new unsigned char[plain.length() + 16]; 36 | EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); 37 | EVP_CIPHER_CTX_init(ctx); 38 | const EVP_CIPHER *cipher = EVP_aes_128_cbc(); 39 | EVP_EncryptInit(ctx, cipher, (unsigned char*)sessionKey.data(), iv); 40 | EVP_EncryptUpdate(ctx, encrypt, &ilen, (unsigned char*)plain.data(), plain.length()); 41 | EVP_EncryptFinal(ctx, encrypt + ilen, &tlen); 42 | EVP_CIPHER_CTX_free(ctx); 43 | 44 | /* Create buffer */ 45 | QByteArray buffer; 46 | QDataStream Auth(&buffer, QIODevice::WriteOnly); 47 | Auth << qint16(ilen + tlen) << qint16(plain.length()); 48 | Auth.writeRawData((char*)iv,16); 49 | Auth.writeRawData((char*)encrypt, ilen+tlen); 50 | 51 | /* Package and Send */ 52 | QByteArray header; 53 | QDataStream FrameHead(&header, QIODevice::WriteOnly); 54 | FrameHead << qint16(6 + buffer.length()) << qint16(2) << qint16(code); 55 | buffer.prepend(header); 56 | sock->write(buffer); 57 | delete [] iv; 58 | delete [] encrypt; 59 | } 60 | 61 | void InstallNet::authorise() 62 | { 63 | logadd(QString("10. Authorise")); 64 | /* Construct Plain Text */ 65 | QByteArray plain(2+hashedPassword.length(),0); 66 | QDataStream plainText(&plain, QIODevice::WriteOnly); 67 | plainText << qint16(hashedPassword.length()); 68 | plainText.writeRawData(hashedPassword.data(),hashedPassword.length()); 69 | 70 | AESEncryptSend(plain, 10); 71 | } 72 | 73 | void InstallNet::keepAlive() 74 | { 75 | logadd(QString("6. Keep Alive")); 76 | QByteArray buffer; 77 | QDataStream config(&buffer, QIODevice::WriteOnly); 78 | config << qint16(6) /*messageSize*/ << qint16(2) /*version*/ << qint16(6) /*code*/; 79 | sock->write(buffer); 80 | } 81 | -------------------------------------------------------------------------------- /Android/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * 3. All advertising materials mentioning features or use of this 17 | * software must display the following acknowledgment: 18 | * "This product includes software developed by the OpenSSL Project 19 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 20 | * 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 22 | * endorse or promote products derived from this software without 23 | * prior written permission. For written permission, please contact 24 | * licensing@OpenSSL.org. 25 | * 26 | * 5. Products derived from this software may not be called "OpenSSL" 27 | * nor may "OpenSSL" appear in their names without prior written 28 | * permission of the OpenSSL Project. 29 | * 30 | * 6. Redistributions of any form whatsoever must retain the following 31 | * acknowledgment: 32 | * "This product includes software developed by the OpenSSL Project 33 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. 47 | * ==================================================================== 48 | * 49 | * This product includes cryptographic software written by Eric Young 50 | * (eay@cryptsoft.com). This product includes software written by Tim 51 | * Hudson (tjh@cryptsoft.com). 52 | * 53 | */ 54 | 55 | /* 56 | * This header only exists to break a circular dependency between pem and err 57 | * Ben 30 Jan 1999. 58 | */ 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | #ifndef HEADER_PEM_H 65 | void ERR_load_PEM_strings(void); 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | -------------------------------------------------------------------------------- /ext/zlib-win/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of the dynamic table. The maximum number of code structures is 39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance 40 | codes. These values were found by exhaustive searches using the program 41 | examples/enough.c found in the zlib distribtution. The arguments to that 42 | program are the number of symbols, the initial root table size, and the 43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes 44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592. 45 | The initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in inflate.c and infback.c. If the root table size is 47 | changed, then these maximum sizes would be need to be recalculated and 48 | updated. */ 49 | #define ENOUGH_LENS 852 50 | #define ENOUGH_DISTS 592 51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 52 | 53 | /* Type of code to build for inflate_table() */ 54 | typedef enum { 55 | CODES, 56 | LENS, 57 | DISTS 58 | } codetype; 59 | 60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, 61 | unsigned codes, code FAR * FAR *table, 62 | unsigned FAR *bits, unsigned short FAR *work)); 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sachesi 2 | 3 | Introducing Sachesi. The results of my continued work on firmware tools for Blackberry 10 and Playbook. 4 | 5 | Sachesi allows you to extract, search for and (un)install Blackberry firmware. It also allows you to backup, restore, wipe, reboot and nuke. This is a continued evolution of the original Sachup and Sachibar applications. 6 | None of its activities require development mode. That is, you can sideload and uninstall applications without developer mode. 7 | 8 | The application mimics communications performed by official Blackberry tools and allows modification of the typically fixed commands that are sent from the computer. This allows increased control and flexibility over firmware related activies on your device. 9 | 10 | Developed by Sacha Refshauge. Project originally known as Dingleberry. Public release of source code on May 26, 2014. 11 | 12 | 13 | ## Build Instructions 14 | 15 | Technically should work on all operating systems that support Qt. This project works with both dynamic and static builds of Qt4.8+ and Qt5.0+. 16 | It is known to build and has built binaries available for desktop platforms: Windows XP+, Linux, Mac OSX 10.5+. It can also build and run a restricted subset of activities on mobile platforms: Symbian, Android and Blackberry 10. To upgrade firmware via a mobile device requires USB low-level access (host device must support network usb drivers), such as Symbian and possibly rooted Android devices. 17 | 18 | This project requires miniLZO, zlib-1.2.8, QuaZIP and OpenSSL. 19 | For Linux and Mac, the project optionally uses libusb-1.0 for bootloader activities. 20 | For your convenience, a snapshot of the important files from libusb-1.0, miniLZO, zlib-1.2.8 and QuaZIP have been provided. OpenSSL for Android is also provided. 21 | 22 | 23 | ## Windows Build Instructions (MinGW) 24 | 25 | 1. Install latest QT with MinGW from [qt-project.org](https://qt-project.org). 26 | 2. Install OpenSSL to `C:\OpenSSL` from [http://www.wittfella.com/openssl](http://www.wittfella.com/openssl). 27 | 3. Open Sachesi.pro in QtCreator. 28 | 4. Adjust the hardcoded paths set in `QML.qrc` to point to the correct qml files. 29 | 5. Run. 30 | 31 | **Notes for Visual Studio**: 32 | 33 | - Use [this precompiled OpenSSL](http://www.npcglib.org/~stathis/blog/precompiled-openssl) version. 34 | 35 | 36 | ## Ubuntu Build Instructions 37 | 38 | 1. Install the required dependencies: 39 | 40 | ```bash 41 | sudo apt-get install qt5-qmake libqt5network5 libqt5qml5 qtdeclarative5-settings-plugin qtdeclarative5-controls-plugin qtdeclarative5-dialogs-plugin qtdeclarative5-quicklayouts-plugin qtdeclarative5-window-plugin qtdeclarative5-qtquick2-plugin qttools5-dev-tools libssl-dev qtdeclarative5-dev libusb-1.0-0-dev 42 | ``` 43 | 44 | 2. Compile Sachesi: 45 | 46 | ```bash 47 | cd /path/to/Sachesi; 48 | qmake; 49 | make -j4; 50 | ``` 51 | 52 | **Common Errors** 53 | 54 | On some systems there might be some `Cannot find file translations/...` errors. This can 55 | be fixed by executing `make compiler_lang_make_all` and executing the above steps again. 56 | 57 | 58 | ## OSX Build Instructions 59 | 60 | 1. Install latest XCode. 61 | 2. Install latest QT from [qt-project.org](https://qt-project.org). 62 | 3. Install `brew` from [brew.sh](https://brew.sh). 63 | 4. Run `brew install libusb`. 64 | 5. Open Sachesi.pro in QtCreator. 65 | 6. Run. 66 | 67 | -------------------------------------------------------------------------------- /src/installer_establish.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #include "installer.h" 19 | 20 | // Compatibility for old OpenSSL 21 | #if OPENSSL_VERSION_NUMBER < 0x10100005L 22 | static void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) 23 | { 24 | if(n != NULL) 25 | *n = r->n; 26 | 27 | if(e != NULL) 28 | *e = r->e; 29 | 30 | if(d != NULL) 31 | *d = r->d; 32 | } 33 | #endif 34 | 35 | void InstallNet::requestConfigure() 36 | { 37 | if (!_state) 38 | return; 39 | logadd(QString("1. Request Configuration")); 40 | QByteArray buffer; 41 | QDataStream config(&buffer, QIODevice::WriteOnly); 42 | config << qint16(6) /*messageSize*/ << qint16(2) /*version*/ << qint16(1) /*code*/; 43 | sock->write(buffer); 44 | } 45 | 46 | void InstallNet::requestChallenge() 47 | { 48 | logadd(QString("3. Request Challenge")); 49 | BIGNUM* e = BN_new(); BN_set_word(e, 65537); 50 | privkey = RSA_new(); 51 | RSA_generate_key_ex(privkey, 1024, e, nullptr); 52 | const BIGNUM* bign; 53 | RSA_get0_key(privkey, &bign, nullptr, nullptr); 54 | unsigned char* privkey_mod = new unsigned char[BN_num_bytes(bign)]; 55 | BN_bn2bin(bign, privkey_mod); 56 | QByteArray buffer(128,0); 57 | buffer = QByteArray::fromRawData((char*)privkey_mod,128); 58 | QByteArray header; 59 | QDataStream FrameHead(&header, QIODevice::WriteOnly); 60 | FrameHead << qint16(8 + buffer.length()) << qint16(2) << qint16(3) << qint16(buffer.length()); 61 | buffer.prepend(header); 62 | sock->write(buffer); 63 | delete privkey_mod; 64 | } 65 | 66 | void InstallNet::replyChallenge() 67 | { 68 | logadd(QString("5. Reply Challenge")); 69 | const signed char QCONNDOOR_PERMISSIONS[] = {3, 4, 118, -125, 1}; 70 | const char EMSA_SHA1_HASH[] = {48, 33, 48, 9, 6, 5, 43, 14, 3, 2, 26, 5, 0, 4, 20}; 71 | QCryptographicHash sha1(QCryptographicHash::Sha1); 72 | 73 | /* Encrypt challenge */ 74 | QByteArray challengeBuffer = QByteArray((char*)serverChallenge, 30).append((const char*)QCONNDOOR_PERMISSIONS, 5); 75 | sha1.addData(challengeBuffer); 76 | QByteArray hash = QByteArray(EMSA_SHA1_HASH, 15).append(sha1.result()); 77 | QByteArray signature(128, 0); 78 | RSA_private_encrypt(hash.length(),(unsigned char*)hash.data(), (unsigned char*)signature.data(), privkey, RSA_PKCS1_PADDING); 79 | 80 | /* Find Session Key */ 81 | sessionKey = challengeBuffer.mid(8,16); 82 | 83 | /* Construct Plain Text */ 84 | QByteArray plain(12 + challengeBuffer.length() + signature.length(),0); 85 | QDataStream plainText(&plain, QIODevice::WriteOnly); 86 | plainText << qint16(4 + challengeBuffer.length() + signature.length()) << qint16(challengeBuffer.length()) << qint16(signature.length()); 87 | plainText.writeRawData(challengeBuffer.data(),35); 88 | plainText.writeRawData(signature.data(),128); 89 | 90 | AESEncryptSend(plain, 5); 91 | } 92 | -------------------------------------------------------------------------------- /src/autoloaderwriter.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include "fs/fs.h" // QNXStream 23 | #include "ports.h" 24 | 25 | class AutoloaderWriter: public QFile { 26 | Q_OBJECT 27 | public: 28 | AutoloaderWriter(QList devices) 29 | : _devHandle(devices) 30 | , _finished(false) 31 | { 32 | 33 | } 34 | 35 | void kill() { 36 | _finished = true; 37 | if (isOpen()) 38 | close(); 39 | remove(); 40 | } 41 | 42 | void create(QString name) { 43 | _maxSize = 0x10000000; // A very large number :) 44 | // Find potential file 45 | QString append = ".exe"; 46 | for (int f = 2; QFile::exists(name + append); f++) { 47 | append = QString("-%1.exe").arg(QString::number(f)); 48 | } 49 | // Start the autoloader as a cap file 50 | setFileName(name + append); 51 | open(QIODevice::WriteOnly); 52 | QFile cap(capPath()); 53 | cap.open(QIODevice::ReadOnly); 54 | appendFile(&cap); 55 | 56 | // This code is used as a separator 57 | write(QByteArray::fromBase64("at9dFE5LT0dJSE5JTk1TDRAMBRceERhTLUY8T0crSzk5OVNOT1FNT09RTU9RSEhwnNXFl5zVxZec1cWX").constData(), 60); 58 | // This is a placeholder for a password 59 | write(QByteArray(80, 0), 80); 60 | 61 | QByteArray dataHeader; 62 | QNXStream dataStream(&dataHeader, QIODevice::WriteOnly); 63 | dataStream << (quint64)_devHandle.count(); 64 | quint64 counter = pos() + 64; 65 | foreach (QIODevice* file, _devHandle) 66 | { 67 | dataStream << counter; 68 | counter += file->size(); 69 | } 70 | for (int i = _devHandle.count() - 1; i < 6; i++) 71 | dataStream << (qint64)0; 72 | write(dataHeader); 73 | _read = 100 * pos(); 74 | _maxSize = counter; 75 | resize(_maxSize); 76 | foreach (QIODevice* file, _devHandle) 77 | if (!_finished) appendFile(file); 78 | if (isOpen()) 79 | close(); 80 | } 81 | 82 | void appendFile(QIODevice* file) { 83 | while (!file->atEnd()) 84 | { 85 | // Check if we are being told to leave 86 | qApp->processEvents(); 87 | if (_finished) 88 | return; 89 | int writeSize = write(file->read(FAST_BUFFER_LEN)); 90 | if (writeSize < 0) { 91 | kill(); 92 | return; 93 | } 94 | _read += 100 * writeSize; 95 | emit newProgress((int)(_read / _maxSize)); 96 | } 97 | file->close(); 98 | } 99 | signals: 100 | void newProgress(int percent); 101 | private: 102 | qint64 _read, _maxSize; 103 | QList _devHandle; 104 | bool _finished; 105 | }; 106 | -------------------------------------------------------------------------------- /Android/include/openssl/ui_compat.h: -------------------------------------------------------------------------------- 1 | /* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 3 | * project 2001. 4 | */ 5 | /* ==================================================================== 6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * 3. All advertising materials mentioning features or use of this 21 | * software must display the following acknowledgment: 22 | * "This product includes software developed by the OpenSSL Project 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 24 | * 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26 | * endorse or promote products derived from this software without 27 | * prior written permission. For written permission, please contact 28 | * openssl-core@openssl.org. 29 | * 30 | * 5. Products derived from this software may not be called "OpenSSL" 31 | * nor may "OpenSSL" appear in their names without prior written 32 | * permission of the OpenSSL Project. 33 | * 34 | * 6. Redistributions of any form whatsoever must retain the following 35 | * acknowledgment: 36 | * "This product includes software developed by the OpenSSL Project 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 38 | * 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. 51 | * ==================================================================== 52 | * 53 | * This product includes cryptographic software written by Eric Young 54 | * (eay@cryptsoft.com). This product includes software written by Tim 55 | * Hudson (tjh@cryptsoft.com). 56 | * 57 | */ 58 | 59 | #ifndef HEADER_UI_COMPAT_H 60 | #define HEADER_UI_COMPAT_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /* The following functions were previously part of the DES section, 70 | and are provided here for backward compatibility reasons. */ 71 | 72 | #define des_read_pw_string(b,l,p,v) \ 73 | _ossl_old_des_read_pw_string((b),(l),(p),(v)) 74 | #define des_read_pw(b,bf,s,p,v) \ 75 | _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) 76 | 77 | int _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify); 78 | int _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif 84 | -------------------------------------------------------------------------------- /src/backupinfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "apps.h" 26 | 27 | class BackupCategory { 28 | 29 | public: 30 | BackupCategory(QXmlStreamAttributes cat) { 31 | foreach(QXmlStreamAttribute attr, cat) 32 | { 33 | QString att = attr.name().toString(); 34 | QString val = attr.value().toString(); 35 | if (att == "id") 36 | id = val; 37 | else if (att == "name") 38 | name = val; 39 | else if (att == "count") 40 | count = val; 41 | else if (att == "bytesize") 42 | bytesize = val; 43 | else if (att == "perimetertype") 44 | perimetertype = (val != "personal") ? "1" : "0"; 45 | } 46 | } 47 | BackupCategory(QString idGiven, QString nameGiven) { 48 | id = idGiven; 49 | name = nameGiven; 50 | count = "0"; 51 | bytesize = "-1"; 52 | perimetertype = "0"; 53 | } 54 | 55 | ~BackupCategory() {} 56 | 57 | QString id; 58 | QString name; 59 | QString count; 60 | QString bytesize; 61 | QString perimetertype; 62 | }; 63 | 64 | class BackupInfo : public QObject { 65 | Q_OBJECT 66 | 67 | public: 68 | BackupInfo(); 69 | ~BackupInfo() {} 70 | QString modeString(); 71 | QString stringFromMode(int mode); 72 | int mode() const; 73 | int appMode() const; 74 | int numMethods() const; 75 | void addMode(QXmlStreamAttributes cat); 76 | void addApp(QXmlStreamAttributes cat); 77 | void sortApps(); 78 | void clearModes(); 79 | void setMode(const int &val); 80 | qint64 setAppMode(QString mode); 81 | QString curMode() const; 82 | void setCurMode(int increment); 83 | 84 | qint64 size() const; 85 | void setSize(const qint64 &val); 86 | qint64 maxSize() const; 87 | void setMaxSize(const qint64 &val); 88 | 89 | qint64 curSize() const; 90 | void setCurSize(const qint64 &val); 91 | qint64 curMaxSize() const; 92 | void setCurMaxSize(const qint64 &val); 93 | void setCurMaxSize(int index, const qint64 &val); 94 | int progress() const; 95 | void setProgress(const int &progress); 96 | 97 | QList categories; 98 | QList apps; 99 | 100 | int rev() const; 101 | signals: 102 | void modeChanged(); 103 | void progressChanged(); 104 | void curModeChanged(); 105 | void sizeChanged(); 106 | void maxSizeChanged(); 107 | void curSizeChanged(); 108 | void curMaxSizeChanged(); 109 | void numMethodsChanged(); 110 | private: 111 | int _progress; 112 | qint64 _size, _maxSize; 113 | QList _curSize, _curMaxSize; 114 | int _mode; 115 | int _curMode; 116 | int _numMethods; 117 | int _rev; 118 | int _appMode; 119 | }; 120 | -------------------------------------------------------------------------------- /ext/quazip/quaziodevice.h: -------------------------------------------------------------------------------- 1 | #ifndef QUAZIP_QUAZIODEVICE_H 2 | #define QUAZIP_QUAZIODEVICE_H 3 | 4 | /* 5 | Copyright (C) 2005-2014 Sergey A. Tachenov 6 | 7 | This file is part of QuaZIP. 8 | 9 | QuaZIP is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 2.1 of the License, or 12 | (at your option) any later version. 13 | 14 | QuaZIP is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with QuaZIP. If not, see . 21 | 22 | See COPYING file for the full LGPL text. 23 | 24 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 25 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 26 | */ 27 | 28 | #include 29 | #include "quazip_global.h" 30 | 31 | #include 32 | 33 | class QuaZIODevicePrivate; 34 | 35 | /// A class to compress/decompress QIODevice. 36 | /** 37 | This class can be used to compress any data written to QIODevice or 38 | decompress it back. Compressing data sent over a QTcpSocket is a good 39 | example. 40 | */ 41 | class QUAZIP_EXPORT QuaZIODevice: public QIODevice { 42 | Q_OBJECT 43 | public: 44 | /// Constructor. 45 | /** 46 | \param io The QIODevice to read/write. 47 | \param parent The parent object, as per QObject logic. 48 | */ 49 | QuaZIODevice(QIODevice *io, QObject *parent = NULL); 50 | /// Destructor. 51 | ~QuaZIODevice(); 52 | /// Flushes data waiting to be written. 53 | /** 54 | Unfortunately, as QIODevice doesn't support flush() by itself, the 55 | only thing this method does is write the compressed data into the 56 | device using Z_SYNC_FLUSH mode. If you need the compressed data to 57 | actually be flushed from the buffer of the underlying QIODevice, you 58 | need to call its flush() method as well, providing it supports it 59 | (like QTcpSocket does). Example: 60 | \code 61 | QuaZIODevice dev(&sock); 62 | dev.open(QIODevice::Write); 63 | dev.write(yourDataGoesHere); 64 | dev.flush(); 65 | sock->flush(); // this actually sends data to network 66 | \endcode 67 | 68 | This may change in the future versions of QuaZIP by implementing an 69 | ugly hack: trying to cast the QIODevice using qobject_cast to known 70 | flush()-supporting subclasses, and calling flush if the resulting 71 | pointer is not zero. 72 | */ 73 | virtual bool flush(); 74 | /// Opens the device. 75 | /** 76 | \param mode Neither QIODevice::ReadWrite nor QIODevice::Append are 77 | not supported. 78 | */ 79 | virtual bool open(QIODevice::OpenMode mode); 80 | /// Closes this device, but not the underlying one. 81 | /** 82 | The underlying QIODevice is not closed in case you want to write 83 | something else to it. 84 | */ 85 | virtual void close(); 86 | /// Returns the underlying device. 87 | QIODevice *getIoDevice() const; 88 | /// Returns true. 89 | virtual bool isSequential() const; 90 | /// Returns true iff the end of the compressed stream is reached. 91 | virtual bool atEnd() const; 92 | /// Returns the number of the bytes buffered. 93 | virtual qint64 bytesAvailable() const; 94 | protected: 95 | /// Implementation of QIODevice::readData(). 96 | virtual qint64 readData(char *data, qint64 maxSize); 97 | /// Implementation of QIODevice::writeData(). 98 | virtual qint64 writeData(const char *data, qint64 maxSize); 99 | private: 100 | QuaZIODevicePrivate *d; 101 | }; 102 | #endif // QUAZIP_QUAZIODEVICE_H 103 | -------------------------------------------------------------------------------- /Android/include/openssl/pqueue.h: -------------------------------------------------------------------------------- 1 | /* crypto/pqueue/pqueue.h */ 2 | /* 3 | * DTLS implementation written by Nagendra Modadugu 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_PQUEUE_H 61 | #define HEADER_PQUEUE_H 62 | 63 | #include 64 | #include 65 | #include 66 | 67 | typedef struct _pqueue *pqueue; 68 | 69 | typedef struct _pitem 70 | { 71 | unsigned char priority[8]; /* 64-bit value in big-endian encoding */ 72 | void *data; 73 | struct _pitem *next; 74 | } pitem; 75 | 76 | typedef struct _pitem *piterator; 77 | 78 | pitem *pitem_new(unsigned char *prio64be, void *data); 79 | void pitem_free(pitem *item); 80 | 81 | pqueue pqueue_new(void); 82 | void pqueue_free(pqueue pq); 83 | 84 | pitem *pqueue_insert(pqueue pq, pitem *item); 85 | pitem *pqueue_peek(pqueue pq); 86 | pitem *pqueue_pop(pqueue pq); 87 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); 88 | pitem *pqueue_iterator(pqueue pq); 89 | pitem *pqueue_next(piterator *iter); 90 | 91 | void pqueue_print(pqueue pq); 92 | int pqueue_size(pqueue pq); 93 | 94 | #endif /* ! HEADER_PQUEUE_H */ 95 | -------------------------------------------------------------------------------- /src/fs/fs.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | // node.mode flags 29 | #define QCFM_IS_COMPRESSED ((1 << 22) | (1 << 23) | (1 << 24)) 30 | // lzo1x_decompress_safe 31 | #define QCFM_IS_LZO_COMPRESSED (1 << 23) 32 | // ucl_nrv2b_decompress_8 33 | #define QCFM_IS_UCL_COMPRESSED ((1 << 22) | (1 << 23)) 34 | #define QCFM_IS_GZIP_COMPRESSED (1 << 22) 35 | #define QCFM_IS_DIRECTORY (1 << 14) 36 | #define QCFM_IS_SYMLINK (1 << 13) 37 | // QNX6 maximum filename length 38 | #define QNX6_MAX_CHARS 510 39 | 40 | // Utility function to quickly grab from stream 41 | #define READ_TMP(x, y) x y; stream >> y; 42 | // Maximum amount to store in RAM at any time between reading QIODevice and writing to disk. 43 | #define BUFFER_LEN (qint64)4096 44 | #define FAST_BUFFER_LEN (qint64)819200 45 | 46 | #ifdef _WIN32 47 | #include "Windows.h" 48 | // We need to update the time of the extracted file based on the unix filesystem it comes from. 49 | void fixFileTime(QString filename, int time); 50 | #endif 51 | 52 | // Since QNX files are always LittleEndian but Qt defaults to BigEndian, this wrapper exists 53 | class QNXStream : public QDataStream { 54 | public: 55 | QNXStream(QIODevice * device) 56 | : QDataStream(device) { 57 | setByteOrder(QDataStream::LittleEndian); 58 | } 59 | QNXStream(QByteArray * a, QIODevice::OpenMode flags) 60 | : QDataStream(a, flags) { 61 | setByteOrder(QDataStream::LittleEndian); 62 | resetStatus(); 63 | } 64 | int grabInt() { 65 | int tmp; 66 | this->operator >>(tmp); 67 | return tmp; 68 | } 69 | unsigned short grabUShort() { 70 | unsigned short tmp; 71 | this->operator >>(tmp); 72 | return tmp; 73 | } 74 | unsigned char grabUChar() { 75 | unsigned char tmp; 76 | this->operator >>(tmp); 77 | return tmp; 78 | } 79 | }; 80 | 81 | class QFileSystem : public QObject 82 | { 83 | Q_OBJECT 84 | public: 85 | explicit QFileSystem(QString filename, QIODevice* file = nullptr, qint64 offset = 0, qint64 size = 0, QString path = ".", QString imageExt = ""); 86 | ~QFileSystem(); 87 | 88 | // Basis of size reporting 89 | void increaseCurSize(qint64 read) { 90 | if (read <= 0) 91 | return; 92 | curSize += read; 93 | emit sizeChanged(read); 94 | } 95 | 96 | QString uniqueDir(QString name); 97 | QString uniqueFile(QString name); 98 | virtual QString generateName(QString imageExt = ""); 99 | bool writeFile(QString fileName, qint64 offset, qint64 writeSize, bool absolute = false); 100 | bool extractImage(); 101 | virtual bool createImage(QString name); 102 | bool extractContents(); 103 | virtual bool createContents() = 0; 104 | 105 | qint64 curSize; 106 | qint64 maxSize; 107 | 108 | signals: 109 | void sizeChanged(qint64 delta); 110 | 111 | protected: 112 | QIODevice* _file; 113 | qint64 _offset, _size; 114 | QString _path, _filename; 115 | QString _imageExt; 116 | }; 117 | -------------------------------------------------------------------------------- /Android/include/openssl/ssl23.h: -------------------------------------------------------------------------------- 1 | /* ssl/ssl23.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_SSL23_H 60 | #define HEADER_SSL23_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /*client */ 67 | /* write to server */ 68 | #define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) 69 | #define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) 70 | /* read from server */ 71 | #define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) 72 | #define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) 73 | 74 | /* server */ 75 | /* read from client */ 76 | #define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) 77 | #define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | 84 | -------------------------------------------------------------------------------- /Android/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* crypto/rc4/rc4.h */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC4_H 60 | #define HEADER_RC4_H 61 | 62 | #include /* OPENSSL_NO_RC4, RC4_INT */ 63 | #ifdef OPENSSL_NO_RC4 64 | #error RC4 is disabled. 65 | #endif 66 | 67 | #include 68 | 69 | #ifdef __cplusplus 70 | extern "C" { 71 | #endif 72 | 73 | typedef struct rc4_key_st 74 | { 75 | RC4_INT x,y; 76 | RC4_INT data[256]; 77 | } RC4_KEY; 78 | 79 | 80 | const char *RC4_options(void); 81 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 82 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 83 | unsigned char *outdata); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /Android/include/openssl/opensslv.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_OPENSSLV_H 2 | #define HEADER_OPENSSLV_H 3 | 4 | /* Numeric release version identifier: 5 | * MNNFFPPS: major minor fix patch status 6 | * The status nibble has one of the values 0 for development, 1 to e for betas 7 | * 1 to 14, and f for release. The patch level is exactly that. 8 | * For example: 9 | * 0.9.3-dev 0x00903000 10 | * 0.9.3-beta1 0x00903001 11 | * 0.9.3-beta2-dev 0x00903002 12 | * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) 13 | * 0.9.3 0x0090300f 14 | * 0.9.3a 0x0090301f 15 | * 0.9.4 0x0090400f 16 | * 1.2.3z 0x102031af 17 | * 18 | * For continuity reasons (because 0.9.5 is already out, and is coded 19 | * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level 20 | * part is slightly different, by setting the highest bit. This means 21 | * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start 22 | * with 0x0090600S... 23 | * 24 | * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for 26 | * major minor fix final patch/beta) 27 | */ 28 | #define OPENSSL_VERSION_NUMBER 0x1000005fL 29 | #ifdef OPENSSL_FIPS 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0e-fips 6 Sep 2011" 31 | #else 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0e 6 Sep 2011" 33 | #endif 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT 35 | 36 | 37 | /* The macros below are to be used for shared library (.so, .dll, ...) 38 | * versioning. That kind of versioning works a bit differently between 39 | * operating systems. The most usual scheme is to set a major and a minor 40 | * number, and have the runtime loader check that the major number is equal 41 | * to what it was at application link time, while the minor number has to 42 | * be greater or equal to what it was at application link time. With this 43 | * scheme, the version number is usually part of the file name, like this: 44 | * 45 | * libcrypto.so.0.9 46 | * 47 | * Some unixen also make a softlink with the major verson number only: 48 | * 49 | * libcrypto.so.0 50 | * 51 | * On Tru64 and IRIX 6.x it works a little bit differently. There, the 52 | * shared library version is stored in the file, and is actually a series 53 | * of versions, separated by colons. The rightmost version present in the 54 | * library when linking an application is stored in the application to be 55 | * matched at run time. When the application is run, a check is done to 56 | * see if the library version stored in the application matches any of the 57 | * versions in the version string of the library itself. 58 | * This version string can be constructed in any way, depending on what 59 | * kind of matching is desired. However, to implement the same scheme as 60 | * the one used in the other unixen, all compatible versions, from lowest 61 | * to highest, should be part of the string. Consecutive builds would 62 | * give the following versions strings: 63 | * 64 | * 3.0 65 | * 3.0:3.1 66 | * 3.0:3.1:3.2 67 | * 4.0 68 | * 4.0:4.1 69 | * 70 | * Notice how version 4 is completely incompatible with version, and 71 | * therefore give the breach you can see. 72 | * 73 | * There may be other schemes as well that I haven't yet discovered. 74 | * 75 | * So, here's the way it works here: first of all, the library version 76 | * number doesn't need at all to match the overall OpenSSL version. 77 | * However, it's nice and more understandable if it actually does. 78 | * The current library version is stored in the macro SHLIB_VERSION_NUMBER, 79 | * which is just a piece of text in the format "M.m.e" (Major, minor, edit). 80 | * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, 81 | * we need to keep a history of version numbers, which is done in the 82 | * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and 83 | * should only keep the versions that are binary compatible with the current. 84 | */ 85 | #define SHLIB_VERSION_HISTORY "" 86 | #define SHLIB_VERSION_NUMBER "1.0.0" 87 | 88 | 89 | #endif /* HEADER_OPENSSLV_H */ 90 | -------------------------------------------------------------------------------- /ext/quazip/quagzipfile.h: -------------------------------------------------------------------------------- 1 | #ifndef QUAZIP_QUAGZIPFILE_H 2 | #define QUAZIP_QUAGZIPFILE_H 3 | 4 | /* 5 | Copyright (C) 2005-2014 Sergey A. Tachenov 6 | 7 | This file is part of QuaZIP. 8 | 9 | QuaZIP is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 2.1 of the License, or 12 | (at your option) any later version. 13 | 14 | QuaZIP is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with QuaZIP. If not, see . 21 | 22 | See COPYING file for the full LGPL text. 23 | 24 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 25 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 26 | */ 27 | 28 | #include 29 | #include "quazip_global.h" 30 | 31 | #include 32 | 33 | class QuaGzipFilePrivate; 34 | 35 | /// GZIP file 36 | /** 37 | This class is a wrapper around GZIP file access functions in zlib. Unlike QuaZip classes, it doesn't allow reading from a GZIP file opened as QIODevice, for example, if your GZIP file is in QBuffer. It only provides QIODevice access to a GZIP file contents, but the GZIP file itself must be identified by its name on disk or by descriptor id. 38 | */ 39 | class QUAZIP_EXPORT QuaGzipFile: public QIODevice { 40 | Q_OBJECT 41 | public: 42 | /// Empty constructor. 43 | /** 44 | Must call setFileName() before trying to open. 45 | */ 46 | QuaGzipFile(); 47 | /// Empty constructor with a parent. 48 | /** 49 | Must call setFileName() before trying to open. 50 | \param parent The parent object, as per QObject logic. 51 | */ 52 | QuaGzipFile(QObject *parent); 53 | /// Constructor. 54 | /** 55 | \param fileName The name of the GZIP file. 56 | \param parent The parent object, as per QObject logic. 57 | */ 58 | QuaGzipFile(const QString &fileName, QObject *parent = NULL); 59 | /// Destructor. 60 | virtual ~QuaGzipFile(); 61 | /// Sets the name of the GZIP file to be opened. 62 | void setFileName(const QString& fileName); 63 | /// Returns the name of the GZIP file. 64 | QString getFileName() const; 65 | /// Returns true. 66 | /** 67 | Strictly speaking, zlib supports seeking for GZIP files, but it is 68 | poorly implemented, because there is no way to implement it 69 | properly. For reading, seeking backwards is very slow, and for 70 | writing, it is downright impossible. Therefore, QuaGzipFile does not 71 | support seeking at all. 72 | */ 73 | virtual bool isSequential() const; 74 | /// Opens the file. 75 | /** 76 | \param mode Can be either QIODevice::Write or QIODevice::Read. 77 | ReadWrite and Append aren't supported. 78 | */ 79 | virtual bool open(QIODevice::OpenMode mode); 80 | /// Opens the file. 81 | /** 82 | \overload 83 | \param fd The file descriptor to read/write the GZIP file from/to. 84 | \param mode Can be either QIODevice::Write or QIODevice::Read. 85 | ReadWrite and Append aren't supported. 86 | */ 87 | virtual bool open(int fd, QIODevice::OpenMode mode); 88 | /// Flushes data to file. 89 | /** 90 | The data is written using Z_SYNC_FLUSH mode. Doesn't make any sense 91 | when reading. 92 | */ 93 | virtual bool flush(); 94 | /// Closes the file. 95 | virtual void close(); 96 | protected: 97 | /// Implementation of QIODevice::readData(). 98 | virtual qint64 readData(char *data, qint64 maxSize); 99 | /// Implementation of QIODevice::writeData(). 100 | virtual qint64 writeData(const char *data, qint64 maxSize); 101 | private: 102 | // not implemented by design to disable copy 103 | QuaGzipFile(const QuaGzipFile &that); 104 | QuaGzipFile& operator=(const QuaGzipFile &that); 105 | QuaGzipFilePrivate *d; 106 | }; 107 | 108 | #endif // QUAZIP_QUAGZIPFILE_H 109 | -------------------------------------------------------------------------------- /Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Android/include/openssl/conf_api.h: -------------------------------------------------------------------------------- 1 | /* conf_api.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_CONF_API_H 60 | #define HEADER_CONF_API_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /* Up until OpenSSL 0.9.5a, this was new_section */ 70 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); 71 | /* Up until OpenSSL 0.9.5a, this was get_section */ 72 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); 73 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 74 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 75 | const char *section); 76 | 77 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); 78 | char *_CONF_get_string(const CONF *conf, const char *section, 79 | const char *name); 80 | long _CONF_get_number(const CONF *conf, const char *section, const char *name); 81 | 82 | int _CONF_new_data(CONF *conf); 83 | void _CONF_free_data(CONF *conf); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | #endif 89 | 90 | -------------------------------------------------------------------------------- /src/apps.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | 20 | #include 21 | #if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) 22 | #include 23 | #else 24 | #include 25 | #define QQmlListProperty QDeclarativeListProperty 26 | #endif 27 | 28 | class Apps : public QObject { 29 | Q_OBJECT 30 | 31 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) 32 | Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) 33 | Q_PROPERTY(QString packageId READ packageId WRITE setPackageId NOTIFY packageIdChanged) 34 | Q_PROPERTY(QString friendlyName READ friendlyName WRITE setFriendlyName NOTIFY friendlyNameChanged) 35 | Q_PROPERTY(int code READ code WRITE setCode NOTIFY codeChanged) 36 | Q_PROPERTY(int size READ size WRITE setSize NOTIFY sizeChanged) 37 | Q_PROPERTY(bool isMarked READ isMarked WRITE setIsMarked NOTIFY isMarkedChanged) 38 | Q_PROPERTY(bool isAvailable READ isAvailable WRITE setIsAvailable NOTIFY isAvailableChanged) 39 | Q_PROPERTY(bool isInstalled READ isInstalled WRITE setIsInstalled NOTIFY isInstalledChanged) 40 | Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) 41 | Q_PROPERTY(QString installedVersion READ installedVersion WRITE setInstalledVersion NOTIFY installedVersionChanged) 42 | Q_PROPERTY(QString version READ version WRITE setVersion NOTIFY versionChanged) 43 | Q_PROPERTY(QString versionId READ versionId WRITE setVersionId NOTIFY versionIdChanged) 44 | Q_PROPERTY(QString checksum READ checksum WRITE setChecksum NOTIFY checksumChanged) 45 | 46 | public: 47 | Apps(QObject *parent = 0); 48 | Apps(const Apps* app, QObject *parent = 0); 49 | 50 | QString name() const; 51 | QString url() const; 52 | QString packageId() const; 53 | QString friendlyName() const; 54 | int code() const; 55 | int size() const; 56 | bool isMarked() const; 57 | bool isAvailable() const; 58 | bool isInstalled() const; 59 | QString type() const; 60 | QString installedVersion() const; 61 | QString version() const; 62 | QString versionId() const; 63 | QString checksum() const; 64 | void setName(const QString &str); 65 | void setUrl(const QString &str); 66 | void setPackageId(const QString &str); 67 | void setFriendlyName(const QString &str); 68 | void setCode(const int &num); 69 | void setSize(const int &num); 70 | void setIsMarked(const bool &marked); 71 | void setIsAvailable(const bool &available); 72 | void setIsInstalled(const bool &installed); 73 | void setType(const QString &str); 74 | void setInstalledVersion(const QString &str); 75 | void setVersion(const QString &str); 76 | void setVersionId(const QString &str); 77 | void setChecksum(const QString &str); 78 | 79 | signals: 80 | void nameChanged(); 81 | void urlChanged(); 82 | void packageIdChanged(); 83 | void friendlyNameChanged(); 84 | void codeChanged(); 85 | void sizeChanged(); 86 | void isMarkedChanged(); 87 | void isAvailableChanged(); 88 | void isInstalledChanged(); 89 | void typeChanged(); 90 | void installedVersionChanged(); 91 | void versionChanged(); 92 | void versionIdChanged(); 93 | void checksumChanged(); 94 | 95 | private: 96 | QString _name; 97 | QString _url; 98 | QString _friendlyName; 99 | QString _packageId; 100 | int _code; 101 | int _size; 102 | bool _isMarked; 103 | bool _isAvailable; 104 | bool _isInstalled; 105 | QString _type; 106 | QString _installedVersion; 107 | QString _version; 108 | QString _versionId; 109 | QString _checksum; 110 | }; 111 | -------------------------------------------------------------------------------- /src/deviceinfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class DeviceInfo : public QObject { 7 | Q_OBJECT 8 | Q_PROPERTY(QString friendlyName MEMBER friendlyName NOTIFY friendlyNameChanged) 9 | Q_PROPERTY(QString os MEMBER os WRITE setOs NOTIFY osChanged) 10 | Q_PROPERTY(QString radio MEMBER radio WRITE setRadio NOTIFY radioChanged) 11 | Q_PROPERTY(int battery MEMBER battery WRITE setBattery NOTIFY batteryChanged) 12 | Q_PROPERTY(QString name MEMBER name WRITE setName NOTIFY nameChanged) 13 | Q_PROPERTY(QString pin MEMBER pin WRITE setPin NOTIFY pinChanged) 14 | Q_PROPERTY(QString hw MEMBER hw WRITE setHw NOTIFY hwChanged) 15 | Q_PROPERTY(int hwFamily MEMBER hwFamily WRITE setHwFamily NOTIFY hwFamilyChanged) 16 | Q_PROPERTY(QString bbid MEMBER bbid WRITE setBbid NOTIFY bbidChanged) 17 | Q_PROPERTY(int protocol MEMBER protocol WRITE setProtocol NOTIFY protocolChanged) 18 | Q_PROPERTY(bool devMode MEMBER devMode WRITE setDevMode NOTIFY devModeChanged) 19 | Q_PROPERTY(bool setupComplete MEMBER setupComplete WRITE setSetupComplete NOTIFY setupCompleteChanged()) 20 | Q_PROPERTY(QString restrictions MEMBER restrictions WRITE setRestrictions NOTIFY restrictionsChanged) 21 | Q_PROPERTY(QString refurbDate MEMBER refurbDate WRITE setRefurbDate NOTIFY refurbDateChanged) 22 | Q_PROPERTY(quint64 freeSpace MEMBER freeSpace WRITE setFreeSpace NOTIFY freeSpaceChanged) 23 | Q_PROPERTY(QString bsn MEMBER bsn WRITE setBsn NOTIFY bsnChanged) 24 | public: 25 | DeviceInfo() 26 | : QObject() 27 | , radio("N/A") 28 | , battery(-1) 29 | , hwFamily(0) 30 | , protocol(1) 31 | , devMode(false) 32 | , freeSpace(0) 33 | { 34 | } 35 | QString friendlyName; 36 | QString os; 37 | QString radio; 38 | int battery; 39 | QString name; 40 | QString pin; 41 | QString hw; 42 | int hwFamily; 43 | QString bbid; 44 | int protocol; 45 | bool devMode; 46 | bool setupComplete; 47 | QString restrictions; 48 | QString refurbDate; 49 | quint64 freeSpace; 50 | QString bsn; 51 | void setFriendlyName(const QString &input) { friendlyName = input; emit friendlyNameChanged(); } 52 | void setOs(const QString &input) { os = input; emit osChanged(); } 53 | void setRadio(const QString &input) { radio = input; emit radioChanged(); } 54 | void setBattery(const int &input) { battery = input; emit batteryChanged(); } 55 | void setName(const QString &input) { name = input; emit nameChanged(); } 56 | void setPin(const QString &input) { pin = input; emit pinChanged(); } 57 | void setHw(const QString &input) { hw = input; emit hwChanged(); } 58 | void setHwFamily(const int &input) { hwFamily = input; emit hwFamilyChanged(); } 59 | void setBbid(const QString &input) { bbid = input; emit bbidChanged(); } 60 | void setProtocol(const int &input) { protocol = input; emit protocolChanged(); } 61 | void setDevMode(const bool &input) { devMode = input; emit devModeChanged(); } 62 | void setSetupComplete(const bool &input) { setupComplete = input; emit setupCompleteChanged(); } 63 | void setRestrictions(const QString &input) { restrictions = input; emit restrictionsChanged(); } 64 | void setRefurbDate(const QString &input) { 65 | if (input.toInt() == 0) 66 | refurbDate = ""; 67 | else 68 | refurbDate = QDateTime::fromTime_t(input.toInt()).toString(); 69 | emit refurbDateChanged(); 70 | } 71 | void setFreeSpace(const quint64 &input) { freeSpace = input; emit freeSpaceChanged(); } 72 | void setBsn(const QString &input) { bsn = input; emit bsnChanged(); } 73 | 74 | signals: 75 | void friendlyNameChanged(); 76 | void osChanged(); 77 | void radioChanged(); 78 | void batteryChanged(); 79 | void nameChanged(); 80 | void pinChanged(); 81 | void hwChanged(); 82 | void hwFamilyChanged(); 83 | void bbidChanged(); 84 | void protocolChanged(); 85 | void devModeChanged(); 86 | void setupCompleteChanged(); 87 | void restrictionsChanged(); 88 | void refurbDateChanged(); 89 | void freeSpaceChanged(); 90 | void bsnChanged(); 91 | 92 | }; 93 | Q_DECLARE_METATYPE(DeviceInfo* ); 94 | -------------------------------------------------------------------------------- /src/fs/fs.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #include "fs.h" 19 | 20 | #ifdef _WIN32 21 | void fixFileTime(QString filename, int time) { 22 | FILETIME pft; 23 | LONGLONG ll = Int32x32To64(time, 10000000) + 116444736000000000; 24 | pft.dwLowDateTime = (DWORD)ll; 25 | pft.dwHighDateTime = ll >> 32; 26 | HANDLE fd_handle = CreateFile(filename.toStdWString().c_str(), FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); 27 | SetFileTime(fd_handle, &pft,(LPFILETIME) nullptr, &pft); 28 | CloseHandle(fd_handle); 29 | } 30 | #endif 31 | 32 | QFileSystem::QFileSystem(QString filename, QIODevice* file, qint64 offset, qint64 size, QString path, QString imageExt) 33 | : QObject(nullptr) 34 | , _file(file) 35 | , _offset(offset) 36 | , _size(size) 37 | , _path(path) 38 | , _filename(filename) 39 | , _imageExt(imageExt) 40 | { 41 | if (_file == nullptr) { 42 | _file = new QFile(filename); 43 | _file->open(QIODevice::ReadOnly); 44 | size = _file->size(); 45 | } 46 | } 47 | 48 | // Free anything we made here 49 | QFileSystem::~QFileSystem() { 50 | // TODO: Better tracking of whether we created this? 51 | // Assume offset of 0 means we decided to let QFileSystem make it 52 | if (_offset == 0) { 53 | if (_file->isOpen()) 54 | _file->close(); 55 | delete _file; 56 | } 57 | } 58 | 59 | // A method to append numbers to a filename/folder until it is unique 60 | QString QFileSystem::uniqueDir(QString name) { 61 | int counter = 0; 62 | while (QDir(name + (counter++ > 0 ? QString::number(counter + 1) : "")).exists()); 63 | 64 | return name + (counter > 1 ? QString::number(counter) : ""); 65 | } 66 | QString QFileSystem::uniqueFile(QString name) { 67 | int counter = 0; 68 | while (QFile::exists(name + (counter++ > 0 ? QString::number(counter + 1) : ""))); 69 | 70 | return name + (counter > 1 ? QString::number(counter) : ""); 71 | } 72 | 73 | // A generic method of working out new name based on old name 74 | QString QFileSystem::generateName(QString imageExt) { 75 | QString name = QFileInfo(_filename).completeBaseName(); 76 | if (imageExt.isEmpty()) 77 | return uniqueDir(name); 78 | 79 | return uniqueFile(name + imageExt); 80 | } 81 | 82 | // Entry for requesting an extration of the filesystem image 83 | bool QFileSystem::extractImage() { 84 | curSize = 0; 85 | maxSize = _size; 86 | return this->createImage(this->generateName(_imageExt)); 87 | } 88 | 89 | // A generic method for extracting an entire image of maxSize 90 | bool QFileSystem::createImage(QString name) { 91 | return writeFile(name, _offset, maxSize); 92 | } 93 | 94 | // Entry for requesting an extration of the filesystem contents 95 | bool QFileSystem::extractContents() { 96 | curSize = 0; 97 | maxSize = _size; 98 | _path += "/" + this->generateName(); 99 | return this->createContents(); 100 | } 101 | 102 | // A method to write writeSize bytes from a QIODevice to a new file, named filename 103 | bool QFileSystem::writeFile(QString fileName, qint64 offset, qint64 writeSize, bool absolute) { 104 | _file->seek(offset); 105 | QFile newFile; 106 | if (absolute) 107 | newFile.setFileName(fileName); 108 | else 109 | newFile.setFileName(_path + "/" + fileName); 110 | if (!newFile.open(QIODevice::WriteOnly)) 111 | return false; 112 | qint64 endSize = curSize + writeSize; 113 | while (endSize > curSize) { 114 | int diff = newFile.write(_file->read(qMin(BUFFER_LEN, endSize - curSize))); 115 | if (diff <= 0) 116 | return false; 117 | increaseCurSize(diff); 118 | } 119 | newFile.close(); 120 | 121 | return true; 122 | } 123 | -------------------------------------------------------------------------------- /qml/generic/USBConnect.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.2 2 | import QtQuick.Controls 1.1 3 | import QtQuick.Layouts 1.1 4 | 5 | Item { 6 | id:main 7 | visible: titleRow.currentIndex > 2 && (i.device === null || i.loginBlock || i.wrongPass || !i.completed) 8 | anchors.fill: parent 9 | 10 | ColumnLayout { 11 | id: develText 12 | anchors.centerIn: parent 13 | height: parent.height / 2 14 | Label { 15 | Layout.alignment: Qt.AlignTop | Qt.AlignHCenter 16 | text: qsTr("These tools require a USB connection") + translator.lang 17 | } 18 | RowLayout { 19 | Layout.alignment: Qt.AlignHCenter 20 | ColumnLayout { 21 | Label { 22 | text: qsTr("Password:") + translator.lang 23 | } 24 | Label { 25 | id: subtextValue 26 | visible: i.wrongPass 27 | text: qsTr("Incorrect") + translator.lang 28 | color: "red" 29 | } 30 | } 31 | TextField { 32 | id: passText 33 | property bool showing: false 34 | property string pass_init: i.password 35 | text: pass_init; 36 | Timer { id: try_again; interval: 100; onTriggered: i.wrongPass = false } 37 | onTextChanged: { 38 | if (i.password !== text) { 39 | i.password = text 40 | if (i.wrongPass) 41 | try_again.restart() 42 | } 43 | } 44 | echoMode: showing ? TextInput.Normal : TextInput.Password 45 | } 46 | Button { 47 | tooltip: passText.showing ? qsTr("Hide Password") : qsTr("Show Password") + translator.lang 48 | anchors { left: passText.right; leftMargin: 10; verticalCenter: passText.verticalCenter } 49 | iconSource: "showpass.png" 50 | onClicked: passText.showing = !passText.showing 51 | } 52 | } 53 | ColumnLayout { 54 | visible: i.loginBlock 55 | Label { 56 | text: qsTr("There was an issue connecting.") + translator.lang 57 | } 58 | Button { 59 | text: qsTr("Try Again") + translator.lang 60 | onClicked: i.loginBlock = false 61 | } 62 | } 63 | RowLayout { 64 | Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter 65 | ColumnLayout { 66 | Label { 67 | visible: !i.loginBlock && !detected.visible 68 | text: qsTr("Searching for USB device") + translator.lang 69 | } 70 | Label { 71 | id: detected 72 | property int numDevices: typeof b != 'undefined' ? b.devices.length : 0 73 | property int deviceType: numDevices ? b.devices[0] : 0 74 | property string deviceName: switch(deviceType) { 75 | case 1: return "Bootloader" 76 | case 8012: return "Windows" 77 | case 8013: return "Unix" 78 | case 8017: return "Autodetect" 79 | default: return "" 80 | } 81 | 82 | visible: numDevices 83 | text: qsTr("Detected %1 Blackberry USB device(s) in %2 mode.").arg(numDevices).arg(deviceName) + translator.lang 84 | } 85 | Label { 86 | visible: i.possibleDevices 87 | Layout.alignment: Qt.AlignHCenter 88 | text: qsTr("Talking to %1 possible device(s).").arg(i.possibleDevices) + translator.lang 89 | } 90 | Button { 91 | visible: i.hasLog 92 | Layout.alignment: Qt.AlignHCenter 93 | text: qsTr("Connection Log")+ translator.lang 94 | onClicked: i.openLog(); 95 | } 96 | } 97 | BusyIndicator { 98 | visible: !i.loginBlock 99 | height: parent.implicitHeight + 7 100 | width: height 101 | } 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/carrierinfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | class CarrierInfo : public QObject { 25 | Q_OBJECT 26 | Q_PROPERTY(QString country MEMBER _country NOTIFY resultChanged) 27 | Q_PROPERTY(QString carrier MEMBER _carrier NOTIFY resultChanged) 28 | Q_PROPERTY(QString mcc MEMBER _mcc NOTIFY resultChanged) 29 | Q_PROPERTY(QString mnc MEMBER _mnc NOTIFY resultChanged) 30 | Q_PROPERTY(int image MEMBER _image NOTIFY resultChanged) 31 | 32 | public: 33 | CarrierInfo(QObject* parent = 0) 34 | : QObject(parent) 35 | { 36 | _manager = new QNetworkAccessManager(); 37 | _timer = new QTimer(); 38 | _timer->setSingleShot(true); 39 | connect(_timer, SIGNAL(timeout()), this, SLOT(update())); 40 | _mcc = ""; 41 | _mnc = ""; 42 | _image = 0; 43 | } 44 | 45 | Q_INVOKABLE void mccChange(QString mcc) { 46 | if (mcc != _mcc) { 47 | _mcc = mcc; 48 | update(); 49 | } 50 | } 51 | 52 | Q_INVOKABLE void mncChange(QString mnc){ 53 | if (mnc != _mnc) { 54 | _mnc = mnc; 55 | update(); 56 | } 57 | } 58 | 59 | public slots: 60 | void update() { 61 | // Make sure the search is still relevant when the results come in 62 | QString mcc = _mcc; 63 | QString mnc = _mnc; 64 | if (mcc == "" || mnc == "") 65 | return; 66 | 67 | QNetworkRequest request(QString("http://appworld.blackberry.com/ClientAPI/checkcarrier?homemcc=%1&homemnc=%2&devicevendorid=-1&pin=0") 68 | .arg(_mcc) 69 | .arg(_mnc)); 70 | request.setHeader(QNetworkRequest::KnownHeaders::UserAgentHeader, "AppWorld/5.1.0.60"); 71 | QNetworkReply* reply = _manager->get(request); 72 | connect(reply, &QNetworkReply::finished, [=] { 73 | int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); 74 | if (reply->size() > 0 && (status == 200 || (status > 300 && status <= 308))) { 75 | if (mcc != _mcc || mnc != _mnc) 76 | return; 77 | QXmlStreamReader xml(reply->readAll()); 78 | while(!xml.atEnd() && !xml.hasError()) { 79 | if(xml.tokenType() == QXmlStreamReader::StartElement) { 80 | if (xml.name() == "country") { 81 | _country = xml.attributes().value("name").toString(); 82 | } else if (xml.name() == "carrier") { 83 | _carrier = xml.attributes().value("name").toString().split(" ").first(); 84 | _image = xml.attributes().value("icon").toInt(); 85 | 86 | // Don't show generic 87 | if (_carrier == "default") { 88 | _carrier = ""; 89 | _image = 0; 90 | } 91 | } 92 | } 93 | xml.readNext(); 94 | } 95 | } 96 | emit resultChanged(); 97 | reply->deleteLater(); 98 | }); 99 | connect(reply, static_cast(&QNetworkReply::error), [=]() { 100 | _country = ""; 101 | _carrier = ""; 102 | _image = 0; 103 | reply->deleteLater(); 104 | }); 105 | } 106 | 107 | signals: 108 | void resultChanged(); 109 | private: 110 | QString _country, _carrier; 111 | QString _mcc, _mnc; 112 | int _image; 113 | QNetworkAccessManager* _manager; 114 | QTimer* _timer; 115 | }; 116 | -------------------------------------------------------------------------------- /src/search/scanner.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "discoveredrelease.h" 24 | 25 | class Scanner : public QObject { 26 | Q_OBJECT 27 | Q_PROPERTY(bool finishedScan READ finishedScan NOTIFY signalFinished) 28 | Q_PROPERTY(bool isAuto READ isAuto WRITE setIsAuto NOTIFY isAutoChanged) 29 | Q_PROPERTY(bool isActive READ isActive WRITE setIsActive NOTIFY isActiveChanged) 30 | Q_PROPERTY(int findExisting READ findExisting WRITE setFindExisting NOTIFY findExistingChanged) 31 | Q_PROPERTY(DiscoveredRelease* curRelease READ curRelease NOTIFY curReleaseChanged) 32 | 33 | Q_PROPERTY(QQmlListProperty history READ history NOTIFY historyChanged) 34 | public: 35 | Scanner() 36 | : QObject() 37 | , _finishedScan(false) 38 | , _isAuto(false) 39 | , _isActive(false) 40 | , _findExisting(0) 41 | , _scansActive(0) 42 | , _curRelease(NULL) 43 | { 44 | _manager = new QNetworkAccessManager(); 45 | } 46 | virtual ~Scanner() {} 47 | bool isAuto() const { return _isAuto; } 48 | bool isActive() const { return _isActive; } 49 | int findExisting() const { return _findExisting; } 50 | QString softwareRelease() const { return _softwareRelease; } 51 | DiscoveredRelease* curRelease() { return _curRelease; } 52 | QQmlListProperty history() { 53 | return QQmlListProperty(this, _history); 54 | } 55 | void completeScan() { 56 | _scansActive--; 57 | if (_scansActive < 0) 58 | _scansActive = 0; 59 | if (_scansActive == 0) { 60 | // Did we get a version that either exists or we didn't care? 61 | if (_curRelease->srVersion().startsWith('1')) { 62 | if (_findExisting != 2 && (_findExisting != 1 || _curRelease->baseUrl() != "")) { 63 | setIsAuto(false); 64 | } 65 | _history.prepend(_curRelease); 66 | emit historyChanged(); 67 | } else { 68 | _curRelease->setSrVersion(tr("No Release")); 69 | } 70 | setIsActive(false); 71 | finishedFunc(); 72 | } 73 | emit curReleaseChanged(); 74 | } 75 | // Because Cascades is stupid 76 | void finishedFunc() { 77 | emit signalFinished(); 78 | _finishedScan = true; emit signalFinished(); 79 | _finishedScan = false; 80 | } 81 | void setIsAuto(bool isAuto) { _isAuto = isAuto; emit isAutoChanged(); } 82 | void setIsActive(bool isActive) { _isActive = isActive; emit isActiveChanged(); } 83 | void setFindExisting(int findExisting) { _findExisting = findExisting; emit findExistingChanged(); } 84 | 85 | Q_INVOKABLE void clearHistory(); 86 | Q_INVOKABLE void exportHistory(); 87 | Q_INVOKABLE void reverseLookup(QString OSver); 88 | Q_INVOKABLE void generatePotentialLinks(); 89 | 90 | bool finishedScan() const { return _finishedScan; } 91 | 92 | private slots: 93 | void newSRVersion(); 94 | void validateDownload(); 95 | void serverError(QNetworkReply::NetworkError err); 96 | 97 | Q_SIGNALS: 98 | void signalFinished(); 99 | void isAutoChanged(); 100 | void isActiveChanged(); 101 | void findExistingChanged(); 102 | void softwareReleaseChanged(); 103 | void curReleaseChanged(); 104 | void historyChanged(); 105 | 106 | private: 107 | bool _finishedScan; 108 | bool _isAuto, _isActive; 109 | int _findExisting; 110 | int _scansActive; 111 | QString _softwareRelease; 112 | DiscoveredRelease* _curRelease; 113 | QList _history; 114 | QNetworkAccessManager* _manager; 115 | 116 | void appendNewLink(QString *potentialText, QString linkType, QString hwType, QString version); 117 | }; 118 | -------------------------------------------------------------------------------- /Android/include/openssl/ripemd.h: -------------------------------------------------------------------------------- 1 | /* crypto/ripemd/ripemd.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RIPEMD_H 60 | #define HEADER_RIPEMD_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | #ifdef OPENSSL_NO_RIPEMD 70 | #error RIPEMD is disabled. 71 | #endif 72 | 73 | #if defined(__LP32__) 74 | #define RIPEMD160_LONG unsigned long 75 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 76 | #define RIPEMD160_LONG unsigned long 77 | #define RIPEMD160_LONG_LOG2 3 78 | #else 79 | #define RIPEMD160_LONG unsigned int 80 | #endif 81 | 82 | #define RIPEMD160_CBLOCK 64 83 | #define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) 84 | #define RIPEMD160_DIGEST_LENGTH 20 85 | 86 | typedef struct RIPEMD160state_st 87 | { 88 | RIPEMD160_LONG A,B,C,D,E; 89 | RIPEMD160_LONG Nl,Nh; 90 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; 91 | unsigned int num; 92 | } RIPEMD160_CTX; 93 | 94 | int RIPEMD160_Init(RIPEMD160_CTX *c); 95 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); 96 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); 97 | unsigned char *RIPEMD160(const unsigned char *d, size_t n, 98 | unsigned char *md); 99 | void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); 100 | #ifdef __cplusplus 101 | } 102 | #endif 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /Android/include/openssl/rc2.h: -------------------------------------------------------------------------------- 1 | /* crypto/rc2/rc2.h */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC2_H 60 | #define HEADER_RC2_H 61 | 62 | #include /* OPENSSL_NO_RC2, RC2_INT */ 63 | #ifdef OPENSSL_NO_RC2 64 | #error RC2 is disabled. 65 | #endif 66 | 67 | #define RC2_ENCRYPT 1 68 | #define RC2_DECRYPT 0 69 | 70 | #define RC2_BLOCK 8 71 | #define RC2_KEY_LENGTH 16 72 | 73 | #ifdef __cplusplus 74 | extern "C" { 75 | #endif 76 | 77 | typedef struct rc2_key_st 78 | { 79 | RC2_INT data[64]; 80 | } RC2_KEY; 81 | 82 | 83 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); 84 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, 85 | int enc); 86 | void RC2_encrypt(unsigned long *data,RC2_KEY *key); 87 | void RC2_decrypt(unsigned long *data,RC2_KEY *key); 88 | void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 89 | RC2_KEY *ks, unsigned char *iv, int enc); 90 | void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, 91 | long length, RC2_KEY *schedule, unsigned char *ivec, 92 | int *num, int enc); 93 | void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, 94 | long length, RC2_KEY *schedule, unsigned char *ivec, 95 | int *num); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /src/ports.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Sacha Refshauge 2 | 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, version 3.0. 6 | 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU General Public License 3.0 for more details. 11 | 12 | // A copy of the GPL 3.0 should have been included with the program. 13 | // If not, see http://www.gnu.org/licenses/ 14 | 15 | // Official GIT repository and contact information can be found at 16 | // http://github.com/xsacha/Sachesi 17 | 18 | #pragma once 19 | 20 | // For portability between platforms and Qt versions. 21 | // Clears up the code in the more important files. 22 | // Also a make-shift utility file 23 | 24 | #ifndef BLACKBERRY 25 | #include 26 | #include 27 | #include 28 | #include 29 | #endif 30 | #include 31 | #include 32 | 33 | #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 34 | #include 35 | #else 36 | #include 37 | #define encodedQuery query(QUrl::FullyEncoded).toUtf8 38 | #endif 39 | 40 | // TODO: Maybe name families by radio 41 | enum DeviceFamily { 42 | UnknownFamily = 0, 43 | Z30Family, 44 | OMAPFamily, 45 | Z10Family, 46 | Z3Family, 47 | Q30Family, 48 | Q10Family, 49 | }; 50 | 51 | static QStringList dev[] = { 52 | // 0 = Z30 (A Series) + Classic + Leap 53 | QStringList() << "STA 100-1" << "STA 100-2" << "STA 100-3" << "STA 100-4" << "STA 100-5" << "STA 100-6" << "SQC 100-1" << "SQC 100-2" << "SQC 100-3" << "SQC 100-4" << "SQC 100-5" << "STR 100-1" << "STR 100-2", 54 | QStringList() << "8C00240A" << "8D00240A" << "8E00240A" << "8F00240A" << "9500240A" << "B500240A" << "9600270A" << "9400270A" << "9500270A" << "9700270A" << "9C00270A" << "07002E0A" << "06002E0A", 55 | // 1 = Z10 (L Series) OMAP 56 | QStringList() << "STL 100-1", 57 | QStringList() << "4002607", 58 | // 2 = Z10 (L Series) Qualcomm + P9982 (TK Series) 59 | QStringList() << "STL 100-2" << "STL 100-3" << "STL 100-4" << "STK 100-1" << "STK 100-2", 60 | QStringList() << "8700240A" << "8500240A" << "8400240A" << "A500240A" << "A600240A", 61 | // 3 = Z3 (J Series) + Cafe 62 | QStringList() << "STJ 100-1" << "STJ 100-2" << "Kopi NA" << "Kopi Europe/ME/Asia" << "Cafe ROW" << "Cafe AT/T" << "Cafe LatinAm" << "Cafe Verizon" << "Cafe Sprint", 63 | QStringList() << "04002E07" << "05002E07" << "87002A07" << "8C002A07" << "9600240A" << "9700240A" << "9C00240A" << "A700240A" << "AC00240A", 64 | // 4 = Passport / Q30 (W Series) 65 | QStringList() << "SQW 100-1" << "SQW 100-2" << "SQW 100-3" << "SQW 100-4" << "Passport Wichita", 66 | QStringList() << "87002C0A" << "85002C0A" << "84002C0A" << "86002C0A" << "8C002C0A", 67 | // 5 = Q5 (R Series) + Q10 (N Series) + P9983 (QK Series) 68 | QStringList() << "SQR 100-1" << "SQR 100-2" << "SQR 100-3" << "SQN 100-1" << "SQN 100-2" << "SQN 100-3" << "SQN 100-4" << "SQN 100-5" << "SQK 100-1" << "SQK 100-2", 69 | QStringList() << "84002A0A" << "85002A0A" << "86002A0A" << "8400270A" << "8500270A" << "8600270A" << "8C00270A" << "8700270A" << "8F00270A" << "8E00270A", 70 | // 6 = Dev Alpha 71 | QStringList() << "Alpha A" << "Alpha B" << "Alpha C", 72 | QStringList() << "4002307" << "4002607" << "8D00270A", 73 | // 7 = Ontario Series 74 | QStringList() << "Ontario NA" << "Ontario Verizon" << "Ontario Sprint" << "Ontario ROW" << "China", 75 | QStringList() << "AE00240A" << "AF00240A" << "B400240A" << "B600240A" << "BC00240A", 76 | }; 77 | 78 | QPair getFamilyFromDevice(int device, bool specialQ30); 79 | QString capPath(bool temp = false); 80 | #ifndef BLACKBERRY 81 | QFileDialog* selectFiles(QString title, QString dir, QString nameString, QString nameExt); 82 | #endif 83 | QString getSaveDir(); 84 | bool checkCurPath(); 85 | void openFile(QString name); 86 | void writeDisplayFile(QString type, QString writeText); 87 | bool isVersionNewer(QString first, QString second, bool orSame); 88 | 89 | // These may not be entirely necessary but there have been issues in the past 90 | #define qSafeFree(x) \ 91 | if (x != nullptr) { \ 92 | x->deleteLater(); \ 93 | x = nullptr; \ 94 | } 95 | #define qIoSafeFree(x) \ 96 | if (x != nullptr) { \ 97 | if (x->isOpen()) \ 98 | x->close(); \ 99 | x->deleteLater(); \ 100 | x = nullptr; \ 101 | } 102 | #define ioSafeFree(x) \ 103 | if (x != nullptr) { \ 104 | if (x->isOpen()) \ 105 | x->close(); \ 106 | delete x; \ 107 | x = nullptr; \ 108 | } 109 | -------------------------------------------------------------------------------- /Android/include/openssl/stack.h: -------------------------------------------------------------------------------- 1 | /* crypto/stack/stack.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_STACK_H 60 | #define HEADER_STACK_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | typedef struct stack_st 67 | { 68 | int num; 69 | char **data; 70 | int sorted; 71 | 72 | int num_alloc; 73 | int (*comp)(const void *, const void *); 74 | } _STACK; /* Use STACK_OF(...) instead */ 75 | 76 | #define M_sk_num(sk) ((sk) ? (sk)->num:-1) 77 | #define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) 78 | 79 | int sk_num(const _STACK *); 80 | void *sk_value(const _STACK *, int); 81 | 82 | void *sk_set(_STACK *, int, void *); 83 | 84 | _STACK *sk_new(int (*cmp)(const void *, const void *)); 85 | _STACK *sk_new_null(void); 86 | void sk_free(_STACK *); 87 | void sk_pop_free(_STACK *st, void (*func)(void *)); 88 | int sk_insert(_STACK *sk, void *data, int where); 89 | void *sk_delete(_STACK *st, int loc); 90 | void *sk_delete_ptr(_STACK *st, void *p); 91 | int sk_find(_STACK *st, void *data); 92 | int sk_find_ex(_STACK *st, void *data); 93 | int sk_push(_STACK *st, void *data); 94 | int sk_unshift(_STACK *st, void *data); 95 | void *sk_shift(_STACK *st); 96 | void *sk_pop(_STACK *st); 97 | void sk_zero(_STACK *st); 98 | int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *))) 99 | (const void *, const void *); 100 | _STACK *sk_dup(_STACK *st); 101 | void sk_sort(_STACK *st); 102 | int sk_is_sorted(const _STACK *st); 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /qml/generic/UI/CircleProgress.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import QtQml 2.1 3 | 4 | Canvas { 5 | id: canvas 6 | //width: 240 7 | //height: 240 8 | 9 | property color primaryColor: "darkorange" 10 | property color secondaryColor: "steelblue" 11 | 12 | property real centerWidth: width / 2 13 | property real centerHeight: height / 2 14 | property real radius: Math.min(canvas.width - 8, canvas.height - 8) / 2 15 | 16 | property real minimumValue: 0 17 | property real maximumValue: 100 18 | property real currentValue: 0 19 | // To show on click 20 | property real overallValue: -1 21 | property real viewValue: (overallValue > -1 && mouseArea.pressed) ? overallValue : currentValue 22 | property real curId: 0 23 | property real maxId: 0 24 | 25 | // this is the angle that splits the circle in two arcs 26 | // first arc is drawn from 0 radians to angle radians 27 | // second arc is angle radians to 2*PI radians 28 | property real angle: (viewValue - minimumValue) / (maximumValue - minimumValue) * 2 * Math.PI 29 | 30 | // we want both circle to start / end at 12 o'clock 31 | // without this offset we would start / end at 9 o'clock 32 | property real angleOffset: -Math.PI / 2 33 | 34 | property string text: "" 35 | property string statusText: "" 36 | 37 | signal clicked() 38 | 39 | onPrimaryColorChanged: requestPaint() 40 | onSecondaryColorChanged: requestPaint() 41 | onMinimumValueChanged: requestPaint() 42 | onMaximumValueChanged: requestPaint() 43 | onHeightChanged: requestPaint(); 44 | // Keeps turning off 45 | onViewValueChanged: { requestPaint(); antialiasing = true; } 46 | 47 | onPaint: { 48 | var ctx = getContext("2d"); 49 | ctx.save(); 50 | 51 | ctx.clearRect(0, 0, canvas.width, canvas.height); 52 | 53 | // fills the mouse area when pressed 54 | // the fill color is a lighter version of the 55 | // secondary color 56 | 57 | if (mouseArea.pressed) { 58 | ctx.beginPath(); 59 | ctx.lineWidth = 1; 60 | ctx.fillStyle = Qt.lighter(canvas.primaryColor, 1.25); 61 | ctx.arc(canvas.centerWidth, 62 | canvas.centerHeight, 63 | canvas.radius, 64 | 0, 65 | 2*Math.PI); 66 | ctx.fill(); 67 | } 68 | 69 | // First, thinner arc 70 | // From angle to 2*PI 71 | 72 | ctx.beginPath(); 73 | ctx.lineWidth = 3; 74 | ctx.strokeStyle = primaryColor; 75 | ctx.arc(canvas.centerWidth, 76 | canvas.centerHeight, 77 | canvas.radius, 78 | angleOffset + canvas.angle, 79 | angleOffset + 2*Math.PI); 80 | ctx.stroke(); 81 | 82 | 83 | // Second, thicker arc 84 | // From 0 to angle 85 | 86 | ctx.beginPath(); 87 | ctx.lineWidth = 8; 88 | ctx.strokeStyle = canvas.secondaryColor; 89 | ctx.arc(canvas.centerWidth, 90 | canvas.centerHeight, 91 | canvas.radius, 92 | canvas.angleOffset, 93 | canvas.angleOffset + canvas.angle); 94 | ctx.stroke(); 95 | 96 | ctx.restore(); 97 | } 98 | 99 | Column { 100 | anchors.centerIn: parent 101 | spacing: height / 6 102 | add: Transition { 103 | NumberAnimation { 104 | duration: 100 105 | properties: "y" 106 | easing.type: Easing.OutBounce 107 | } 108 | } 109 | 110 | Text { 111 | text: canvas.statusText 112 | font.bold: true 113 | anchors.horizontalCenter: parent.horizontalCenter 114 | } 115 | 116 | Text { 117 | text: canvas.text.substring(0, 35) 118 | //color: canvas.primaryColor 119 | anchors.horizontalCenter: parent.horizontalCenter 120 | } 121 | // Show count if we are looking at individual percents 122 | Text { 123 | visible: !mouseArea.pressed && maxId > 0; 124 | text: qsTr("%1 of %2").arg(curId).arg(maxId) + translator.lang 125 | anchors.horizontalCenter: parent.horizontalCenter 126 | } 127 | Text { 128 | text: viewValue + "%" 129 | font.bold: true 130 | scale: mouseArea.pressed ? 2.0 : 1.0 131 | Behavior on scale { NumberAnimation { duration: 100 } } 132 | color: canvas.secondaryColor 133 | anchors.horizontalCenter: parent.horizontalCenter 134 | } 135 | } 136 | 137 | MouseArea { 138 | id: mouseArea 139 | 140 | anchors.fill: parent 141 | onClicked: canvas.clicked(); 142 | onPressedChanged: canvas.requestPaint() 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /Android/include/openssl/hmac.h: -------------------------------------------------------------------------------- 1 | /* crypto/hmac/hmac.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | #ifndef HEADER_HMAC_H 59 | #define HEADER_HMAC_H 60 | 61 | #include 62 | 63 | #ifdef OPENSSL_NO_HMAC 64 | #error HMAC is disabled. 65 | #endif 66 | 67 | #include 68 | 69 | #define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ 70 | 71 | #ifdef __cplusplus 72 | extern "C" { 73 | #endif 74 | 75 | typedef struct hmac_ctx_st 76 | { 77 | const EVP_MD *md; 78 | EVP_MD_CTX md_ctx; 79 | EVP_MD_CTX i_ctx; 80 | EVP_MD_CTX o_ctx; 81 | unsigned int key_length; 82 | unsigned char key[HMAC_MAX_MD_CBLOCK]; 83 | } HMAC_CTX; 84 | 85 | #define HMAC_size(e) (EVP_MD_size((e)->md)) 86 | 87 | 88 | void HMAC_CTX_init(HMAC_CTX *ctx); 89 | void HMAC_CTX_cleanup(HMAC_CTX *ctx); 90 | 91 | #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ 92 | 93 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, 94 | const EVP_MD *md); /* deprecated */ 95 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, 96 | const EVP_MD *md, ENGINE *impl); 97 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); 98 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); 99 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, 100 | const unsigned char *d, size_t n, unsigned char *md, 101 | unsigned int *md_len); 102 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); 103 | 104 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); 105 | 106 | #ifdef __cplusplus 107 | } 108 | #endif 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /Android/include/openssl/txt_db.h: -------------------------------------------------------------------------------- 1 | /* crypto/txt_db/txt_db.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_TXT_DB_H 60 | #define HEADER_TXT_DB_H 61 | 62 | #include 63 | #ifndef OPENSSL_NO_BIO 64 | #include 65 | #endif 66 | #include 67 | #include 68 | 69 | #define DB_ERROR_OK 0 70 | #define DB_ERROR_MALLOC 1 71 | #define DB_ERROR_INDEX_CLASH 2 72 | #define DB_ERROR_INDEX_OUT_OF_RANGE 3 73 | #define DB_ERROR_NO_INDEX 4 74 | #define DB_ERROR_INSERT_INDEX_CLASH 5 75 | 76 | #ifdef __cplusplus 77 | extern "C" { 78 | #endif 79 | 80 | typedef OPENSSL_STRING *OPENSSL_PSTRING; 81 | DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 82 | 83 | typedef struct txt_db_st 84 | { 85 | int num_fields; 86 | STACK_OF(OPENSSL_PSTRING) *data; 87 | LHASH_OF(OPENSSL_STRING) **index; 88 | int (**qual)(OPENSSL_STRING *); 89 | long error; 90 | long arg1; 91 | long arg2; 92 | OPENSSL_STRING *arg_row; 93 | } TXT_DB; 94 | 95 | #ifndef OPENSSL_NO_BIO 96 | TXT_DB *TXT_DB_read(BIO *in, int num); 97 | long TXT_DB_write(BIO *out, TXT_DB *db); 98 | #else 99 | TXT_DB *TXT_DB_read(char *in, int num); 100 | long TXT_DB_write(char *out, TXT_DB *db); 101 | #endif 102 | int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(OPENSSL_STRING *), 103 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); 104 | void TXT_DB_free(TXT_DB *db); 105 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value); 106 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /qml/generic/Title.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.2 2 | import QtQuick.Controls 1.1 3 | import QtQuick.Window 2.1 4 | import Qt.labs.settings 1.0 5 | import "UI" 1.0 6 | 7 | ApplicationWindow { 8 | id: window 9 | title: "Sachesi " + version 10 | width: 820 11 | height: 680 12 | minimumHeight: 540 13 | minimumWidth: 640 14 | function isNewer(newV, oldV){ 15 | 16 | var result=false; 17 | 18 | if(typeof newV !== 'object'){ newV=newV.toString().split('.'); } 19 | if(typeof oldV !== 'object'){ oldV=oldV.toString().split('.'); } 20 | 21 | for(var i=0; i<(Math.max(newV.length, oldV.length)); i++){ 22 | if(newV[i] == undefined){ newV[i]=0; } 23 | if(oldV[i] == undefined){ oldV[i]=0; } 24 | 25 | if(Number(newV[i])>Number(oldV[i])){ 26 | result=true; 27 | break; 28 | } 29 | if(newV[i] != oldV[i]){ 30 | break; 31 | } 32 | } 33 | return(result); 34 | } 35 | 36 | Component.onCompleted: { 37 | var http = new XMLHttpRequest() 38 | var url = "https://raw.githubusercontent.com/xsacha/Sachesi/master/Sachesi.pro"; 39 | http.open("GET", url, true); 40 | http.send(null) 41 | http.onreadystatechange = function() { 42 | if(http.readyState == 4 && http.status == 200) { 43 | var array = http.responseText.split('\n'); 44 | array = array.filter(function(e){return e}); 45 | for (var i = 1; i < 10; i++) { 46 | if (array[i].substring(0, 7) === "VERSION") { 47 | var newVer = array[i].split(' ').pop() 48 | if (isNewer(newVer, version)) { 49 | console.log("NEW VERSION FOUND. DO STUFF HERE") 50 | } 51 | 52 | break; 53 | } 54 | } 55 | } 56 | } 57 | } 58 | 59 | Settings { 60 | id: settings 61 | property alias x: window.x 62 | property alias y: window.y 63 | property alias width: window.width 64 | property alias height: window.height 65 | property url installFolder 66 | property url backupFolder 67 | property bool advanced: false 68 | property bool nativelang: true 69 | } 70 | 71 | Label { 72 | visible: !mobile 73 | id: title 74 | font.pointSize: 18 75 | text: "SACHESI" 76 | font.letterSpacing: (parent.width / 2) / text.length 77 | font.weight: Font.DemiBold 78 | smooth: true 79 | anchors.horizontalCenter: parent.horizontalCenter 80 | anchors.horizontalCenterOffset: font.letterSpacing / 2 81 | } 82 | 83 | Button { 84 | anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 1 } 85 | height: title.height + 7; width: height 86 | checkable: true 87 | checked: settings.advanced 88 | onClicked: settings.advanced = !settings.advanced 89 | text: checked ? "+H+" : "H" 90 | tooltip: qsTr("Advanced") + translator.lang 91 | } 92 | 93 | ComboBox { 94 | model: [ Qt.locale().nativeLanguageName, "English" ] 95 | anchors { right: parent.right; top: parent.top; topMargin: 1 } 96 | visible: translator.exists 97 | currentIndex: settings.nativelang ? 0 : 1 98 | 99 | onCurrentIndexChanged: { 100 | if (currentIndex === 0) { 101 | translator.load(); 102 | settings.nativelang = true; 103 | } else { 104 | translator.remove(); 105 | settings.nativelang = false; 106 | } 107 | } 108 | } 109 | 110 | TabView { 111 | id: titleRow 112 | width: parent.width 113 | // Qt5.2 bug requires timer to redraw layout correctly 114 | Timer { 115 | interval: 10 // Any number works 116 | running: true 117 | onTriggered: titleRow.currentIndex = 4 118 | } 119 | 120 | anchors {top: title.bottom; bottom: parent.bottom } 121 | 122 | Tab { 123 | title: qsTr("Device") + translator.lang 124 | Device { anchors.fill: parent } 125 | } 126 | Tab { 127 | title: qsTr("Extract") + translator.lang 128 | Extract { anchors.fill: parent } 129 | } 130 | Tab { 131 | title: qsTr("Search") + translator.lang 132 | Search { anchors.fill: parent } 133 | } 134 | Tab { 135 | title: qsTr("Backup") + translator.lang 136 | Backup { anchors.fill: parent } 137 | } 138 | Tab { 139 | title: qsTr("Install") + translator.lang 140 | Installer { anchors.fill: parent } 141 | } 142 | 143 | USBConnect { anchors.fill: parent } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /Sachesi.pro: -------------------------------------------------------------------------------- 1 | QT += network gui widgets quick qml 2 | 3 | TARGET="Sachesi" 4 | win32: RC_ICONS += assets/sachesi.ico 5 | else:mac: ICON = assets/sachesi.icns 6 | else: ICON = assets/sachesi.png 7 | VERSION = 2.0.4 8 | 9 | # Global specific 10 | CONFIG += c++11 11 | INCLUDEPATH += ext src 12 | P = $$_PRO_FILE_PWD_ 13 | 14 | win32 { 15 | SOURCES += $$P/ext/zlib-win/*.c 16 | HEADERS += $$P/ext/zlib-win/*.h 17 | INCLUDEPATH += ext/zlib-win 18 | 19 | # Where is your OpenSSL Install? Hardcoded for Win32 20 | OPENSSL_PATH = C:\\OpenSSL 21 | INCLUDEPATH += $$OPENSSL_PATH\\include 22 | 23 | # Is all-in-one binary? 24 | #CONFIG += static 25 | static: DEFINES += STATIC STATIC_BUILD 26 | 27 | !contains(QT_CONFIG, openssl-linked) { 28 | mingw: LIBS += -L$$OPENSSL_PATH -llibssl -llibcrypto -lgdi32 29 | else:static: LIBS += -L$$OPENSSL_PATH\\lib -llibeay32MT -lssleay32MT -lGDI32 -lAdvapi32 30 | else: LIBS += -L$$OPENSSL_PATH\\lib -llibeay32MD -lGDI32 31 | } 32 | 33 | !mingw { 34 | DEFINES += NOMINMAX _CRT_SECURE_NO_WARNINGS 35 | # Hardcoded lib folder for winsocks 36 | LIBS+= -L"C:\\Program Files (x86)\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\x86" -lWSock32 -lUser32 -lCrypt32 37 | } 38 | } 39 | else:blackberry { 40 | DEFINES += BLACKBERRY 41 | LIBS += -lz -lcrypto 42 | } 43 | else:mac { 44 | INCLUDEPATH += /opt/local/include 45 | LIBS+= -lcrypto -lssl -lz -framework CoreFoundation -framework IOKit -lobjc /opt/local/lib/libusb-1.0.a 46 | DEFINES += BOOTLOADER_ACCESS 47 | } 48 | else:freebsd-*|openbsd-* { 49 | isEmpty(PREFIX): PREFIX = /usr/local/ 50 | LIBS += -lz -lcrypto -lusb 51 | } 52 | else:android { 53 | LIBS += -L $$P/Android -lcrypto -lssl -lusb1.0 54 | INCLUDEPATH += $$P/Android/include/ 55 | ANDROID_EXTRA_LIBS += $$P/Android/libusb1.0.so 56 | ANDROID_PACKAGE_SOURCE_DIR = $$P/Android 57 | DEFINES += BOOTLOADER_ACCESS 58 | } else { 59 | shared_quazip: LIBS += -lquazip 60 | shared_lzo2 { 61 | LIBS += -llzo2 62 | DEFINES += _LZO2_SHARED 63 | } 64 | LIBS += -lz -ldl -ludev 65 | # These below should be static for it to be fully portable (changing ABIs) 66 | LIBS += -lcrypto -lusb-1.0 67 | DEFINES += BOOTLOADER_ACCESS 68 | } 69 | 70 | SOURCES += \ 71 | src/sachesi.cpp \ 72 | src/search/mainnet.cpp \ 73 | src/search/scanner.cpp \ 74 | src/splitter.cpp \ 75 | src/ports.cpp \ 76 | src/apps.cpp \ 77 | src/fs/ifs.cpp \ 78 | src/fs/fs.cpp \ 79 | src/fs/rcfs.cpp \ 80 | src/fs/qnx6.cpp 81 | 82 | HEADERS += \ 83 | src/search/mainnet.h \ 84 | src/search/scanner.h \ 85 | src/splitter.h \ 86 | src/ports.h \ 87 | src/downloadinfo.h \ 88 | src/apps.h \ 89 | src/fs/ifs.h \ 90 | src/fs/fs.h \ 91 | src/fs/rcfs.h \ 92 | src/fs/qnx6.h \ 93 | src/carrierinfo.h \ 94 | src/search/discoveredrelease.h \ 95 | src/autoloaderwriter.h \ 96 | src/deviceinfo.h \ 97 | src/translator.h 98 | 99 | # Welcome to the only OS that won't give network access to USB device 100 | !blackberry { 101 | SOURCES += \ 102 | src/installer.cpp \ 103 | src/installer_qml.cpp \ 104 | src/installer_establish.cpp \ 105 | src/installer_auth.cpp \ 106 | src/backupinfo.cpp \ 107 | src/blitzinfo.cpp 108 | HEADERS += \ 109 | src/installer.h \ 110 | src/backupinfo.h \ 111 | src/blitzinfo.h 112 | } 113 | 114 | # This requires libusb to be linked 115 | contains(DEFINES, BOOTLOADER_ACCESS) { 116 | SOURCES += src/boot.cpp 117 | HEADERS += src/boot.h 118 | } 119 | 120 | !shared_quazip { 121 | DEFINES += QUAZIP_STATIC 122 | include(ext/quazip/quazip.pri) 123 | } 124 | !shared_lzo2 { 125 | SOURCES += src/lzo.cpp 126 | HEADERS += src/lzo.h 127 | } 128 | 129 | RESOURCES += UI.qrc \ 130 | translations.qrc 131 | # The qmldir is built in for dynamic libs but not static. 132 | static: RESOURCES += QML.qrc 133 | OTHER_FILES += \ 134 | qml/generic/*.qml \ 135 | qml/generic/UI/*.qml \ 136 | Android/AndroidManifest.xml 137 | 138 | # Qt Workaround for having install.cpp file 139 | phony.depends = install uninstall 140 | phony.target = .PHONY 141 | QMAKE_EXTRA_TARGETS += phony 142 | 143 | # Translations 144 | LREL_TOOL = lrelease 145 | # Grab all possible directories (win32/unix) 146 | win32: PATHS = $$split($$(PATH), ;) 147 | else: PATHS = $$split($$(PATH), :) 148 | # Maybe it has -qt5 extension? 149 | for(bin, PATHS): exists($${bin}/$${LREL_TOOL}-qt5): LREL_TOOL=$${bin}/$${LREL_TOOL}-qt5 150 | 151 | TRANSLATIONS = $$files($$P/translations/*.ts) 152 | 153 | lang.name = $$LREL_TOOL ${QMAKE_FILE_IN} 154 | lang.input = TRANSLATIONS 155 | lang.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm 156 | 157 | lang.commands = $$LREL_TOOL ${QMAKE_FILE_IN} 158 | lang.CONFIG = no_link 159 | QMAKE_EXTRA_COMPILERS += lang 160 | PRE_TARGETDEPS += compiler_lang_make_all 161 | 162 | lupdate_only{ 163 | SOURCES = \ 164 | qml/generic/mcc.js \ 165 | qml/generic/*.qml \ 166 | qml/generic/UI/*.qml 167 | } 168 | -------------------------------------------------------------------------------- /Android/include/openssl/md4.h: -------------------------------------------------------------------------------- 1 | /* crypto/md4/md4.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_MD4_H 60 | #define HEADER_MD4_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | #ifdef OPENSSL_NO_MD4 70 | #error MD4 is disabled. 71 | #endif 72 | 73 | /* 74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75 | * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then ! 76 | * ! MD4_LONG_LOG2 has to be defined along. ! 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 78 | */ 79 | 80 | #if defined(__LP32__) 81 | #define MD4_LONG unsigned long 82 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 83 | #define MD4_LONG unsigned long 84 | #define MD4_LONG_LOG2 3 85 | /* 86 | * _CRAY note. I could declare short, but I have no idea what impact 87 | * does it have on performance on none-T3E machines. I could declare 88 | * int, but at least on C90 sizeof(int) can be chosen at compile time. 89 | * So I've chosen long... 90 | * 91 | */ 92 | #else 93 | #define MD4_LONG unsigned int 94 | #endif 95 | 96 | #define MD4_CBLOCK 64 97 | #define MD4_LBLOCK (MD4_CBLOCK/4) 98 | #define MD4_DIGEST_LENGTH 16 99 | 100 | typedef struct MD4state_st 101 | { 102 | MD4_LONG A,B,C,D; 103 | MD4_LONG Nl,Nh; 104 | MD4_LONG data[MD4_LBLOCK]; 105 | unsigned int num; 106 | } MD4_CTX; 107 | 108 | int MD4_Init(MD4_CTX *c); 109 | int MD4_Update(MD4_CTX *c, const void *data, size_t len); 110 | int MD4_Final(unsigned char *md, MD4_CTX *c); 111 | unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); 112 | void MD4_Transform(MD4_CTX *c, const unsigned char *b); 113 | #ifdef __cplusplus 114 | } 115 | #endif 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /Android/include/openssl/md5.h: -------------------------------------------------------------------------------- 1 | /* crypto/md5/md5.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_MD5_H 60 | #define HEADER_MD5_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | #ifdef OPENSSL_NO_MD5 70 | #error MD5 is disabled. 71 | #endif 72 | 73 | /* 74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75 | * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! 76 | * ! MD5_LONG_LOG2 has to be defined along. ! 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 78 | */ 79 | 80 | #if defined(__LP32__) 81 | #define MD5_LONG unsigned long 82 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 83 | #define MD5_LONG unsigned long 84 | #define MD5_LONG_LOG2 3 85 | /* 86 | * _CRAY note. I could declare short, but I have no idea what impact 87 | * does it have on performance on none-T3E machines. I could declare 88 | * int, but at least on C90 sizeof(int) can be chosen at compile time. 89 | * So I've chosen long... 90 | * 91 | */ 92 | #else 93 | #define MD5_LONG unsigned int 94 | #endif 95 | 96 | #define MD5_CBLOCK 64 97 | #define MD5_LBLOCK (MD5_CBLOCK/4) 98 | #define MD5_DIGEST_LENGTH 16 99 | 100 | typedef struct MD5state_st 101 | { 102 | MD5_LONG A,B,C,D; 103 | MD5_LONG Nl,Nh; 104 | MD5_LONG data[MD5_LBLOCK]; 105 | unsigned int num; 106 | } MD5_CTX; 107 | 108 | int MD5_Init(MD5_CTX *c); 109 | int MD5_Update(MD5_CTX *c, const void *data, size_t len); 110 | int MD5_Final(unsigned char *md, MD5_CTX *c); 111 | unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); 112 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); 113 | #ifdef __cplusplus 114 | } 115 | #endif 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /ext/quazip/quagzipfile.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2005-2014 Sergey A. Tachenov 3 | 4 | This file is part of QuaZIP. 5 | 6 | QuaZIP is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2.1 of the License, or 9 | (at your option) any later version. 10 | 11 | QuaZIP is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with QuaZIP. If not, see . 18 | 19 | See COPYING file for the full LGPL text. 20 | 21 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 22 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 23 | */ 24 | 25 | #include 26 | 27 | #include "quagzipfile.h" 28 | 29 | /// \cond internal 30 | class QuaGzipFilePrivate { 31 | friend class QuaGzipFile; 32 | QString fileName; 33 | gzFile gzd; 34 | inline QuaGzipFilePrivate(): gzd(NULL) {} 35 | inline QuaGzipFilePrivate(const QString &fileName): 36 | fileName(fileName), gzd(NULL) {} 37 | template bool open(FileId id, 38 | QIODevice::OpenMode mode, QString &error); 39 | gzFile open(int fd, const char *modeString); 40 | gzFile open(const QString &name, const char *modeString); 41 | }; 42 | 43 | gzFile QuaGzipFilePrivate::open(const QString &name, const char *modeString) 44 | { 45 | return gzopen(QFile::encodeName(name).constData(), modeString); 46 | } 47 | 48 | gzFile QuaGzipFilePrivate::open(int fd, const char *modeString) 49 | { 50 | return gzdopen(fd, modeString); 51 | } 52 | 53 | template 54 | bool QuaGzipFilePrivate::open(FileId id, QIODevice::OpenMode mode, 55 | QString &error) 56 | { 57 | char modeString[2]; 58 | modeString[0] = modeString[1] = '\0'; 59 | if ((mode & QIODevice::Append) != 0) { 60 | error = QuaGzipFile::trUtf8("QIODevice::Append is not " 61 | "supported for GZIP"); 62 | return false; 63 | } 64 | if ((mode & QIODevice::ReadOnly) != 0 65 | && (mode & QIODevice::WriteOnly) != 0) { 66 | error = QuaGzipFile::trUtf8("Opening gzip for both reading" 67 | " and writing is not supported"); 68 | return false; 69 | } else if ((mode & QIODevice::ReadOnly) != 0) { 70 | modeString[0] = 'r'; 71 | } else if ((mode & QIODevice::WriteOnly) != 0) { 72 | modeString[0] = 'w'; 73 | } else { 74 | error = QuaGzipFile::trUtf8("You can open a gzip either for reading" 75 | " or for writing. Which is it?"); 76 | return false; 77 | } 78 | gzd = open(id, modeString); 79 | if (gzd == NULL) { 80 | error = QuaGzipFile::trUtf8("Could not gzopen() file"); 81 | return false; 82 | } 83 | return true; 84 | } 85 | /// \endcond 86 | 87 | QuaGzipFile::QuaGzipFile(): 88 | d(new QuaGzipFilePrivate()) 89 | { 90 | } 91 | 92 | QuaGzipFile::QuaGzipFile(QObject *parent): 93 | QIODevice(parent), 94 | d(new QuaGzipFilePrivate()) 95 | { 96 | } 97 | 98 | QuaGzipFile::QuaGzipFile(const QString &fileName, QObject *parent): 99 | QIODevice(parent), 100 | d(new QuaGzipFilePrivate(fileName)) 101 | { 102 | } 103 | 104 | QuaGzipFile::~QuaGzipFile() 105 | { 106 | if (isOpen()) { 107 | close(); 108 | } 109 | delete d; 110 | } 111 | 112 | void QuaGzipFile::setFileName(const QString& fileName) 113 | { 114 | d->fileName = fileName; 115 | } 116 | 117 | QString QuaGzipFile::getFileName() const 118 | { 119 | return d->fileName; 120 | } 121 | 122 | bool QuaGzipFile::isSequential() const 123 | { 124 | return true; 125 | } 126 | 127 | bool QuaGzipFile::open(QIODevice::OpenMode mode) 128 | { 129 | QString error; 130 | if (!d->open(d->fileName, mode, error)) { 131 | setErrorString(error); 132 | return false; 133 | } 134 | return QIODevice::open(mode); 135 | } 136 | 137 | bool QuaGzipFile::open(int fd, QIODevice::OpenMode mode) 138 | { 139 | QString error; 140 | if (!d->open(fd, mode, error)) { 141 | setErrorString(error); 142 | return false; 143 | } 144 | return QIODevice::open(mode); 145 | } 146 | 147 | bool QuaGzipFile::flush() 148 | { 149 | return gzflush(d->gzd, Z_SYNC_FLUSH) == Z_OK; 150 | } 151 | 152 | void QuaGzipFile::close() 153 | { 154 | QIODevice::close(); 155 | gzclose(d->gzd); 156 | } 157 | 158 | qint64 QuaGzipFile::readData(char *data, qint64 maxSize) 159 | { 160 | return gzread(d->gzd, (voidp)data, (unsigned)maxSize); 161 | } 162 | 163 | qint64 QuaGzipFile::writeData(const char *data, qint64 maxSize) 164 | { 165 | if (maxSize == 0) 166 | return 0; 167 | int written = gzwrite(d->gzd, (voidp)data, (unsigned)maxSize); 168 | if (written == 0) 169 | return -1; 170 | else 171 | return written; 172 | } 173 | -------------------------------------------------------------------------------- /Android/include/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* crypto/ecdh/ecdh.h */ 2 | /* ==================================================================== 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 4 | * 5 | * The Elliptic Curve Public-Key Crypto Library (ECC Code) included 6 | * herein is developed by SUN MICROSYSTEMS, INC., and is contributed 7 | * to the OpenSSL project. 8 | * 9 | * The ECC Code is licensed pursuant to the OpenSSL open source 10 | * license provided below. 11 | * 12 | * The ECDH software is originally written by Douglas Stebila of 13 | * Sun Microsystems Laboratories. 14 | * 15 | */ 16 | /* ==================================================================== 17 | * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. 18 | * 19 | * Redistribution and use in source and binary forms, with or without 20 | * modification, are permitted provided that the following conditions 21 | * are met: 22 | * 23 | * 1. Redistributions of source code must retain the above copyright 24 | * notice, this list of conditions and the following disclaimer. 25 | * 26 | * 2. Redistributions in binary form must reproduce the above copyright 27 | * notice, this list of conditions and the following disclaimer in 28 | * the documentation and/or other materials provided with the 29 | * distribution. 30 | * 31 | * 3. All advertising materials mentioning features or use of this 32 | * software must display the following acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 35 | * 36 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 37 | * endorse or promote products derived from this software without 38 | * prior written permission. For written permission, please contact 39 | * licensing@OpenSSL.org. 40 | * 41 | * 5. Products derived from this software may not be called "OpenSSL" 42 | * nor may "OpenSSL" appear in their names without prior written 43 | * permission of the OpenSSL Project. 44 | * 45 | * 6. Redistributions of any form whatsoever must retain the following 46 | * acknowledgment: 47 | * "This product includes software developed by the OpenSSL Project 48 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 49 | * 50 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 51 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 53 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 54 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 56 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 57 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 59 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 61 | * OF THE POSSIBILITY OF SUCH DAMAGE. 62 | * ==================================================================== 63 | * 64 | * This product includes cryptographic software written by Eric Young 65 | * (eay@cryptsoft.com). This product includes software written by Tim 66 | * Hudson (tjh@cryptsoft.com). 67 | * 68 | */ 69 | #ifndef HEADER_ECDH_H 70 | #define HEADER_ECDH_H 71 | 72 | #include 73 | 74 | #ifdef OPENSSL_NO_ECDH 75 | #error ECDH is disabled. 76 | #endif 77 | 78 | #include 79 | #include 80 | #ifndef OPENSSL_NO_DEPRECATED 81 | #include 82 | #endif 83 | 84 | #ifdef __cplusplus 85 | extern "C" { 86 | #endif 87 | 88 | const ECDH_METHOD *ECDH_OpenSSL(void); 89 | 90 | void ECDH_set_default_method(const ECDH_METHOD *); 91 | const ECDH_METHOD *ECDH_get_default_method(void); 92 | int ECDH_set_method(EC_KEY *, const ECDH_METHOD *); 93 | 94 | int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, 95 | void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)); 96 | 97 | int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new 98 | *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 99 | int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg); 100 | void *ECDH_get_ex_data(EC_KEY *d, int idx); 101 | 102 | 103 | /* BEGIN ERROR CODES */ 104 | /* The following lines are auto generated by the script mkerr.pl. Any changes 105 | * made after this point may be overwritten when the script is next run. 106 | */ 107 | void ERR_load_ECDH_strings(void); 108 | 109 | /* Error codes for the ECDH functions. */ 110 | 111 | /* Function codes. */ 112 | #define ECDH_F_ECDH_COMPUTE_KEY 100 113 | #define ECDH_F_ECDH_DATA_NEW_METHOD 101 114 | 115 | /* Reason codes. */ 116 | #define ECDH_R_KDF_FAILED 102 117 | #define ECDH_R_NO_PRIVATE_VALUE 100 118 | #define ECDH_R_POINT_ARITHMETIC_FAILURE 101 119 | 120 | #ifdef __cplusplus 121 | } 122 | #endif 123 | #endif 124 | -------------------------------------------------------------------------------- /Android/include/openssl/buffer.h: -------------------------------------------------------------------------------- 1 | /* crypto/buffer/buffer.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_BUFFER_H 60 | #define HEADER_BUFFER_H 61 | 62 | #include 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | #include 69 | 70 | #if !defined(NO_SYS_TYPES_H) 71 | #include 72 | #endif 73 | 74 | /* Already declared in ossl_typ.h */ 75 | /* typedef struct buf_mem_st BUF_MEM; */ 76 | 77 | struct buf_mem_st 78 | { 79 | size_t length; /* current number of bytes */ 80 | char *data; 81 | size_t max; /* size of buffer */ 82 | }; 83 | 84 | BUF_MEM *BUF_MEM_new(void); 85 | void BUF_MEM_free(BUF_MEM *a); 86 | int BUF_MEM_grow(BUF_MEM *str, size_t len); 87 | int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); 88 | char * BUF_strdup(const char *str); 89 | char * BUF_strndup(const char *str, size_t siz); 90 | void * BUF_memdup(const void *data, size_t siz); 91 | void BUF_reverse(unsigned char *out, unsigned char *in, size_t siz); 92 | 93 | /* safe string functions */ 94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); 95 | size_t BUF_strlcat(char *dst,const char *src,size_t siz); 96 | 97 | 98 | /* BEGIN ERROR CODES */ 99 | /* The following lines are auto generated by the script mkerr.pl. Any changes 100 | * made after this point may be overwritten when the script is next run. 101 | */ 102 | void ERR_load_BUF_strings(void); 103 | 104 | /* Error codes for the BUF functions. */ 105 | 106 | /* Function codes. */ 107 | #define BUF_F_BUF_MEMDUP 103 108 | #define BUF_F_BUF_MEM_GROW 100 109 | #define BUF_F_BUF_MEM_GROW_CLEAN 105 110 | #define BUF_F_BUF_MEM_NEW 101 111 | #define BUF_F_BUF_STRDUP 102 112 | #define BUF_F_BUF_STRNDUP 104 113 | 114 | /* Reason codes. */ 115 | 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | #endif 120 | -------------------------------------------------------------------------------- /ext/quazip/crypt.h: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for crypt/uncrypt ZIPfile 2 | 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | 8 | This code is a modified version of crypting code in Infozip distribution 9 | 10 | The encryption/decryption parts of this source code (as opposed to the 11 | non-echoing password parts) were originally written in Europe. The 12 | whole source package can be freely distributed, including from the USA. 13 | (Prior to January 2000, re-export from the US was a violation of US law.) 14 | 15 | This encryption code is a direct transcription of the algorithm from 16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This 17 | file (appnote.txt) is distributed with the PKZIP program (even in the 18 | version without encryption capabilities). 19 | 20 | If you don't need crypting in your application, just define symbols 21 | NOCRYPT and NOUNCRYPT. 22 | 23 | This code support the "Traditional PKWARE Encryption". 24 | 25 | The new AES encryption added on Zip format by Winzip (see the page 26 | http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong 27 | Encryption is not supported. 28 | */ 29 | 30 | #include "quazip_global.h" 31 | 32 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 33 | 34 | /*********************************************************************** 35 | * Return the next byte in the pseudo-random sequence 36 | */ 37 | static int decrypt_byte(unsigned long* pkeys, const z_crc_t FAR * pcrc_32_tab QUAZIP_UNUSED) 38 | { 39 | //(void) pcrc_32_tab; /* avoid "unused parameter" warning */ 40 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 41 | * unpredictable manner on 16-bit systems; not a problem 42 | * with any known compiler so far, though */ 43 | 44 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; 45 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); 46 | } 47 | 48 | /*********************************************************************** 49 | * Update the encryption keys with the next byte of plain text 50 | */ 51 | static int update_keys(unsigned long* pkeys,const z_crc_t FAR * pcrc_32_tab,int c) 52 | { 53 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 54 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 55 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 56 | { 57 | register int keyshift = (int)((*(pkeys+1)) >> 24); 58 | (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); 59 | } 60 | return c; 61 | } 62 | 63 | 64 | /*********************************************************************** 65 | * Initialize the encryption keys and the random header according to 66 | * the given password. 67 | */ 68 | static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t FAR * pcrc_32_tab) 69 | { 70 | *(pkeys+0) = 305419896L; 71 | *(pkeys+1) = 591751049L; 72 | *(pkeys+2) = 878082192L; 73 | while (*passwd != '\0') { 74 | update_keys(pkeys,pcrc_32_tab,(int)*passwd); 75 | passwd++; 76 | } 77 | } 78 | 79 | #define zdecode(pkeys,pcrc_32_tab,c) \ 80 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 81 | 82 | #define zencode(pkeys,pcrc_32_tab,c,t) \ 83 | (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 84 | 85 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 86 | 87 | #define RAND_HEAD_LEN 12 88 | /* "last resort" source for second part of crypt seed pattern */ 89 | # ifndef ZCR_SEED2 90 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 91 | # endif 92 | 93 | static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) 94 | const char *passwd; /* password string */ 95 | unsigned char *buf; /* where to write header */ 96 | int bufSize; 97 | unsigned long* pkeys; 98 | const z_crc_t FAR * pcrc_32_tab; 99 | unsigned long crcForCrypting; 100 | { 101 | int n; /* index in random header */ 102 | int t; /* temporary */ 103 | int c; /* random byte */ 104 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 105 | static unsigned calls = 0; /* ensure different random header each time */ 106 | 107 | if (bufSize> 7) & 0xff; 122 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 123 | } 124 | /* Encrypt random header (last two bytes is high word of crc) */ 125 | init_keys(passwd, pkeys, pcrc_32_tab); 126 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 127 | { 128 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 129 | } 130 | buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 131 | buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 132 | return n; 133 | } 134 | 135 | #endif 136 | --------------------------------------------------------------------------------