[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-foilauth.git</param>
<param name="branch">master</param>
- <param name="revision">7cdc4a3</param>
+ <param name="revision">06b83da</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/LICENSE
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2019-2021 Jolla Ltd.
-Copyright (C) 2019-2021 Slava Monich <slava@monich.com>
+Copyright (C) 2019-2022 Jolla Ltd.
+Copyright (C) 2019-2022 Slava Monich <slava@monich.com>
You may use this file under the terms of the BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/README.md
^
|
@@ -5,5 +5,8 @@
**Foil Auth** is an HMAC-based generator of One-Time Passwords
which keeps secret keys encrypted.
+Both HOTP (counter based) and TOTP (time based) passwords are
+supported.
+
The format of encrypted files is described
[here](https://github.com/monich/foil/blob/master/libfoilmsg/README).
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/app.pro
^
|
@@ -22,19 +22,15 @@
TRANSLATIONS_PATH = /usr/share/$${TARGET}/translations
}
-system("pkg-config openssl --atleast-version=1.1") {
- message("Linking OpenSSL dynamically")
- PKGCONFIG += libcrypto
-} else {
- message("Linking OpenSSL statically")
- LIBS += $$[QT_INSTALL_LIBS]/libcrypto.a $$[QT_INSTALL_LIBS]/libssl.a
- PKGCONFIG += zlib
-}
-
CONFIG(debug, debug|release) {
DEFINES += DEBUG HARBOUR_DEBUG
}
+equals(QT_ARCH, arm64){
+ message(Linking with OpenSSL)
+ PKGCONFIG += libcrypto
+}
+
# Directories
FOIL_UI_REL = foil-ui
FOIL_UI_DIR = $${_PRO_FILE_PWD_}/$${FOIL_UI_REL}
@@ -157,9 +153,7 @@
$${HARBOUR_LIB_INCLUDE}/HarbourSelectionListModel.h \
$${HARBOUR_LIB_INCLUDE}/HarbourSingleImageProvider.h \
$${HARBOUR_LIB_INCLUDE}/HarbourSystemState.h \
- $${HARBOUR_LIB_INCLUDE}/HarbourSystem.h \
$${HARBOUR_LIB_INCLUDE}/HarbourTask.h \
- $${HARBOUR_LIB_INCLUDE}/HarbourTheme.h \
$${HARBOUR_LIB_SRC}/HarbourMce.h
SOURCES += \
@@ -172,9 +166,7 @@
$${HARBOUR_LIB_SRC}/HarbourSelectionListModel.cpp \
$${HARBOUR_LIB_SRC}/HarbourSingleImageProvider.cpp \
$${HARBOUR_LIB_SRC}/HarbourSystemState.cpp \
- $${HARBOUR_LIB_SRC}/HarbourSystem.cpp \
- $${HARBOUR_LIB_SRC}/HarbourTask.cpp \
- $${HARBOUR_LIB_SRC}/HarbourTheme.cpp
+ $${HARBOUR_LIB_SRC}/HarbourTask.cpp
HARBOUR_QML_COMPONENTS = \
$${HARBOUR_LIB_QML}/HarbourFitLabel.qml \
@@ -191,6 +183,12 @@
qml_components.path = /usr/share/$${TARGET}/qml/harbour
INSTALLS += qml_components
+# openssl
+!equals(QT_ARCH, arm64){
+SOURCES += \
+ $${HARBOUR_LIB_SRC}/libcrypto.c
+}
+
# Icons
ICON_SIZES = 86 108 128 172 256
for(s, ICON_SIZES) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/foil/VERSION
^
|
@@ -1 +1 @@
-1.0.22
+1.0.23
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/foil/debian/changelog
^
|
@@ -1,3 +1,11 @@
+libfoil (1.0.23) unstable; urgency=low
+
+ * Replaced FoilParsePos with GUtilRange
+ * Added foil_asn1_parse_tag()
+ * Allow side-linking with libglibutil
+
+ -- Slava Monich <slava@monich.com> Thu, 21 Oct 2021 04:44:25 +0300
+
libfoil (1.0.22) unstable; urgency=low
* Added support for SHA512
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/foil/debian/control
^
|
@@ -2,19 +2,19 @@
Section: libs
Priority: optional
Maintainer: Slava Monich <slava@monich.com>
-Build-Depends: debhelper (>= 7), libglibutil-dev (>= 1.0.24), libglib2.0-dev, libpng-dev, libmagic-dev, libssl-dev
+Build-Depends: debhelper (>= 7), libglibutil-dev (>= 1.0.54), libglib2.0-dev, libpng-dev, libmagic-dev, libssl-dev
Standards-Version: 3.8.4
Package: libfoil
Section: libs
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libglibutil (>= 1.0.24)
+Depends: ${shlibs:Depends}, ${misc:Depends}, libglibutil (>= 1.0.54)
Description: Library of glib-based cryptography utilities
Package: libfoil-dev
Section: libdevel
Architecture: any
-Depends: libfoil (= ${binary:Version}), ${misc:Depends}, libglibutil-dev (>= 1.0.24)
+Depends: libfoil (= ${binary:Version}), ${misc:Depends}, libglibutil-dev (>= 1.0.54)
Description: Development files for libfoil
Package: foil-tools
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/foil/libfoilmsg/README
^
|
@@ -34,13 +34,18 @@
can be followed by (relatively) small amount of garbage.
The format tag is 1 for AES in CBC mode, 2 for AES in CFB mode.
-signature is the hash of encryptedData part, encrypted with the
-sender's private key.
-The format tag is 1 for MD-5 hash + 16 bytes of random padding,
-encrypted with RSA private key. When signature is being verified,
-padding is (obviously) ignored. Since RSA iself inflates the data,
-padding doesn't actually increase the size of the signature part,
-but kills any correlation with the input data.
+signature is the hash of encryptedData part + the same amount of
+random padding (16 bytes for MD-5, 20 bytes for SHA-1 and so on),
+encrypted with sender's RSA private key. Signature tag specifies
+the hash algorithm:
+1 for MD-5
+2 for SHA-1
+3 for SHA-256
+4 for SHA-512
+When signature is being verified, the padding is (obviously) ignored.
+Since RSA iself inflates the data, padding normally doesn't increase
+the size of the signature part, but does kill any correlation with
+the input data.
EncryptedKeys
=============
@@ -67,9 +72,9 @@
The exact format depends on the block cipher algorithm and is
specified by keyFormat.
-keyFormat is 1 for AES 128 (16 bytes key + 16 bytes IV)
-keyFormat is 2 for AES 192 (24 bytes key + 16 bytes IV)
-keyFormat is 3 for AES 256 (32 bytes key + 16 bytes IV)
+keyFormat is 1 for AES-128 (16 bytes key + 16 bytes IV)
+keyFormat is 2 for AES-192 (24 bytes key + 16 bytes IV)
+keyFormat is 3 for AES-256 (32 bytes key + 16 bytes IV)
Since RSA iself inflates the data, the key size doesn't actually
increase the size of the encrypted key.
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/foil/rpm/foil.spec
^
|
@@ -1,5 +1,5 @@
Name: libfoil
-Version: 1.0.22
+Version: 1.0.23
Release: 0
Summary: Yet another glib-style crypto API
Group: Development/Libraries
@@ -13,6 +13,7 @@
%define libglibutil_build_version 1.0.54
BuildRequires: file-devel
+BuildRequires: pkgconfig
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(glib-2.0) >= %{glib_version}
@@ -29,7 +30,6 @@
Summary: Development library for %{name}
Requires: %{name} = %{version}
Requires: pkgconfig(libglibutil) >= %{libglibutil_build_version}
-Requires: pkgconfig
%description devel
This package contains the development library for %{name}.
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/foil/test/libfoil/test_cavp_aes/test_cavp_aes.c
^
|
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2019 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -47,7 +47,8 @@
#define TEST_IV (0x04)
#define TEST_PLAINTEXT (0x08)
#define TEST_CIPHERTEXT (0x10)
-#define TEST_ALL (0x1f)
+#define TEST_REQUIRED (TEST_COUNT|TEST_KEY|TEST_PLAINTEXT|TEST_CIPHERTEXT)
+#define TEST_ALL (TEST_REQUIRED|TEST_IV)
typedef enum aes_test_section {
TEST_SECTION_NONE = -1,
@@ -91,8 +92,7 @@
g_string_truncate(str, 0);
while ((c = fgetc(f)) != EOF) {
if (c == '\r' || c == '\n') {
- while ((c = fgetc(f)) != EOF && (c == '\r' || c == '\n'));
- if (c != EOF) ungetc(c, f);
+ if (c == '\r') c = fgetc(f);
break;
}
if (!isspace(c)) g_string_append_c(str, c);
@@ -155,6 +155,26 @@
}
static
+void
+test_append(
+ Tests* tests,
+ TestSection section,
+ const Test* test)
+{
+ Test* t = g_new(Test, 1);
+ *t = *test;
+ if (!t->iv) {
+ /* Default IV (16 bytes) */
+ static const guint8 iv[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ t->iv = g_bytes_new_static(iv, sizeof(iv));
+ }
+ tests->tests[section] = g_slist_append(tests->tests[section], t);
+}
+
+static
gboolean
test_parse_file(
const char* fname,
@@ -178,16 +198,22 @@
flags = 0;
} else if (section != TEST_SECTION_NONE) {
flags |= test_parse_line(line, &test);
- if ((flags & TEST_ALL) == TEST_ALL) {
- Test* t = g_new0(Test, 1);
- *t = test;
- tests->tests[section] = g_slist_append(
- tests->tests[section], t);
+ if ((flags & TEST_ALL) == TEST_ALL ||
+ (((flags & TEST_REQUIRED) == TEST_REQUIRED) && !line[0])) {
+ test_append(tests, section, &test);
flags = 0;
memset(&test, 0, sizeof(test));
}
}
}
+ if ((flags & TEST_REQUIRED) == TEST_REQUIRED) {
+ test_append(tests, section, &test);
+ } else {
+ g_assert(!test.key);
+ g_assert(!test.iv);
+ g_assert(!test.plaintext);
+ g_assert(!test.ciphertext);
+ }
g_string_free(str, TRUE);
fclose(f);
return TRUE;
@@ -362,6 +388,8 @@
{
guint i;
g_test_init(&argc, &argv, NULL);
+ gutil_log_default.level = g_test_verbose() ?
+ GLOG_LEVEL_VERBOSE : GLOG_LEVEL_NONE;
for (i = 0; i < G_N_ELEMENTS(ecb_tests); i++) {
const char* fname = ecb_tests[i];
char* name = g_strconcat(TEST_PREFIX, fname, NULL);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/harbour-foilauth.desktop
^
|
@@ -5,6 +5,9 @@
Icon=harbour-foilauth
Exec=harbour-foilauth
+[X-Sailjail]
+Sandboxing=Disabled
+
[X-HarbourBackup]
BackupPathList=.local/share/foil/:Documents/FoilAuth/
BackupConfigList=/apps/harbour-foilauth/
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/harbour-lib/include/HarbourTheme.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2020 Jolla Ltd.
- * Copyright (C) 2018-2020 Slava Monich <slava@monich.com>
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -81,6 +81,8 @@
qreal opacityHigh() const;
qreal opacityOverlay() const;
+ static QRgb invertedRgb(QRgb aRgb);
+
Q_INVOKABLE static QColor invertedColor(const QColor& aColor);
Q_INVOKABLE static qreal colorDifference(const QColor& aColor1, const QColor& aColor2);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/harbour-lib/qml/HarbourColorEditorDialog.qml
^
|
@@ -164,12 +164,9 @@
EnterKey.onClicked: hexText.focus = false
onTextChanged: {
- if (!ignoreTextUpdates && acceptableInput) {
- tmpColor = "#" + text
- ignoreTextUpdates++
- brightnessSlider.value = hueItem.getV(tmpColor)
- hueSlider.value = hueItem.getH(tmpColor)
- ignoreTextUpdates--
+ if (!ignoreTextUpdates) {
+ // acceptableInput hasn't been updated yet
+ syncTimer.restart()
}
}
@@ -179,6 +176,16 @@
}
}
+ function syncColor() {
+ if (acceptableInput) {
+ tmpColor = "#" + text
+ ignoreTextUpdates++
+ brightnessSlider.value = hueItem.getV(tmpColor)
+ hueSlider.value = hueItem.getH(tmpColor)
+ ignoreTextUpdates--
+ }
+ }
+
function updateText() {
if (!ignoreTextUpdates) {
ignoreTextUpdates++
@@ -187,6 +194,13 @@
ignoreTextUpdates--
}
}
+
+ Timer {
+ id: syncTimer
+
+ interval: 0
+ onTriggered: hexText.syncColor()
+ }
}
}
}
@@ -198,15 +212,16 @@
width: 2 * height
height: hexText.height - 2 * Theme.paddingLarge
anchors.right: parent.right
+ visible: hexText.acceptableInput
onClicked: thisDialog.accept()
Rectangle {
id: sampleItem
+ radius: Theme.paddingSmall
anchors.fill: parent
color: "#" + hexText.text
- visible: hexText.acceptableInput
layer.enabled: sample.pressed && sample.containsMouse
layer.effect: HarbourPressEffect { source: sampleItem }
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/harbour-lib/qml/HarbourColorHueItem.qml
^
|
@@ -38,6 +38,7 @@
id: thisItem
color: "black"
+
property alias brightness: mouseArea.opacity
property alias pressed: mouseArea.pressed
@@ -143,6 +144,7 @@
sourceItem: Rectangle {
width: mouseArea.width
height: mouseArea.height
+ radius: Theme.paddingSmall
gradient: Gradient {
GradientStop { position: 0.0; color: color0 }
GradientStop { position: colorStop1; color: color1 }
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/harbour-lib/src/HarbourTheme.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2020 Jolla Ltd.
- * Copyright (C) 2018-2020 Slava Monich <slava@monich.com>
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -215,11 +215,15 @@
return invertedColor(Private::primaryColor());
}
+QRgb HarbourTheme::invertedRgb(QRgb aRgb)
+{
+ return ((~(aRgb & RGB_MASK)) & RGB_MASK) | (aRgb & (~RGB_MASK));
+}
+
QColor HarbourTheme::invertedColor(const QColor& aColor)
{
if (aColor.isValid()) {
- const QRgb rgba = aColor.rgba();
- return QColor(((~(rgba & RGB_MASK)) & RGB_MASK) | (rgba & (~RGB_MASK)));
+ return QColor(invertedRgb(aColor.rgba()));
} else {
return aColor;
}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/harbour-lib/src/libcrypto.c
^
|
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gutil_log.h"
+
+#include <dlfcn.h>
+#include <stdint.h>
+
+#include <openssl/aes.h>
+#include <openssl/des.h>
+#include <openssl/md5.h>
+#include <openssl/rsa.h>
+#include <openssl/sha.h>
+
+/*
+ * What is this code?
+ *
+ * Sailfish OS comes in 3 flavors wrt openssl versions:
+ *
+ * 1. Sailfish OS up to 3.4 had openssl 1.0
+ * 2. Sailfish 4.0..4.2 had both openssl 1.0 and openssl 1.1 libraries
+ * 3. Sailfish 4.3 dropped openssl 1.0 libraries and only has openssl 1.1
+ *
+ * Which means that explicitly linking with any version of openssl
+ * makes your app incompatible with either Sailfish OS <= 3.4 or
+ * Sailfish OS >= 4.3 (nice symmetry).
+ *
+ * If you want to build an app which runs on both Sailfish OS <= 3.4
+ * and Sailfish OS >= 4.3 you have two options:
+ *
+ * 1. Link openssl statically
+ * 2. Load libcrypts.so dynamically with dlopen/dlsym
+ *
+ * This module allows you to implement the second strategy. It works
+ * because openssl 1.0 and 1.1 (luckily!) appear to be binary compatible.
+ * It doesn't load all libcrypto functions, only those referenced by my
+ * apps but the list can be easily expanded.
+ */
+
+#ifndef LIBDIR
+# ifdef __aarch64__
+# define LIBDIR "/usr/lib64"
+# else
+# define LIBDIR "/usr/lib"
+# endif
+#endif
+
+/*
+ * OpenSSL 1.0 headers define ERR_load_crypto_strings as a function:
+ *
+ * void ERR_load_crypto_strings(void);
+ *
+ * and OpenSSL 1.1 as a macro:
+ *
+ * #if OPENSSL_API_COMPAT < 0x10100000L
+ * # define ERR_load_crypto_strings() \
+ * OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
+ * # define ERR_free_strings() while(0) continue
+ * #endif
+ *
+ * We want to try loading both ERR_load_crypto_strings and
+ * OPENSSL_init_crypto, one of which will probably fail.
+ */
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+# undef ERR_load_crypto_strings
+#else
+# define OPENSSL_INIT_SETTINGS void
+#endif
+
+/* f(name,params,args) */
+#define LIBCRYPTO_FUNCTIONS1(f) \
+ f(AES_cbc_encrypt, \
+ (const unsigned char* in, unsigned char* out, size_t length, \
+ const AES_KEY* key, unsigned char* ivec, const int enc), \
+ (in, out, length, key, ivec, enc)) \
+ f(AES_cfb128_encrypt, \
+ (const unsigned char* in, unsigned char* out, size_t length, \
+ const AES_KEY* key,unsigned char* ivec, int* num, const int enc), \
+ (in, out, length, key, ivec, num, enc)) \
+ f(AES_ecb_encrypt, \
+ (const unsigned char* in, unsigned char* out, const AES_KEY* key, \
+ const int enc), \
+ (in, out, key, enc)) \
+ f(BN_free, (BIGNUM *a), (a)) \
+ f(DES_ede3_cbc_encrypt, \
+ (const unsigned char* input, unsigned char* output, long length, \
+ DES_key_schedule* ks1, DES_key_schedule* ks2, DES_key_schedule* ks3, \
+ DES_cblock* ivec, int enc), \
+ (input, output, length, ks1, ks2, ks3, ivec, enc)) \
+ f(ERR_load_crypto_strings, (void), ()) \
+ f(RSA_free, (RSA* r), (r))
+
+/* f(ret,name,params,args,def) */
+#define LIBCRYPTO_FUNCTIONS2(f) \
+ f(int, AES_set_decrypt_key, \
+ (const unsigned char* userKey, const int bits, AES_KEY* key), \
+ (userKey, bits, key), -1) \
+ f(int, AES_set_encrypt_key, \
+ (const unsigned char* userKey, const int bits, AES_KEY* key), \
+ (userKey, bits, key), -1) \
+ f(BIGNUM*, BN_bin2bn, \
+ (const unsigned char* s, int len, BIGNUM* ret), (s, len, ret), NULL) \
+ f(int, BN_bn2bin, \
+ (const BIGNUM* a, unsigned char* to), (a, to), 0) \
+ f(BIGNUM*, BN_new, (void), (), NULL) \
+ f(int, BN_num_bits, (const BIGNUM *a), (a), 0) \
+ f(int, BN_set_word, (BIGNUM* a, BN_ULONG w), (a, w), 0) \
+ f(int, DES_check_key_parity, (const_DES_cblock* key), (key), 0) \
+ f(int, DES_is_weak_key, (const_DES_cblock* key), (key), 0) \
+ f(int, DES_set_key, \
+ (const_DES_cblock* key, DES_key_schedule* schedule), \
+ (key, schedule), -1) \
+ f(char*, ERR_error_string, (unsigned long e, char* buf), (e, buf), NULL) \
+ f(unsigned long, ERR_get_error, (void), (), 0) \
+ f(unsigned char*, MD5, \
+ (const unsigned char* d, size_t n, unsigned char* md), (d, n, md), NULL) \
+ f(int, MD5_Final, (unsigned char* md, MD5_CTX* c), (md, c), 0) \
+ f(int, MD5_Init, (MD5_CTX* c), (c), 0) \
+ f(int, MD5_Update, (MD5_CTX* c, const void* data, size_t len), \
+ (c, data, len), 0) \
+ f(int, OPENSSL_init_crypto, \
+ (uint64_t opts, const OPENSSL_INIT_SETTINGS* settings), \
+ (opts, settings), 0) \
+ f(int, RAND_bytes, (unsigned char* buf, int num), (buf, num), 0) \
+ f(int, RAND_poll, (void), (), 0) \
+ f(RSA*, RSAPrivateKey_dup, (RSA* rsa), (rsa), NULL) \
+ f(RSA*, RSAPublicKey_dup, (RSA* rsa), (rsa), NULL) \
+ f(int, RSA_generate_key_ex, \
+ (RSA* rsa, int bits, BIGNUM* e, BN_GENCB* cb), \
+ (rsa, bits, e, cb), 0) \
+ f(RSA*, RSA_new, (void), (), NULL) \
+ f(int, RSA_private_decrypt, \
+ (int flen, const unsigned char* from, unsigned char* to, RSA* rsa, \
+ int padding), (flen, from, to, rsa, padding), 0) \
+ f(int, RSA_private_encrypt, \
+ (int flen, const unsigned char* from, unsigned char* to, RSA* rsa, \
+ int padding), (flen, from, to, rsa, padding), 0) \
+ f(int, RSA_public_decrypt, \
+ (int flen, const unsigned char* from, unsigned char* to, RSA* rsa, \
+ int padding), (flen, from, to, rsa, padding), 0) \
+ f(int, RSA_public_encrypt, \
+ (int flen, const unsigned char* from, unsigned char* to, RSA* rsa, \
+ int padding), (flen, from, to, rsa, padding), 0) \
+ f(int, RSA_size, (const RSA* rsa), (rsa), 0) \
+ f(unsigned char*, SHA1, (const unsigned char* d, size_t n, \
+ unsigned char* md), (d, n, md), NULL) \
+ f(int, SHA1_Final, (unsigned char* md, SHA_CTX* c), (md, c), 0) \
+ f(int, SHA1_Init, (SHA_CTX* c), (c), 0) \
+ f(int, SHA1_Update, (SHA_CTX* c, const void* data, size_t len), \
+ (c, data, len), 0) \
+ f(unsigned char*, SHA256, (const unsigned char* d, size_t n, \
+ unsigned char* md), (d, n, md), NULL) \
+ f(int, SHA256_Final, (unsigned char* md, SHA256_CTX* c), (md, c), 0) \
+ f(int, SHA256_Init, (SHA256_CTX* c), (c), 0) \
+ f(int, SHA256_Update, (SHA256_CTX* c, const void* data, size_t len), \
+ (c, data, len), 0) \
+ f(unsigned char*, SHA512, (const unsigned char* d, size_t n, \
+ unsigned char* md), (d, n, md), NULL) \
+ f(int, SHA512_Final, (unsigned char* md, SHA512_CTX* c), (md, c), 0) \
+ f(int, SHA512_Init, (SHA512_CTX* c), (c), 0) \
+ f(int, SHA512_Update, (SHA512_CTX* c, const void* data, size_t len), \
+ (c, data, len), 0)
+
+static const char* libcrypto_so_path[] = {
+ LIBDIR "/libcrypto.so.1.1",
+ "/lib/libcrypto.so.10"
+};
+
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/qml/CoverPage.qml
^
|
@@ -9,7 +9,8 @@
readonly property var foilModel: FoilAuthModel
readonly property int coverActionHeight: Theme.itemSizeSmall
- readonly property string lockIconSource: Qt.resolvedUrl("images/" + (HarbourTheme.darkOnLight ? "cover-lock-dark.svg" : "cover-lock.svg"))
+ readonly property bool darkOnLight: ('colorScheme' in Theme) && Theme.colorScheme === 1
+ readonly property string lockIconSource: Qt.resolvedUrl("images/" + (darkOnLight ? "cover-lock-dark.svg" : "cover-lock.svg"))
Rectangle {
width: parent.width
@@ -99,11 +100,10 @@
width: backgroundCircle.size
height: backgroundCircle.size
anchors.centerIn: parent
- transform: Rotation {
- id: backgroundCircleRotation
+ transform: Scale {
+ id: backgroundCircleScale
- origin { x: width / 2; y: height / 2 }
- axis { x: 0; y: 1; z: 0 }
+ origin.x: width / 2
}
Rectangle {
@@ -135,13 +135,13 @@
source: "images/foilauth.svg"
height: backgroundCircle.size
sourceSize.height: backgroundCircle.size
- anchors.centerIn: parent
+ anchors.centerIn: backgroundCircle
smooth: true
- transform: Rotation {
- id: lockedImageRotation
+ opacity: 0.8
+ Scale {
+ id: lockedImageScale
- origin { x: width / 2; y: height / 2 }
- axis { x: 0; y: 1; z: 0 }
+ origin.x: width / 2
}
}
@@ -151,10 +151,10 @@
if (cover.foilModel.keyAvailable) {
// This transition is not visible, there's no reason to animate it
lockedImage.visible = false
- backgroundCircleRotation.angle = 0
+ lockedImageScale.xScale = 0
+ backgroundCircleScale.xScale = 1
backgroundCircle.visible = true
} else {
- lockedImageRotation.angle = 90
lockFlipAnimation.start()
}
}
@@ -167,23 +167,24 @@
alwaysRunToEnd: true
function switchToImage() {
- backgroundCircle.visible = false
lockedImage.visible = true
+ backgroundCircle.visible = false
}
NumberAnimation {
easing.type: Easing.InOutSine
- target: backgroundCircleRotation
- property: "angle"
- from: 0
- to: 90
+ target: backgroundCircleScale
+ property: "xScale"
+ from: 1
+ to: 0
duration: 125
}
ScriptAction { script: lockFlipAnimation.switchToImage() }
NumberAnimation {
easing.type: Easing.InOutSine
- target: lockedImageRotation
- property: "angle"
- to: 0
+ target: lockedImageScale
+ property: "xScale"
+ from: 0
+ to: 1
duration: 125
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/qml/MainPage.qml
^
|
@@ -26,10 +26,10 @@
id: foilUiComponent
QtObject {
- readonly property real opacityFaint: HarbourTheme.opacityFaint
- readonly property real opacityLow: HarbourTheme.opacityLow
- readonly property real opacityHigh: HarbourTheme.opacityHigh
- readonly property real opacityOverlay: HarbourTheme.opacityOverlay
+ readonly property real opacityFaint: 0.2
+ readonly property real opacityLow: 0.4
+ readonly property real opacityHigh: 0.6
+ readonly property real opacityOverlay: 0.8
readonly property var settings: FoilAuthSettings
readonly property bool otherFoilAppsInstalled: FoilAuth.otherFoilAppsInstalled
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/qml/TokenListView.qml
^
|
@@ -16,6 +16,7 @@
property var disabledItems: []
readonly property bool isLandscape: mainPage && mainPage.isLandscape
+ readonly property real dragEdge: Theme.horizontalPageMargin
readonly property real dragThresholdX: Theme.itemSizeSmall/2
readonly property real dragThresholdY: Theme.itemSizeSmall/5
readonly property real maxContentY: Math.max(originY + contentHeight - height, originY)
@@ -442,12 +443,18 @@
onReleased: stopDrag(tokenListDelegate)
onCanceled: stopDrag(tokenListDelegate)
onMouseXChanged: {
- if (!dragging && pressed && !menuOpen && !dragTimer.running && Math.abs(mouseX - pressX) > tokenList.dragThresholdX) {
+ // Don't start drag if the initial touch was too close to the edge
+ if (!dragging && pressed && !menuOpen && !dragTimer.running &&
+ pressX > tokenList.dragEdge && pressX < (width - tokenList.dragEdge) &&
+ Math.abs(mouseX - pressX) > tokenList.dragThresholdX) {
startDrag()
}
}
onMouseYChanged: {
- if (!dragging && pressed && !menuOpen && !dragTimer.running && Math.abs(mouseY - pressY) > tokenList.dragThresholdY) {
+ // Don't start drag if the initial touch was too close to the edge
+ if (!dragging && pressed && !menuOpen && !dragTimer.running &&
+ pressX > tokenList.dragEdge && pressX < (width - tokenList.dragEdge) &&
+ Math.abs(mouseY - pressY) > tokenList.dragThresholdY) {
startDrag()
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/src/QrCodeImageSource.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2022 Jolla Ltd.
+ * Copyright (C) 2019-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -33,27 +33,86 @@
#include "QrCodeImageSource.h"
-QrCodeImageSource::QrCodeImageSource(QImage aImage) :
- zxing::LuminanceSource(aImage.width(), aImage.height())
+class QrCodeImageSource::Private {
+public:
+ static QImage gray(const QImage& aImage);
+ static bool isGray(const QImage& aImage);
+ static const QVector<QRgb> grayColorTable();
+ static const QVector<QRgb> gGrayColorTable;
+};
+
+const QVector<QRgb> QrCodeImageSource::Private::gGrayColorTable
+ (QrCodeImageSource::Private::grayColorTable());
+
+const QVector<QRgb> QrCodeImageSource::Private::grayColorTable()
+{
+ QVector<QRgb> colors;
+ colors.reserve(256);
+ for (int i = 0; i < 256; i++) {
+ colors.append(qRgb(i, i, i));
+ }
+ return colors;
+}
+
+bool QrCodeImageSource::Private::isGray(const QImage& aImage)
+{
+ if (aImage.format() == QImage::Format_Indexed8) {
+ const int n = gGrayColorTable.count();
+ if (aImage.colorCount() == n) {
+ const QVector<QRgb> ct = aImage.colorTable();
+ const QRgb* data1 = ct.constData();
+ const QRgb* data2 = gGrayColorTable.constData();
+ // Most of the time pointers would match
+ if (data1 == data2 || !memcmp(data1, data2, sizeof(QRgb)*n)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+QImage QrCodeImageSource::Private::gray(const QImage& aImage)
{
- if (aImage.depth() == 32) {
- iImage = aImage;
+ if (isGray(aImage) || aImage.isNull()) {
+ return aImage;
+ } else if (aImage.depth() != 32) {
+ return gray(aImage.convertToFormat(QImage::Format_RGB32));
} else {
- iImage = aImage.convertToFormat(QImage::Format_RGB32);
+ const int w = aImage.width();
+ const int h = aImage.height();
+ QImage gray(w, h, QImage::Format_Indexed8);
+ gray.setColorTable(gGrayColorTable);
+
+ const uchar* idata = aImage.constBits();
+ const uint istride = aImage.bytesPerLine();
+ uchar* odata = gray.bits();
+ const uint ostride = gray.bytesPerLine();
+
+ for (int y = 0; y < h; y++, idata += istride, odata += ostride) {
+ uchar* dest = odata;
+ const QRgb* src = (const QRgb*)idata;
+ for (int x = 0; x < w; x++) {
+ const QRgb rgb = *src++;
+ // *dest++ = qGray(rgb);
+ // This is significantly faster than gGray() but is
+ // just as good for our purposes:
+ *dest++ = (uchar)((((rgb & 0x00ff0000) >> 16) +
+ ((rgb & 0x0000ff00) >> 8) +
+ (rgb & 0xff))/3);
+ }
+ }
+ return gray;
}
+}
- const int height = getHeight();
- iGrayRows = new zxing::byte*[height];
- memset(iGrayRows, 0, sizeof(iGrayRows[0]) * height);
+QrCodeImageSource::QrCodeImageSource(QImage aImage) :
+ zxing::LuminanceSource(aImage.width(), aImage.height()),
+ iImage(Private::gray(aImage))
+{
}
QrCodeImageSource::~QrCodeImageSource()
{
- const int height = iImage.height();
- for (int i = 0; i < height; i++) {
- delete [] iGrayRows [i];
- }
- delete [] iGrayRows;
}
zxing::ArrayRef<zxing::byte> QrCodeImageSource::getRow(int aY, zxing::ArrayRef<zxing::byte> aRow) const
@@ -83,35 +142,10 @@
const zxing::byte* QrCodeImageSource::getGrayRow(int aY) const
{
- if (!iGrayRows[aY]) {
- const int width = iImage.width();
- zxing::byte* row = new zxing::byte[width];
- const QRgb* pixels = (const QRgb*)iImage.scanLine(aY);
- for (int x = 0; x < width; x++) {
- const QRgb rgb = *pixels++;
- // This is significantly faster than gGray() but is
- // just as good for our purposes
- row[x] = (zxing::byte)((((rgb & 0x00ff0000) >> 16) +
- ((rgb && 0x0000ff00) >> 8) +
- (rgb & 0xff))/3);
- }
- iGrayRows[aY] = row;
- }
- return iGrayRows[aY];
+ return iImage.constBits() + aY * iImage.bytesPerLine();
}
QImage QrCodeImageSource::grayscaleImage() const
{
- const int w = iImage.width();
- const int h = iImage.height();
- QRgb* buf = (QRgb*)malloc(w * h * sizeof(QRgb));
- QRgb* ptr = buf;
- for (int y = 0; y < h; y++) {
- const zxing::byte* src = getGrayRow(y);
- for (int x = 0; x < w; x++) {
- int g = *src++;
- *ptr++ = qRgb(g, g, g);
- }
- }
- return QImage((uchar*)buf, w, h, QImage::Format_ARGB32, free, buf);
+ return iImage;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/src/QrCodeImageSource.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2022 Jolla Ltd.
+ * Copyright (C) 2019-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -40,6 +40,7 @@
class QrCodeImageSource : public zxing::LuminanceSource {
Q_DISABLE_COPY(QrCodeImageSource)
+ class Private;
public:
QrCodeImageSource(QImage aImage);
@@ -55,8 +56,6 @@
private:
QImage iImage;
- mutable zxing::byte** iGrayRows;
- mutable zxing::ArrayRef<zxing::byte> iGrayImage;
};
#endif // QRCODE_IMAGESOURCE_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.0.tar.gz/src/main.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019-2021 Jolla Ltd.
- * Copyright (C) 2019-2021 Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2022 Jolla Ltd.
+ * Copyright (C) 2019-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -49,7 +49,6 @@
#include "HarbourDebug.h"
#include "HarbourSystemState.h"
-#include "HarbourTheme.h"
#include <sailfishapp.h>
@@ -67,7 +66,6 @@
{
qmlRegisterSingletonType<HarbourProcessState>(uri, v1, v2, "HarbourProcessState", HarbourProcessState::createSingleton);
qmlRegisterSingletonType<HarbourSystemState>(uri, v1, v2, "HarbourSystemState", HarbourSystemState::createSingleton);
- qmlRegisterSingletonType<HarbourTheme>(uri, v1, v2, "HarbourTheme", HarbourTheme::createSingleton);
qmlRegisterSingletonType<FoilAuthSettings>(uri, v1, v2, "FoilAuthSettings", FoilAuthSettings::createSingleton);
qmlRegisterSingletonType<FoilAuthModel>(uri, v1, v2, "FoilAuthModel", FoilAuthModel::createSingleton);
qmlRegisterSingletonType<FoilAuth>(uri, v1, v2, "FoilAuth", FoilAuth::createSingleton);
|