Hello community,
here is the log from the commit of package yubikey-personalization-gui for openSUSE:Factory checked in at 2015-10-08 08:24:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yubikey-personalization-gui (Old)
and /work/SRC/openSUSE:Factory/.yubikey-personalization-gui.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yubikey-personalization-gui"
Changes:
--------
--- /work/SRC/openSUSE:Factory/yubikey-personalization-gui/yubikey-personalization-gui.changes 2015-06-09 08:50:27.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yubikey-personalization-gui.new/yubikey-personalization-gui.changes 2015-10-08 08:24:17.000000000 +0200
@@ -1,0 +2,15 @@
+Thu Oct 1 20:26:30 UTC 2015 - t.gruner@katodev.de
+
+- Version 3.1.23 (released 2015-10-01)
+ - Fix a bug that caused a crash on selecting keyboard layout.
+
+-------------------------------------------------------------------
+Wed Sep 30 13:38:21 UTC 2015 - t.gruner@katodev.de
+
+- Version 3.1.22 (released 2015-09-25)
+ - Fix so version detection works correctly for versions with more than one digit.
+ - Add german keyboard layout.
+ - Fixup neo-n picture
+- fixes #56 - make sure scanedit is initialized
+
+ -------------------------------------------------------------------
Old:
----
yubikey-personalization-gui-3.1.21.tar.gz
New:
----
yubikey-personalization-gui-3.1.23.tar.gz
yubikey-personalization-gui-3.1.23.tar.gz.sig
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yubikey-personalization-gui.spec ++++++
--- /var/tmp/diff_new_pack.YSyEBS/_old 2015-10-08 08:24:18.000000000 +0200
+++ /var/tmp/diff_new_pack.YSyEBS/_new 2015-10-08 08:24:18.000000000 +0200
@@ -17,20 +17,21 @@
Name: yubikey-personalization-gui
-Version: 3.1.21
+Version: 3.1.23
Release: 0
Summary: GUI for Yubikey personalization
License: BSD-2-Clause
Group: Productivity/Networking/Security
Url: https://developers.yubico.com/
Source0: https://developers.yubico.com/yubikey-personalization-gui/Releases/%{name}-%{version}.tar.gz
+Source1: https://developers.yubico.com/yubikey-personalization-gui/Releases/%{name}-%{version}.tar.gz.sig
BuildRequires: desktop-file-utils
BuildRequires: libykpers-devel => 1.14
BuildRequires: libyubikey-devel => 1.12
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(Qt5Widgets)
-Requires: ykpers >= 1.12
+Requires: ykpers >= 1.14
%description
The YubiKey Personalization Tool is a Qt based Cross-Platform utility
++++++ yubikey-personalization-gui-3.1.21.tar.gz -> yubikey-personalization-gui-3.1.23.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/.gitignore new/yubikey-personalization-gui-3.1.23/.gitignore
--- old/yubikey-personalization-gui-3.1.21/.gitignore 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/.gitignore 2015-10-01 12:32:44.000000000 +0200
@@ -16,6 +16,8 @@
lib/release/
tests/tests.pro.user
lib/scanedit.o
+lib/de-scanedit.o
+lib/us-scanedit.o
lib/yubikeyutil.o
tests/moc_scanedittest.cpp
tests/moc_scanedittest.o
@@ -24,3 +26,8 @@
tests/moc_yubikeyutiltest.o
tests/test.o
tests/yubikeyutiltest.o
+tests/versiontest.o
+tests/moc_versiontest.cpp
+tests/moc_versiontest.o
+tests/release/
+tests/debug/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/ChangeLog new/yubikey-personalization-gui-3.1.23/ChangeLog
--- old/yubikey-personalization-gui-3.1.21/ChangeLog 2015-05-29 10:14:45.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/ChangeLog 2015-10-01 12:33:06.000000000 +0200
@@ -1,3 +1,101 @@
+2015-10-01 Klas Lindfors
+
+ * NEWS: NEWS for 3.1.23
+
+2015-09-30 Klas Lindfors
+
+ * tests/scanedittest.cpp: simplify test by not using new/delete
+
+2015-09-30 Klas Lindfors
+
+ * src/ui/staticpage.cpp: make sure scanedit is initialized fixes #56
+
+2015-09-25 Klas Lindfors
+
+ * NEWS, src/src.pro: bump versions
+
+2015-09-25 Klas Lindfors
+
+ * NEWS: NEWS for 3.1.22
+
+2015-09-23 Klas Lindfors
+
+ * .gitignore: ignore
+
+2015-09-22 Klas Lindfors
+
+ * : fixup neo picture
+
+2015-09-22 Klas Lindfors
+
+ * lib/scanedit.cpp: remove debugging for every encode case and add
+ debug for failure
+
+2015-09-22 Klas Lindfors
+
+ * lib/de-scanedit.cpp: add <> for german layout
+
+2015-09-22 Klas Lindfors
+
+ * .gitignore, lib/common.h, lib/de-scanedit.cpp, lib/de-scanedit.h,
+ lib/lib.pro, lib/scanedit.cpp, src/ui/staticpage.cpp,
+ src/ui/staticpage.ui: add german layout to scancode passwords
+
+2015-09-22 Klas Lindfors
+
+ * lib/common.h, src/ui/staticpage.cpp: modularize scanedit so it's
+ instantiated when selected
+
+2015-09-22 Klas Lindfors
+
+ * .gitignore, lib/lib.pro, lib/scanedit.cpp, lib/scanedit.h,
+ lib/us-scanedit.cpp, lib/us-scanedit.h, src/ui/staticpage.cpp,
+ tests/scanedittest.cpp: add inheritance for scanedit parts
+
+2015-09-22 Klas Lindfors
+
+ * lib/scanedit.cpp, lib/scanedit.h, src/ui/staticpage.cpp,
+ src/ui/staticpage.h, tests/scanedittest.cpp: refactor scanedit to
+ only use one lookup table
+
+2015-09-22 Klas Lindfors
+
+ * src/ui/mainwindow.cpp: use edge picture for 4.2
+
+2015-09-04 Klas Lindfors
+
+ * .gitignore, lib/common.h, src/yubikeyfinder.h, tests/test.cpp,
+ tests/tests.pro, tests/versiontest.cpp, tests/versiontest.h: move
+ YK_VERSION macro to common, add tests for it and fix it
+
+2015-09-04 Klas Lindfors
+
+ * src/yubikeyfinder.h: fixup YK_VERSION macro so higher versions are
+ recognized
+
+2015-07-09 Klas Lindfors
+
+ * lib/yubikeyutil.cpp, src/ui/toolpage.cpp: take some care to set
+ resultLen on errors
+
+2015-07-09 Klas Lindfors
+
+ * tests/yubikeyutiltest.cpp, tests/yubikeyutiltest.h: test
+ getNextModhex() with uneven amount
+
+2015-05-29 Klas Lindfors
+
+ * lib/lib.pro, src/src.pro, tests/tests.pro: change syntax for
+ accepting CXXFLAGS and LDFLAGS they now have to be given as options to qmake, instead of env
+
+2015-06-23 Konstantinos Georgantas
+
+ * README: fix typo
+
+2015-05-29 Klas Lindfors
+
+ * NEWS, src/src.pro: bump versions
+
2015-05-29 Klas Lindfors
* NEWS: NEWS for 3.1.21
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/NEWS new/yubikey-personalization-gui-3.1.23/NEWS
--- old/yubikey-personalization-gui-3.1.21/NEWS 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/NEWS 2015-10-01 12:32:44.000000000 +0200
@@ -1,5 +1,17 @@
yubikey-personalization-gui NEWS -- History of user-visible changes. -*- outline -*-
+* Version 3.1.23 (released 2015-10-01)
+
+** Fix a bug that caused a crash on selecting keyboard layout.
+
+* Version 3.1.22 (released 2015-09-25)
+
+** Fix so version detection works correctly for versions with more than one digit.
+
+** Add german keyboard layout.
+
+** Fixup neo-n picture
+
* Version 3.1.21 (released 2015-05-29)
** Fix a bug where decode functions where given src length instead of result.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/README new/yubikey-personalization-gui-3.1.23/README
--- old/yubikey-personalization-gui-3.1.21/README 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/README 2015-10-01 12:32:44.000000000 +0200
@@ -50,7 +50,7 @@
yubikey-personalization-gui depends on version 1.14.0 or higher of
libykpers.
-When building on Windows and mac you will need a binary buikd of
+When building on Windows and mac you will need a binary build of
https://developers.yubico.com/yubikey-personalization[yubikey-personalization],
the contents should then be places in libs/win32, libs/win64 and libs/macx
respectively.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/common.h new/yubikey-personalization-gui-3.1.23/lib/common.h
--- old/yubikey-personalization-gui-3.1.21/lib/common.h 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/lib/common.h 2015-10-01 12:32:44.000000000 +0200
@@ -31,6 +31,8 @@
#include "otpdef.h"
+#define YK_VERSION(MAJOR, MINOR, BUILD) (MAJOR * 10000 + MINOR * 100 + BUILD)
+
//typedef std::vector<int>::size_type size_t;
enum AccMode {
@@ -64,6 +66,10 @@
#define ERR_MORETHANONE 3
#define ERR_UNKNOWN_FIRMWARE 4
+#define KEYMAP_NONE 0
+#define KEYMAP_US 1
+#define KEYMAP_DE 2
+
//Timeouts
#define TIMEOUT_STATUS 10000
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/de-scanedit.cpp new/yubikey-personalization-gui-3.1.23/lib/de-scanedit.cpp
--- old/yubikey-personalization-gui-3.1.21/lib/de-scanedit.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/yubikey-personalization-gui-3.1.23/lib/de-scanedit.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -0,0 +1,141 @@
+/*
+Copyright (C) 2015 Yubico AB. All rights reserved.
+
+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.
+
+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
+HOLDER 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 "de-scanedit.h"
+
+#define SHIFT 0x80
+
+DeScanEdit::DeScanEdit() {
+ keyMap = QMap();
+ keyMap[0x09] = 0x2b; /* \t */
+ keyMap[0x0a] = 0x28; /* \n */
+ keyMap[0x20] = 0x2c; /* */
+ keyMap[0x21] = 0x1e | SHIFT; /* ! */
+ keyMap[0x22] = 0x1f | SHIFT; /* " */
+ keyMap[0x23] = 0x32; /* # */
+ keyMap[0x24] = 0x21 | SHIFT; /* $ */
+ keyMap[0x25] = 0x22 | SHIFT; /* % */
+ keyMap[0x26] = 0x23 | SHIFT; /* & */
+ keyMap[0x27] = 0x32 | SHIFT; /* ' */
+ keyMap[0x28] = 0x25 | SHIFT; /* ( */
+ keyMap[0x29] = 0x26 | SHIFT; /* ) */
+ keyMap[0x2a] = 0x30 | SHIFT; /* * */
+ keyMap[0x2b] = 0x30; /* + */
+ keyMap[0x2c] = 0x36; /* , */
+ keyMap[0x2d] = 0x38; /* - */
+ keyMap[0x2e] = 0x37; /* . */
+ keyMap[0x2f] = 0x24 | SHIFT; /* / */
+ keyMap[0x30] = 0x27; /* 0 */
+ keyMap[0x31] = 0x1e; /* 1 */
+ keyMap[0x32] = 0x1f; /* 2 */
+ keyMap[0x33] = 0x20; /* 3 */
+ keyMap[0x34] = 0x21; /* 4 */
+ keyMap[0x35] = 0x22; /* 5 */
+ keyMap[0x36] = 0x23; /* 6 */
+ keyMap[0x37] = 0x24; /* 7 */
+ keyMap[0x38] = 0x25; /* 8 */
+ keyMap[0x39] = 0x26; /* 9 */
+ keyMap[0x3a] = 0x37 | SHIFT; /* : */
+ keyMap[0x3b] = 0x36 | SHIFT; /* ; */
+ keyMap[0x3c] = 0x64; /* < */
+ keyMap[0x3d] = 0x27 | SHIFT; /* = */
+ keyMap[0x3e] = 0x64 | SHIFT; /* > */
+ keyMap[0x3f] = 0x2d | SHIFT; /* ? */
+ keyMap[0x40] = 0; /* @ */
+ keyMap[0x41] = 0x04 | SHIFT; /* A */
+ keyMap[0x42] = 0x05 | SHIFT; /* B */
+ keyMap[0x43] = 0x06 | SHIFT; /* C */
+ keyMap[0x44] = 0x07 | SHIFT; /* D */
+ keyMap[0x45] = 0x08 | SHIFT; /* E */
+ keyMap[0x46] = 0x09 | SHIFT; /* F */
+ keyMap[0x47] = 0x0a | SHIFT; /* G */
+ keyMap[0x48] = 0x0b | SHIFT; /* H */
+ keyMap[0x49] = 0x0c | SHIFT; /* I */
+ keyMap[0x4a] = 0x0d | SHIFT; /* J */
+ keyMap[0x4b] = 0x0e | SHIFT; /* K */
+ keyMap[0x4c] = 0x0f | SHIFT; /* L */
+ keyMap[0x4d] = 0x10 | SHIFT; /* M */
+ keyMap[0x4e] = 0x11 | SHIFT; /* N */
+ keyMap[0x4f] = 0x12 | SHIFT; /* O */
+ keyMap[0x50] = 0x13 | SHIFT; /* P */
+ keyMap[0x51] = 0x14 | SHIFT; /* Q */
+ keyMap[0x52] = 0x15 | SHIFT; /* R */
+ keyMap[0x53] = 0x16 | SHIFT; /* S */
+ keyMap[0x54] = 0x17 | SHIFT; /* T */
+ keyMap[0x55] = 0x18 | SHIFT; /* U */
+ keyMap[0x56] = 0x19 | SHIFT; /* V */
+ keyMap[0x57] = 0x1a | SHIFT; /* W */
+ keyMap[0x58] = 0x1b | SHIFT; /* X */
+ keyMap[0x59] = 0x1d | SHIFT; /* Y */
+ keyMap[0x5a] = 0x1c | SHIFT; /* Z */
+ keyMap[0x5b] = 0; /* [ */
+ keyMap[0x5c] = 0; /* \ */
+ keyMap[0x5d] = 0; /* ] */
+ keyMap[0x5e] = 0x35; /* ^ */
+ keyMap[0x5f] = 0x38 | SHIFT; /* _ */
+ keyMap[0x60] = 0x2d | SHIFT; /* ` */
+ keyMap[0x61] = 0x04; /* a */
+ keyMap[0x62] = 0x05; /* b */
+ keyMap[0x63] = 0x06; /* c */
+ keyMap[0x64] = 0x07; /* d */
+ keyMap[0x65] = 0x08; /* e */
+ keyMap[0x66] = 0x09; /* f */
+ keyMap[0x67] = 0x0a; /* g */
+ keyMap[0x68] = 0x0b; /* h */
+ keyMap[0x69] = 0x0c; /* i */
+ keyMap[0x6a] = 0x0d; /* j */
+ keyMap[0x6b] = 0x0e; /* k */
+ keyMap[0x6c] = 0x0f; /* l */
+ keyMap[0x6d] = 0x10; /* m */
+ keyMap[0x6e] = 0x11; /* n */
+ keyMap[0x6f] = 0x12; /* o */
+ keyMap[0x70] = 0x13; /* p */
+ keyMap[0x71] = 0x14; /* q */
+ keyMap[0x72] = 0x15; /* r */
+ keyMap[0x73] = 0x16; /* s */
+ keyMap[0x74] = 0x17; /* t */
+ keyMap[0x75] = 0x18; /* u */
+ keyMap[0x76] = 0x19; /* v */
+ keyMap[0x77] = 0x1a; /* w */
+ keyMap[0x78] = 0x1b; /* x */
+ keyMap[0x79] = 0x1d; /* y */
+ keyMap[0x7a] = 0x1c; /* z */
+ keyMap[0x7b] = 0; /* { */
+ keyMap[0x7c] = 0; /* | */
+ keyMap[0x7d] = 0; /* } */
+ keyMap[0x7e] = 0; /* ~ */
+ keyMap[0xa7] = 0x20 | SHIFT; /* § */
+ keyMap[0xb4] = 0x2e; /* ´ */
+ keyMap[0xc4] = 0x34 | SHIFT; /* Ä */
+ keyMap[0xd6] = 0x33 | SHIFT; /* Ö */
+ keyMap[0xdc] = 0x2f | SHIFT; /* Ü */
+ keyMap[0xdf] = 0x2d; /* ß */
+ keyMap[0xe4] = 0x34; /* ä */
+ keyMap[0xf6] = 0x33; /* ö */
+ keyMap[0xfc] = 0x2f; /* ü */
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/de-scanedit.h new/yubikey-personalization-gui-3.1.23/lib/de-scanedit.h
--- old/yubikey-personalization-gui-3.1.21/lib/de-scanedit.h 1970-01-01 01:00:00.000000000 +0100
+++ new/yubikey-personalization-gui-3.1.23/lib/de-scanedit.h 2015-10-01 12:32:44.000000000 +0200
@@ -0,0 +1,40 @@
+/*
+Copyright (C) 2015 Yubico AB. All rights reserved.
+
+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.
+
+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
+HOLDER 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.
+ */
+
+#ifndef DE_SCANEDIT_H
+#define DE_SCANEDIT_H
+
+#include "scanedit.h"
+
+class DeScanEdit : public ScanEdit
+{
+public:
+ DeScanEdit();
+};
+
+#endif // DE_SCANEDIT_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/lib.pro new/yubikey-personalization-gui-3.1.23/lib/lib.pro
--- old/yubikey-personalization-gui-3.1.21/lib/lib.pro 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/lib/lib.pro 2015-10-01 12:32:44.000000000 +0200
@@ -16,16 +16,20 @@
HEADERS += \
scanedit.h \
+ us-scanedit.h \
+ de-scanedit.h \
common.h \
otpdef.h \
yubikeyutil.h
SOURCES += \
scanedit.cpp \
+ us-scanedit.cpp \
+ de-scanedit.cpp \
yubikeyutil.cpp
-QMAKE_CXXFLAGS += $$(CXXFLAGS) $$(CPPFLAGS)
-QMAKE_LFLAGS += $$(LDFLAGS)
+QMAKE_CXXFLAGS += $$CXXFLAGS $$CPPFLAGS
+QMAKE_LFLAGS += $$LDFLAGS
cross {
message("Doing a cross platform build..")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/scanedit.cpp new/yubikey-personalization-gui-3.1.23/lib/scanedit.cpp
--- old/yubikey-personalization-gui-3.1.21/lib/scanedit.cpp 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/lib/scanedit.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2011-2013 Yubico AB. All rights reserved.
+Copyright (C) 2011-2015 Yubico AB. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -30,282 +30,33 @@
#include "yubikeyutil.h"
#include "common.h"
-#define TAB 0x2b
-#define RETURN 0x28
-#define SHIFT 0x80
+#include <QDebug>
-static const unsigned char key2usb[] = {
- 0x00, /* 0 0x00 */
- 0x00, /* 1 0x01 */
- 0x00, /* 2 0x02 */
- 0x00, /* 3 0x03 */
- 0x00, /* 4 0x04 */
- 0x00, /* 5 0x05 */
- 0x00, /* 6 0x06 */
- 0x00, /* 7 0x07 */
- 0x00, /* 8 0x08 Backspace (0x2a) */
- 0x00, /* 9 0x09 Tab (0x2b) */
- 0x00, /* 10 0x0a Back Tab (0x2b | SHIFT) */
- 0x00, /* 11 0x0b Home (0x4a)*/
- 0x00, /* 12 0x0c Form Feed */
- 0x28, /* 13 0x0d Return */
- 0x00, /* 14 0x0e */
- 0x00, /* 15 0x0f */
- 0x00, /* 16 0x10 */
- 0x00, /* 17 0x11 */
- 0x00, /* 18 0x12 */
- 0x00, /* 19 0x13 */
- 0x00, /* 20 0x14 */
- 0x00, /* 21 0x15 */
- 0x00, /* 22 0x16 */
- 0x00, /* 23 0x17 */
- 0x00, /* 24 0x18 Cancel (0x9b) */
- 0x00, /* 25 0x19 */
- 0x00, /* 26 0x1a */
- 0x00, /* 27 0x1b Escape (0x29) */
- 0x00, /* 28 0x1c */
- 0x00, /* 29 0x1d */
- 0x00, /* 30 0x1e */
- 0x00, /* 31 0x1f */
- 0x2c, /* 32 0x20 */
- 0x1e | SHIFT, /* 33 0x21 ! */
- 0x34 | SHIFT, /* 34 0x22 " */
- 0x20 | SHIFT, /* 35 0x23 # */
- 0x21 | SHIFT, /* 36 0x24 $ */
- 0x22 | SHIFT, /* 37 0x25 % */
- 0x24 | SHIFT, /* 38 0x26 & */
- 0x34, /* 39 0x27 ' */
- 0x26 | SHIFT, /* 40 0x28 ( */
- 0x27 | SHIFT, /* 41 0x29 ) */
- 0x25 | SHIFT, /* 42 0x2a * */
- 0x2e | SHIFT, /* 43 0x2b + */
- 0x36, /* 44 0x2c , */
- 0x2d, /* 45 0x2d - */
- 0x37, /* 46 0x2e . */
- 0x38, /* 47 0x2f / */
- 0x27, /* 48 0x30 0 */
- 0x1e, /* 49 0x31 1 */
- 0x1f, /* 50 0x32 2 */
- 0x20, /* 51 0x33 3 */
- 0x21, /* 52 0x34 4 */
- 0x22, /* 53 0x35 5 */
- 0x23, /* 54 0x36 6 */
- 0x24, /* 55 0x37 7 */
- 0x25, /* 56 0x38 8 */
- 0x26, /* 57 0x39 9 */
- 0x33 | SHIFT, /* 58 0x3a : */
- 0x33, /* 59 0x3b ; */
- 0x36 | SHIFT, /* 60 0x3c < */
- 0x2e, /* 61 0x3d = */
- 0x37 | SHIFT, /* 62 0x3e > */
- 0x38 | SHIFT, /* 63 0x3f ? */
- 0x1f | SHIFT, /* 64 0x40 @ */
- 0x04 | SHIFT, /* 65 0x41 A */
- 0x05 | SHIFT, /* 66 0x42 B */
- 0x06 | SHIFT, /* 67 0x43 C */
- 0x07 | SHIFT, /* 68 0x44 D */
- 0x08 | SHIFT, /* 69 0x45 E */
- 0x09 | SHIFT, /* 70 0x46 F */
- 0x0a | SHIFT, /* 71 0x47 G */
- 0x0b | SHIFT, /* 72 0x48 H */
- 0x0c | SHIFT, /* 73 0x49 I */
- 0x0d | SHIFT, /* 74 0x4a J */
- 0x0e | SHIFT, /* 75 0x4b K */
- 0x0f | SHIFT, /* 76 0x4c L */
- 0x10 | SHIFT, /* 77 0x4d M */
- 0x11 | SHIFT, /* 78 0x4e N */
- 0x12 | SHIFT, /* 79 0x4f O */
- 0x13 | SHIFT, /* 80 0x50 P */
- 0x14 | SHIFT, /* 81 0x51 Q */
- 0x15 | SHIFT, /* 82 0x52 R */
- 0x16 | SHIFT, /* 83 0x53 S */
- 0x17 | SHIFT, /* 84 0x54 T */
- 0x18 | SHIFT, /* 85 0x55 U */
- 0x19 | SHIFT, /* 86 0x56 V */
- 0x1a | SHIFT, /* 87 0x57 W */
- 0x1b | SHIFT, /* 88 0x58 X */
- 0x1c | SHIFT, /* 89 0x59 Y */
- 0x1d | SHIFT, /* 90 0x5a Z */
- 0x2f, /* 91 0x5b [ */
- 0x32, /* 92 0x5c \ */
- 0x30, /* 93 0x5d ] */
- 0X23 | SHIFT, /* 94 0x5e ^ */
- 0x2d | SHIFT, /* 95 0x5f _ */
- 0x35, /* 96 0x60 ` */
- 0x04, /* 97 0x61 a */
- 0x05, /* 98 0x62 b */
- 0x06, /* 99 0x63 c */
- 0x07, /* 100 0x64 d */
- 0x08, /* 101 0x65 e */
- 0x09, /* 102 0x66 f */
- 0x0a, /* 103 0x67 g */
- 0x0b, /* 104 0x68 h */
- 0x0c, /* 105 0x69 i */
- 0x0d, /* 106 0x6a j */
- 0x0e, /* 107 0x6b k */
- 0x0f, /* 108 0x6c l */
- 0x10, /* 109 0x6d m */
- 0x11, /* 110 0x6e n */
- 0x12, /* 111 0x6f o */
- 0x13, /* 112 0x70 p */
- 0x14, /* 113 0x71 q */
- 0x15, /* 114 0x72 r */
- 0x16, /* 115 0x73 s */
- 0x17, /* 116 0x74 t */
- 0x18, /* 117 0x75 u */
- 0x19, /* 118 0x76 v */
- 0x1a, /* 119 0x77 w */
- 0x1b, /* 120 0x78 x */
- 0x1c, /* 121 0x79 y */
- 0x1d, /* 122 0x7a z */
- 0x2f | SHIFT, /* 123 0x7b { */
- 0x32 | SHIFT, /* 124 0x7c | */
- 0x30 | SHIFT, /* 125 0x7d } */
- 0x35 | SHIFT, /* 126 0x7e ~ */
- 0x00, /* 127 0x7f */
-};
-
-static const char *usb2key1[] = {
- "",
- "",
- "",
- "",
- "a",
- "b",
- "c",
- "d",
- "e",
- "f",
- "g", /* 0xa */
- "h",
- "i",
- "j",
- "k",
- "l",
- "m",
- "n",
- "o",
- "p",
- "q", /* 0x14 */
- "r",
- "s",
- "t",
- "u",
- "v",
- "w",
- "x",
- "y",
- "z",
- "1", /* 0x1e */
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",
- "9",
- "0",
- "\\n", /* 0x28 */
- "",
- "",
- "\\t",
- " ",
- "-",
- "=",
- "[",
- "]",
- "",
- "\\\\",
- ";",
- "'",
- "`",
- ",",
- ".",
- "/", /* 0x38 */
-};
-
-static const char *usb2key2[] = {
- "",
- "",
- "",
- "",
- "A",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G", /* 0x8a */
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "Q", /* 0x94 */
- "R",
- "S",
- "T",
- "U",
- "V",
- "W",
- "X",
- "Y",
- "Z",
- "!",
- "@",
- "#",
- "$",
- "%",
- "^",
- "&",
- "*",
- "(",
- ")",
- "",
- "",
- "",
- "",
- "",
- "_",
- "+",
- "{",
- "}",
- "",
- "|",
- ":",
- "\"",
- "~",
- "<",
- ">",
- "?",
-};
+ScanEdit::ScanEdit() {
+}
QString ScanEdit::textToScanCodes(const QString text) {
QString scanCode;
for(int i = 0; i < text.length(); i++) {
- QChar ch = text.at(i).toLatin1();
+ QChar ch = text.at(i);
unsigned char code = 0;
if(ch == '\\') {
if(i + 1 != text.length()) {
- QChar next = text.at(i + 1).toLatin1();
+ QChar next = text.at(i + 1);
if(next == '\\') {
i++;
} else if(next == 't') {
i++;
- code = TAB;
+ ch = '\t';
} else if(next == 'n') {
i++;
- code = RETURN;
+ ch = '\n';
}
}
}
+ code = keyMap.value(ch.toLatin1() & 0xff, 0);
if(code == 0) {
- code = key2usb[(int)ch.toLatin1()];
+ qDebug() << "no mapping for" << ch;
}
QString hexTxt = YubiKeyUtil::qstrHexEncode(&code, 1);
scanCode += hexTxt;
@@ -319,16 +70,12 @@
bool ok;
unsigned int code = scanCode.mid(i, 2).toUInt(&ok, 16);
if(ok == true) {
- if(code < SHIFT) {
- if(code < sizeof(usb2key1) / sizeof(char*)) {
- text += usb2key1[code];
- }
- } else {
- code = code ^ SHIFT;
- if(code < sizeof(usb2key2) / sizeof(char*)) {
- text += usb2key2[code];
- }
- }
+ QString key;
+ key += keyMap.key(code, 0);
+ if(key == "\n") key = "\\n";
+ if(key == "\t") key = "\\t";
+ if(key == "\\") key = "\\\\";
+ text += key;
}
}
return text;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/scanedit.h new/yubikey-personalization-gui-3.1.23/lib/scanedit.h
--- old/yubikey-personalization-gui-3.1.21/lib/scanedit.h 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/lib/scanedit.h 2015-10-01 12:32:44.000000000 +0200
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2011-2013 Yubico AB. All rights reserved.
+Copyright (C) 2015 Yubico AB. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -30,12 +30,16 @@
#define SCANEDIT_H
#include <QString>
+#include <QMap>
class ScanEdit
{
+protected:
+ QMap keyMap;
+ ScanEdit();
public:
- static QString textToScanCodes(const QString text);
- static QString scanCodesToText(const QString scanCode);
+ QString textToScanCodes(const QString text);
+ QString scanCodesToText(const QString scanCode);
};
#endif // SCANEDIT_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/us-scanedit.cpp new/yubikey-personalization-gui-3.1.23/lib/us-scanedit.cpp
--- old/yubikey-personalization-gui-3.1.21/lib/us-scanedit.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/yubikey-personalization-gui-3.1.23/lib/us-scanedit.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -0,0 +1,163 @@
+/*
+Copyright (C) 2015 Yubico AB. All rights reserved.
+
+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.
+
+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
+HOLDER 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 "us-scanedit.h"
+
+#define SHIFT 0x80
+
+UsScanEdit::UsScanEdit() {
+ keyMap = QMap();
+ keyMap[0x00] = 0;
+ keyMap[0x01] = 0;
+ keyMap[0x02] = 0;
+ keyMap[0x03] = 0;
+ keyMap[0x04] = 0;
+ keyMap[0x05] = 0;
+ keyMap[0x06] = 0;
+ keyMap[0x07] = 0;
+ keyMap[0x08] = 0;
+ keyMap[0x09] = 0x2b; /* \t */
+ keyMap[0x0a] = 0x28; /* \n */
+ keyMap[0x0b] = 0;
+ keyMap[0x0c] = 0;
+ keyMap[0x0d] = 0;
+ keyMap[0x0e] = 0;
+ keyMap[0x0f] = 0;
+ keyMap[0x10] = 0;
+ keyMap[0x11] = 0;
+ keyMap[0x12] = 0;
+ keyMap[0x13] = 0;
+ keyMap[0x14] = 0;
+ keyMap[0x15] = 0;
+ keyMap[0x16] = 0;
+ keyMap[0x17] = 0;
+ keyMap[0x18] = 0;
+ keyMap[0x19] = 0;
+ keyMap[0x1a] = 0;
+ keyMap[0x1b] = 0;
+ keyMap[0x1c] = 0;
+ keyMap[0x1d] = 0;
+ keyMap[0x1e] = 0;
+ keyMap[0x1f] = 0;
+ keyMap[0x20] = 0x2c; /* */
+ keyMap[0x21] = 0x1e | SHIFT; /* ! */
+ keyMap[0x22] = 0x34 | SHIFT; /* " */
+ keyMap[0x23] = 0x20 | SHIFT; /* # */
+ keyMap[0x24] = 0x21 | SHIFT; /* $ */
+ keyMap[0x25] = 0x22 | SHIFT; /* % */
+ keyMap[0x26] = 0x24 | SHIFT; /* & */
+ keyMap[0x27] = 0x34; /* ' */
+ keyMap[0x28] = 0x26 | SHIFT; /* ( */
+ keyMap[0x29] = 0x27 | SHIFT; /* ) */
+ keyMap[0x2a] = 0x25 | SHIFT; /* * */
+ keyMap[0x2b] = 0x2e | SHIFT; /* + */
+ keyMap[0x2c] = 0x36; /* , */
+ keyMap[0x2d] = 0x2d; /* - */
+ keyMap[0x2e] = 0x37; /* . */
+ keyMap[0x2f] = 0x38; /* / */
+ keyMap[0x30] = 0x27; /* 0 */
+ keyMap[0x31] = 0x1e; /* 1 */
+ keyMap[0x32] = 0x1f; /* 2 */
+ keyMap[0x33] = 0x20; /* 3 */
+ keyMap[0x34] = 0x21; /* 4 */
+ keyMap[0x35] = 0x22; /* 5 */
+ keyMap[0x36] = 0x23; /* 6 */
+ keyMap[0x37] = 0x24; /* 7 */
+ keyMap[0x38] = 0x25; /* 8 */
+ keyMap[0x39] = 0x26; /* 9 */
+ keyMap[0x3a] = 0x33 | SHIFT; /* : */
+ keyMap[0x3b] = 0x33; /* ; */
+ keyMap[0x3c] = 0x36 | SHIFT; /* < */
+ keyMap[0x3d] = 0x2e; /* = */
+ keyMap[0x3e] = 0x37 | SHIFT; /* > */
+ keyMap[0x3f] = 0x38 | SHIFT; /* ? */
+ keyMap[0x40] = 0x1f | SHIFT; /* @ */
+ keyMap[0x41] = 0x04 | SHIFT; /* A */
+ keyMap[0x42] = 0x05 | SHIFT; /* B */
+ keyMap[0x43] = 0x06 | SHIFT; /* C */
+ keyMap[0x44] = 0x07 | SHIFT; /* D */
+ keyMap[0x45] = 0x08 | SHIFT; /* E */
+ keyMap[0x46] = 0x09 | SHIFT; /* F */
+ keyMap[0x47] = 0x0a | SHIFT; /* G */
+ keyMap[0x48] = 0x0b | SHIFT; /* H */
+ keyMap[0x49] = 0x0c | SHIFT; /* I */
+ keyMap[0x4a] = 0x0d | SHIFT; /* J */
+ keyMap[0x4b] = 0x0e | SHIFT; /* K */
+ keyMap[0x4c] = 0x0f | SHIFT; /* L */
+ keyMap[0x4d] = 0x10 | SHIFT; /* M */
+ keyMap[0x4e] = 0x11 | SHIFT; /* N */
+ keyMap[0x4f] = 0x12 | SHIFT; /* O */
+ keyMap[0x50] = 0x13 | SHIFT; /* P */
+ keyMap[0x51] = 0x14 | SHIFT; /* Q */
+ keyMap[0x52] = 0x15 | SHIFT; /* R */
+ keyMap[0x53] = 0x16 | SHIFT; /* S */
+ keyMap[0x54] = 0x17 | SHIFT; /* T */
+ keyMap[0x55] = 0x18 | SHIFT; /* U */
+ keyMap[0x56] = 0x19 | SHIFT; /* V */
+ keyMap[0x57] = 0x1a | SHIFT; /* W */
+ keyMap[0x58] = 0x1b | SHIFT; /* X */
+ keyMap[0x59] = 0x1c | SHIFT; /* Y */
+ keyMap[0x5a] = 0x1d | SHIFT; /* Z */
+ keyMap[0x5b] = 0x2f; /* [ */
+ keyMap[0x5c] = 0x32; /* \ */
+ keyMap[0x5d] = 0x30; /* ] */
+ keyMap[0x5e] = 0x23 | SHIFT; /* ^ */
+ keyMap[0x5f] = 0x2d | SHIFT; /* _ */
+ keyMap[0x60] = 0x35; /* ` */
+ keyMap[0x61] = 0x04; /* a */
+ keyMap[0x62] = 0x05; /* b */
+ keyMap[0x63] = 0x06; /* c */
+ keyMap[0x64] = 0x07; /* d */
+ keyMap[0x65] = 0x08; /* e */
+ keyMap[0x66] = 0x09; /* f */
+ keyMap[0x67] = 0x0a; /* g */
+ keyMap[0x68] = 0x0b; /* h */
+ keyMap[0x69] = 0x0c; /* i */
+ keyMap[0x6a] = 0x0d; /* j */
+ keyMap[0x6b] = 0x0e; /* k */
+ keyMap[0x6c] = 0x0f; /* l */
+ keyMap[0x6d] = 0x10; /* m */
+ keyMap[0x6e] = 0x11; /* n */
+ keyMap[0x6f] = 0x12; /* o */
+ keyMap[0x70] = 0x13; /* p */
+ keyMap[0x71] = 0x14; /* q */
+ keyMap[0x72] = 0x15; /* r */
+ keyMap[0x73] = 0x16; /* s */
+ keyMap[0x74] = 0x17; /* t */
+ keyMap[0x75] = 0x18; /* u */
+ keyMap[0x76] = 0x19; /* v */
+ keyMap[0x77] = 0x1a; /* w */
+ keyMap[0x78] = 0x1b; /* x */
+ keyMap[0x79] = 0x1c; /* y */
+ keyMap[0x7a] = 0x1d; /* z */
+ keyMap[0x7b] = 0x2f | SHIFT; /* { */
+ keyMap[0x7c] = 0x32 | SHIFT; /* | */
+ keyMap[0x7d] = 0x30 | SHIFT; /* } */
+ keyMap[0x7e] = 0x35 | SHIFT; /* ~ */
+ keyMap[0x7f] = 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/us-scanedit.h new/yubikey-personalization-gui-3.1.23/lib/us-scanedit.h
--- old/yubikey-personalization-gui-3.1.21/lib/us-scanedit.h 1970-01-01 01:00:00.000000000 +0100
+++ new/yubikey-personalization-gui-3.1.23/lib/us-scanedit.h 2015-10-01 12:32:44.000000000 +0200
@@ -0,0 +1,40 @@
+/*
+Copyright (C) 2015 Yubico AB. All rights reserved.
+
+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.
+
+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
+HOLDER 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.
+ */
+
+#ifndef US_SCANEDIT_H
+#define US_SCANEDIT_H
+
+#include "scanedit.h"
+
+class UsScanEdit : public ScanEdit
+{
+public:
+ UsScanEdit();
+};
+
+#endif // US_SCANEDIT_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/lib/yubikeyutil.cpp new/yubikey-personalization-gui-3.1.23/lib/yubikeyutil.cpp
--- old/yubikey-personalization-gui-3.1.21/lib/yubikeyutil.cpp 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/lib/yubikeyutil.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -43,6 +43,7 @@
bool modhex)
{
if ((strLen % 2 != 0) || (strLen < minSize) || (strLen > maxSize)) {
+ *resultLen = 0;
return -1;
}
@@ -80,7 +81,7 @@
QString YubiKeyUtil::qstrHexEncode(const unsigned char *str, size_t strLen) {
char result[strLen * 2 + 1];
- size_t resultLen = 0;
+ size_t resultLen;
memset(&result, 0, sizeof(result));
int rc = hexModhexEncode(result, &resultLen, str, strLen, false);
@@ -113,7 +114,7 @@
QString YubiKeyUtil::qstrModhexEncode(const unsigned char *str, size_t strLen) {
char result[strLen * 2 + 1];
- size_t resultLen = 0;
+ size_t resultLen;
memset(&result, 0, sizeof(result));
int rc = hexModhexEncode(result, &resultLen, str, strLen, true);
@@ -130,6 +131,7 @@
const QString &str) {
if(str.size() % 2 != 0) {
+ *resultLen = 0;
return;
}
@@ -147,6 +149,7 @@
void YubiKeyUtil::qstrDecDecode(unsigned char *result, size_t *resultLen,
const QString &str) {
if(str.size() % 2 != 0) {
+ *resultLen = 0;
return;
}
@@ -347,6 +350,9 @@
size_t len;
QString hex;
qstrModhexDecode(result, &len, str);
+ if(len == 0) {
+ return "";
+ }
hex = qstrHexEncode(result, len);
hex = getNextHex(resultLen, hex, scheme);
qstrHexDecode(result, &len, hex);
Files old/yubikey-personalization-gui-3.1.21/resources/images/neo_production_33.mng and new/yubikey-personalization-gui-3.1.23/resources/images/neo_production_33.mng differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/src/src.pro new/yubikey-personalization-gui-3.1.23/src/src.pro
--- old/yubikey-personalization-gui-3.1.21/src/src.pro 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/src/src.pro 2015-10-01 12:32:44.000000000 +0200
@@ -3,7 +3,7 @@
#
VERSION_MAJOR = 3
VERSION_MINOR = 1
-VERSION_BUILD = 21
+VERSION_BUILD = 23
VERSION = "$${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_BUILD}"
APP_NAME = $$quote(YubiKey Personalization Tool)
@@ -120,8 +120,8 @@
../resources/mac/Info.plist.in \
../resources/mac/qt.conf
-QMAKE_CXXFLAGS += $$(CXXFLAGS) $$(CPPFLAGS)
-QMAKE_LFLAGS += $$(LDFLAGS)
+QMAKE_CXXFLAGS += $$CXXFLAGS $$CPPFLAGS
+QMAKE_LFLAGS += $$LDFLAGS
cross {
message("Doing a cross platform build..")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/src/ui/mainwindow.cpp new/yubikey-personalization-gui-3.1.23/src/ui/mainwindow.cpp
--- old/yubikey-personalization-gui-3.1.21/src/ui/mainwindow.cpp 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/src/ui/mainwindow.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -409,7 +409,7 @@
movie->setFileName(":/res/images/neo_production_33.mng");
} else if(version < YK_VERSION(4,1,0)) {
movie->setFileName(":/res/images/plus.mng");
- } else if(version < YK_VERSION(4,2,0)) {
+ } else if(version < YK_VERSION(4,3,0)) {
movie->setFileName(":/res/images/edge.mng");
} else {
pixmap.load(":/res/images/blank.png");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/src/ui/staticpage.cpp new/yubikey-personalization-gui-3.1.23/src/ui/staticpage.cpp
--- old/yubikey-personalization-gui-3.1.21/src/ui/staticpage.cpp 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/src/ui/staticpage.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -33,7 +33,6 @@
#include "ui_staticpage.h"
#include "ui/helpbox.h"
#include "ui/confirmbox.h"
-#include "scanedit.h"
#include <QDesktopServices>
#include <QMessageBox>
@@ -44,6 +43,9 @@
#include <QRegExpValidator>
#include <QTableWidgetItem>
+#include "us-scanedit.h"
+#include "de-scanedit.h"
+
#include "common.h"
StaticPage::StaticPage(QWidget *parent) :
@@ -76,6 +78,8 @@
QRegExp rx("^[a-f0-9]{0,72}$");
ui->quickScanCodesTxt->setValidator(new QRegExpValidator(rx, this));
+
+ scanedit = NULL;
}
StaticPage::~StaticPage() {
@@ -83,7 +87,12 @@
delete m_ykConfig;
m_ykConfig = 0;
}
+
delete ui;
+
+ if(scanedit) {
+ delete scanedit;
+ }
}
/*
@@ -335,7 +344,7 @@
}
void StaticPage::on_quickStaticTxt_textEdited(const QString &txt) {
- QString scanCodes = ScanEdit::textToScanCodes(txt);
+ QString scanCodes = scanedit->textToScanCodes(txt);
ui->quickScanCodesTxt->setText(scanCodes);
int len = scanCodes.length() / 2;
@@ -1096,7 +1105,7 @@
}
void StaticPage::on_quickScanCodesTxt_textEdited(const QString &scanCodes) {
- QString text = ScanEdit::scanCodesToText(scanCodes);
+ QString text = scanedit->scanCodesToText(scanCodes);
ui->quickStaticTxt->setText(text);
int len = scanCodes.length() / 2;
@@ -1126,13 +1135,22 @@
ui->quickStaticTxt->clear();
ui->quickScanCodesTxt->clear();
- if (index == 0) {
+ if(scanedit) {
+ delete scanedit;
+ scanedit = NULL;
+ }
+ if (index == KEYMAP_NONE) {
ui->quickStaticTxt->setEnabled(false);
ui->quickScanCodesTxt->setEnabled(false);
ui->quickInsertTabBtn->setEnabled(false);
ui->quickClearBtn->setEnabled(false);
}
else {
+ if(index == KEYMAP_US) {
+ scanedit = new UsScanEdit();
+ } else if(index == KEYMAP_DE) {
+ scanedit = new DeScanEdit();
+ }
ui->quickStaticTxt->setEnabled(true);
ui->quickScanCodesTxt->setEnabled(true);
ui->quickInsertTabBtn->setEnabled(true);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/src/ui/staticpage.h new/yubikey-personalization-gui-3.1.23/src/ui/staticpage.h
--- old/yubikey-personalization-gui-3.1.21/src/ui/staticpage.h 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/src/ui/staticpage.h 2015-10-01 12:32:44.000000000 +0200
@@ -31,6 +31,7 @@
#include <QStackedWidget>
#include "yubikeyconfig.h"
+#include "scanedit.h"
namespace Ui {
class StaticPage;
@@ -68,6 +69,8 @@
bool m_keyPresent;
+ ScanEdit *scanedit;
+
public slots:
void loadSettings();
void setCurrentPage(int pageIndex);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/src/ui/staticpage.ui new/yubikey-personalization-gui-3.1.23/src/ui/staticpage.ui
--- old/yubikey-personalization-gui-3.1.21/src/ui/staticpage.ui 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/src/ui/staticpage.ui 2015-10-01 12:32:44.000000000 +0200
@@ -681,6 +681,11 @@
<string>US Keyboard</string>
</property>
</item>
+ <item>
+ <property name="text">
+ <string>DE Keyboard</string>
+ </property>
+ </item>
</widget>
</widget>
<widget class="QGroupBox" name="quickActionsBox">
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/src/ui/toolpage.cpp new/yubikey-personalization-gui-3.1.23/src/ui/toolpage.cpp
--- old/yubikey-personalization-gui-3.1.21/src/ui/toolpage.cpp 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/src/ui/toolpage.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -219,7 +219,7 @@
void ToolPage::convert(int updatedIndex, QString txt) {
unsigned char buf[32];
memset(buf, 0, sizeof(buf));
- size_t bufLen = 0;
+ size_t bufLen;
switch(updatedIndex) {
case 0: //Hex
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/src/yubikeyfinder.h new/yubikey-personalization-gui-3.1.23/src/yubikeyfinder.h
--- old/yubikey-personalization-gui-3.1.21/src/yubikeyfinder.h 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/src/yubikeyfinder.h 2015-10-01 12:32:44.000000000 +0200
@@ -38,8 +38,6 @@
#include "common.h"
-#define YK_VERSION(MAJOR, MINOR, BUILD) (MAJOR * 100 + MINOR * 10 + BUILD)
-
class YubiKeyFinder : public QObject {
Q_OBJECT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/tests/scanedittest.cpp new/yubikey-personalization-gui-3.1.23/tests/scanedittest.cpp
--- old/yubikey-personalization-gui-3.1.21/tests/scanedittest.cpp 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/tests/scanedittest.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -27,18 +27,20 @@
*/
#include "scanedittest.h"
-#include "scanedit.h"
+#include "us-scanedit.h"
void TestScanEdit::testCharacters() {
+ ScanEdit edit = UsScanEdit();
QString characters = "abcdefghijklmnopqrstuvwxyz1234567890\\n\\t -=[]\\\\;'`,./";
- QString scancodes = ScanEdit::textToScanCodes(characters);
- QString result = ScanEdit::scanCodesToText(scancodes);
+ QString scancodes = edit.textToScanCodes(characters);
+ QString result = edit.scanCodesToText(scancodes);
QCOMPARE(result, characters);
}
void TestScanEdit::testCharacters2() {
+ ScanEdit edit = UsScanEdit();
QString characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+{}|:\"~<>?";
- QString scancodes = ScanEdit::textToScanCodes(characters);
- QString result = ScanEdit::scanCodesToText(scancodes);
+ QString scancodes = edit.textToScanCodes(characters);
+ QString result = edit.scanCodesToText(scancodes);
QCOMPARE(result, characters);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/tests/test.cpp new/yubikey-personalization-gui-3.1.23/tests/test.cpp
--- old/yubikey-personalization-gui-3.1.21/tests/test.cpp 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/tests/test.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -1,14 +1,17 @@
#include "scanedittest.h"
#include "yubikeyutiltest.h"
+#include "versiontest.h"
int main(int argc, char** argv) {
int status = 0;
TestScanEdit scanEdit;
TestYubikeyUtil yubikeyUtil;
+ TestVersion version;
status |= QTest::qExec(&scanEdit, argc, argv);
status |= QTest::qExec(&yubikeyUtil, argc, argv);
+ status |= QTest::qExec(&version, argc, argv);
return status;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/tests/tests.pro new/yubikey-personalization-gui-3.1.23/tests/tests.pro
--- old/yubikey-personalization-gui-3.1.21/tests/tests.pro 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/tests/tests.pro 2015-10-01 12:32:44.000000000 +0200
@@ -1,7 +1,7 @@
QT += testlib
QT -= gui
-SOURCES += test.cpp scanedittest.cpp yubikeyutiltest.cpp
-HEADERS += scanedittest.h yubikeyutiltest.h
+SOURCES += test.cpp scanedittest.cpp yubikeyutiltest.cpp versiontest.cpp
+HEADERS += scanedittest.h yubikeyutiltest.h versiontest.h
CONFIG += testcase no_testcase_installs
CONFIG += console
CONFIG -= app_bundle
@@ -23,8 +23,8 @@
DESTDIR = "$$TARGET_DIR"
-QMAKE_CXXFLAGS += $$(CXXFLAGS) $$(CPPFLAGS)
-QMAKE_LFLAGS += $$(LDFLAGS)
+QMAKE_CXXFLAGS += $$CXXFLAGS $$CPPFLAGS
+QMAKE_LFLAGS += $$LDFLAGS
cross {
message("Doing a cross platform build..")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/tests/versiontest.cpp new/yubikey-personalization-gui-3.1.23/tests/versiontest.cpp
--- old/yubikey-personalization-gui-3.1.21/tests/versiontest.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/yubikey-personalization-gui-3.1.23/tests/versiontest.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -0,0 +1,38 @@
+/*
+Copyright (C) 2015 Yubico AB. All rights reserved.
+
+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.
+
+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
+HOLDER 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 "versiontest.h"
+#include "common.h"
+
+void TestVersion::testVersions() {
+ QVERIFY(YK_VERSION(2,2,3) < YK_VERSION(2,2,4));
+ QVERIFY(YK_VERSION(0,9,9) < YK_VERSION(1,3,0));
+ QVERIFY(YK_VERSION(3,0,0) < YK_VERSION(4,0,0));
+ QVERIFY(YK_VERSION(2,99,99) < YK_VERSION(3,0,0));
+ QVERIFY(YK_VERSION(4,1,10) < YK_VERSION(4,2,0));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/tests/versiontest.h new/yubikey-personalization-gui-3.1.23/tests/versiontest.h
--- old/yubikey-personalization-gui-3.1.21/tests/versiontest.h 1970-01-01 01:00:00.000000000 +0100
+++ new/yubikey-personalization-gui-3.1.23/tests/versiontest.h 2015-10-01 12:32:44.000000000 +0200
@@ -0,0 +1,36 @@
+/*
+Copyright (C) 2015 Yubico AB. All rights reserved.
+
+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.
+
+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
+HOLDER 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
+
+class TestVersion : public QObject {
+ Q_OBJECT
+
+private slots:
+ void testVersions();
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/tests/yubikeyutiltest.cpp new/yubikey-personalization-gui-3.1.23/tests/yubikeyutiltest.cpp
--- old/yubikey-personalization-gui-3.1.21/tests/yubikeyutiltest.cpp 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/tests/yubikeyutiltest.cpp 2015-10-01 12:32:44.000000000 +0200
@@ -88,6 +88,11 @@
QCOMPARE(result, QString("cccccc"));
}
+void TestYubikeyUtil::testGetNextModhex4() {
+ QString result = YubiKeyUtil::getNextModhex(6, "vvvvv", GEN_SCHEME_INCR);
+ QCOMPARE(result, QString(""));
+}
+
void TestYubikeyUtil::testGenerateRandomHex() {
QString first = YubiKeyUtil::generateRandomHex(16);
QString second = YubiKeyUtil::generateRandomHex(16);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yubikey-personalization-gui-3.1.21/tests/yubikeyutiltest.h new/yubikey-personalization-gui-3.1.23/tests/yubikeyutiltest.h
--- old/yubikey-personalization-gui-3.1.21/tests/yubikeyutiltest.h 2015-05-29 10:14:25.000000000 +0200
+++ new/yubikey-personalization-gui-3.1.23/tests/yubikeyutiltest.h 2015-10-01 12:32:44.000000000 +0200
@@ -42,6 +42,7 @@
void testGetNextModhex1();
void testGetNextModhex2();
void testGetNextModhex3();
+ void testGetNextModhex4();
void testGenerateRandomHex();
void testGenerateRandomModhex();
};