diff options
42 files changed, 847 insertions, 537 deletions
diff --git a/DeviceCommunicationExceptions.cpp b/DeviceCommunicationExceptions.cpp index a470a48..4d62aad 100644 --- a/DeviceCommunicationExceptions.cpp +++ b/DeviceCommunicationExceptions.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include "DeviceCommunicationExceptions.h" std::atomic_int DeviceCommunicationException::occurred {0}; diff --git a/NK_C_API.cc b/NK_C_API.cc index e730bae..f86ce47 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include "NK_C_API.h" #include <iostream> #include "include/NitrokeyManager.h" @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef LIBNITROKEY_NK_C_API_H #define LIBNITROKEY_NK_C_API_H diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index b29b27d..814c4a6 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include <cstring> #include <iostream> #include "include/NitrokeyManager.h" @@ -2,13 +2,13 @@ [![Waffle.io - Columns and their card count](https://badge.waffle.io/Nitrokey/libnitrokey.svg?columns=ready,in%20progress,test,waiting%20for%20feedback)](https://waffle.io/Nitrokey/libnitrokey) # libnitrokey -Libnitrokey is a project to communicate with Nitrokey Pro and Storage devices in a clean and easy manner. Written in C++14, testable with `py.test` and `Catch` frameworks, with C API, Python access (through CFFI and C API, in future with Pybind11). +libnitrokey is a project to communicate with Nitrokey Pro and Storage devices in a clean and easy manner. Written in C++14, testable with `py.test` and `Catch` frameworks, with C API, Python access (through CFFI and C API, in future with Pybind11). The development of this project is aimed to make it itself a living documentation of communication protocol between host and the Nitrokey stick devices. The command packets' format is described here: [Pro v0.7](include/stick10_commands.h), [Pro v0.8](include/stick10_commands_0.8.h), [Storage](include/stick20_commands.h). Handling and additional operations are described here: [NitrokeyManager.cc](NitrokeyManager.cc). A C++14 complying compiler is required due to heavy use of variable templates. For feature support tables please check [table 1](https://gcc.gnu.org/projects/cxx-status.html#cxx14) or [table 2](http://en.cppreference.com/w/cpp/compiler_support). -Libnitrokey is developed and tested with the latest compilers: g++ 6.2, clang 3.8. We use Travis CI to test builds also on g++ 5.4 and under OSX compilers starting up from xcode 8.2 environment. +libnitrokey is developed and tested with the latest compilers: g++ 6.2, clang 3.8. We use Travis CI to test builds also on g++ 5.4 and under OSX compilers starting up from xcode 8.2 environment. ## Getting sources This repository uses `git submodules`. @@ -83,9 +83,9 @@ To use libnitrokey with Python a [CFFI](http://cffi.readthedocs.io/en/latest/ove pip install --user cffi # for python 2.x pip3 install cffi # for python 3.x ``` -Just import it, read the C API header and it is done! You have access to the library. Here is an example printing HOTP code for Pro or Storage device, assuming it is run in root directory [(full example)](python_bindings_example.py): +Just import it, read the C API header and it is done! You have access to the library. Here is an example (in Python 2) printing HOTP code for Pro or Storage device, assuming it is run in root directory [(full example)](python_bindings_example.py): ```python -#!/usr/bin/env python +#!/usr/bin/env python2 import cffi ffi = cffi.FFI() @@ -162,7 +162,7 @@ Please check [NK_C_API.h](NK_C_API.h) (C API) for high level commands and [inclu Warning! Before you run unittests please either change both your Admin and User PINs on your Nitrostick to defaults (`12345678` and `123456` respectively) or change the values in tests source code. If you do not change them the tests might lock your device and lose your data. If it's too late, you can reset your Nitrokey using instructions from [homepage](https://www.nitrokey.com/de/documentation/how-reset-nitrokey). ## Python tests -Libnitrokey has a great suite of tests written in Python 3 under the path: `unittest/test_*.py`: +libnitrokey has a great suite of tests written in Python 3 under the path: `unittest/test_*.py`: * `test_pro.py` - contains tests of OTP, Password Safe and PIN control functionality. Could be run on both Pro and Storage devices. * `test_storage.py` - contains tests of Encrypted Volumes functionality. Could be run only on Storage. The tests themselves show how to handle common requests to device. diff --git a/command_id.cc b/command_id.cc index f76a358..9c6c590 100644 --- a/command_id.cc +++ b/command_id.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include <assert.h> #include "command_id.h" @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include <chrono> #include <thread> #include <cstddef> diff --git a/include/CommandFailedException.h b/include/CommandFailedException.h index 417e850..42fad73 100644 --- a/include/CommandFailedException.h +++ b/include/CommandFailedException.h @@ -1,6 +1,23 @@ -// -// Created by sz on 23.07.16. -// +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ #ifndef LIBNITROKEY_COMMANDFAILEDEXCEPTION_H #define LIBNITROKEY_COMMANDFAILEDEXCEPTION_H diff --git a/include/DeviceCommunicationExceptions.h b/include/DeviceCommunicationExceptions.h index 1c77f5b..f710d0b 100644 --- a/include/DeviceCommunicationExceptions.h +++ b/include/DeviceCommunicationExceptions.h @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + + #ifndef LIBNITROKEY_DEVICECOMMUNICATIONEXCEPTIONS_H #define LIBNITROKEY_DEVICECOMMUNICATIONEXCEPTIONS_H diff --git a/include/LibraryException.h b/include/LibraryException.h index b9303ad..3b9d177 100644 --- a/include/LibraryException.h +++ b/include/LibraryException.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef LIBNITROKEY_LIBRARYEXCEPTION_H #define LIBNITROKEY_LIBRARYEXCEPTION_H diff --git a/include/LongOperationInProgressException.h b/include/LongOperationInProgressException.h index 5b441c0..865d6b5 100644 --- a/include/LongOperationInProgressException.h +++ b/include/LongOperationInProgressException.h @@ -1,6 +1,23 @@ -// -// Created by sz on 24.10.16. -// +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ #ifndef LIBNITROKEY_LONGOPERATIONINPROGRESSEXCEPTION_H #define LIBNITROKEY_LONGOPERATIONINPROGRESSEXCEPTION_H diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h index de14fbc..9a1686c 100644 --- a/include/NitrokeyManager.h +++ b/include/NitrokeyManager.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef LIBNITROKEY_NITROKEYMANAGER_H #define LIBNITROKEY_NITROKEYMANAGER_H diff --git a/include/command.h b/include/command.h index 279754a..6852bf0 100644 --- a/include/command.h +++ b/include/command.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef COMMAND_H #define COMMAND_H #include <string> diff --git a/include/command_id.h b/include/command_id.h index d1246dd..7608201 100644 --- a/include/command_id.h +++ b/include/command_id.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef COMMAND_ID_H #define COMMAND_ID_H #include <stdint.h> diff --git a/include/cxx_semantics.h b/include/cxx_semantics.h index f358e8f..36ed142 100644 --- a/include/cxx_semantics.h +++ b/include/cxx_semantics.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef CXX_SEMANTICS_H #define CXX_SEMANTICS_H diff --git a/include/device.h b/include/device.h index 8bc661a..1bd4773 100644 --- a/include/device.h +++ b/include/device.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef DEVICE_H #define DEVICE_H #include <chrono> diff --git a/include/device_proto.h b/include/device_proto.h index 388c721..7873a0a 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef DEVICE_PROTO_H #define DEVICE_PROTO_H diff --git a/include/dissect.h b/include/dissect.h index 06b99fa..690b5b7 100644 --- a/include/dissect.h +++ b/include/dissect.h @@ -1,4 +1,25 @@ /* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + +/* * Protocol packet dissection */ #ifndef DISSECT_H diff --git a/include/inttypes.h b/include/inttypes.h deleted file mode 100644 index de2cc83..0000000 --- a/include/inttypes.h +++ /dev/null @@ -1,522 +0,0 @@ -/* Copyright (c) 2004,2005,2007 Joerg Wunsch Copyright (c) 2005, Carlos Lamas All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - * 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. - - * Neither the name of the copyright holders nor the names of 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. */ - -/* $Id: inttypes.h 1766 2008-10-17 21:33:57Z arcanum $ */ - -#ifndef __INTTYPES_H_ -#define __INTTYPES_H_ - -#include <stdint.h> - -/** \file */ -/** \defgroup avr_inttypes <inttypes.h>: Integer Type conversions - \code #include <inttypes.h> \endcode - - This header file includes the exact-width integer definitions from - <tt><stdint.h></tt>, and extends them with additional facilities - provided by the implementation. - - Currently, the extensions include two additional integer types - that could hold a "far" pointer (i.e. a code pointer that can - address more than 64 KB), as well as standard names for all printf - and scanf formatting options that are supported by the \ref avr_stdio. - As the library does not support the full range of conversion - specifiers from ISO 9899:1999, only those conversions that are - actually implemented will be listed here. - - The idea behind these conversion macros is that, for each of the - types defined by <stdint.h>, a macro will be supplied that portably - allows formatting an object of that type in printf() or scanf() - operations. Example: - - \code - #include <inttypes.h> - - uint8_t smallval; - int32_t longval; - ... - printf("The hexadecimal value of smallval is %" PRIx8 - ", the decimal value of longval is %" PRId32 ".\n", - smallval, longval); - \endcode -*/ - -/** \name Far pointers for memory access >64K */ - -/* @{ */ -/** \ingroup avr_inttypes - signed integer type that can hold a pointer > 64 KB */ -typedef int32_t int_farptr_t; - -/** \ingroup avr_inttypes - unsigned integer type that can hold a pointer > 64 KB */ -typedef uint32_t uint_farptr_t; - -/* @} */ - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - - -/** \name macros for printf and scanf format specifiers - - For C++, these are only included if __STDC_LIMIT_MACROS - is defined before including <inttypes.h>. - */ - -/* @{ */ -/** \ingroup avr_inttypes - decimal printf format for int8_t */ -#define PRId8 "d" -/** \ingroup avr_inttypes - decimal printf format for int_least8_t */ -#define PRIdLEAST8 "d" -/** \ingroup avr_inttypes - decimal printf format for int_fast8_t */ -#define PRIdFAST8 "d" - -/** \ingroup avr_inttypes - integer printf format for int8_t */ -#define PRIi8 "i" -/** \ingroup avr_inttypes - integer printf format for int_least8_t */ -#define PRIiLEAST8 "i" -/** \ingroup avr_inttypes - integer printf format for int_fast8_t */ -#define PRIiFAST8 "i" - - -/** \ingroup avr_inttypes - decimal printf format for int16_t */ -#define PRId16 "d" -/** \ingroup avr_inttypes - decimal printf format for int_least16_t */ -#define PRIdLEAST16 "d" -/** \ingroup avr_inttypes - decimal printf format for int_fast16_t */ -#define PRIdFAST16 "d" - -/** \ingroup avr_inttypes - integer printf format for int16_t */ -#define PRIi16 "i" -/** \ingroup avr_inttypes - integer printf format for int_least16_t */ -#define PRIiLEAST16 "i" -/** \ingroup avr_inttypes - integer printf format for int_fast16_t */ -#define PRIiFAST16 "i" - - -/** \ingroup avr_inttypes - decimal printf format for int32_t */ -#define PRId32 "ld" -/** \ingroup avr_inttypes - decimal printf format for int_least32_t */ -#define PRIdLEAST32 "ld" -/** \ingroup avr_inttypes - decimal printf format for int_fast32_t */ -#define PRIdFAST32 "ld" - -/** \ingroup avr_inttypes - integer printf format for int32_t */ -#define PRIi32 "li" -/** \ingroup avr_inttypes - integer printf format for int_least32_t */ -#define PRIiLEAST32 "li" -/** \ingroup avr_inttypes - integer printf format for int_fast32_t */ -#define PRIiFAST32 "li" - - -#ifdef __avr_libc_does_not_implement_long_long_in_printf_or_scanf - -#define PRId64 "lld" -#define PRIdLEAST64 "lld" -#define PRIdFAST64 "lld" - -#define PRIi64 "lli" -#define PRIiLEAST64 "lli" -#define PRIiFAST64 "lli" - - -#define PRIdMAX "lld" -#define PRIiMAX "lli" - -#endif - -/** \ingroup avr_inttypes - decimal printf format for intptr_t */ -#define PRIdPTR PRId16 -/** \ingroup avr_inttypes - integer printf format for intptr_t */ -#define PRIiPTR PRIi16 - -/** \ingroup avr_inttypes - octal printf format for uint8_t */ -#define PRIo8 "o" -/** \ingroup avr_inttypes - octal printf format for uint_least8_t */ -#define PRIoLEAST8 "o" -/** \ingroup avr_inttypes - octal printf format for uint_fast8_t */ -#define PRIoFAST8 "o" - -/** \ingroup avr_inttypes - decimal printf format for uint8_t */ -#define PRIu8 "u" -/** \ingroup avr_inttypes - decimal printf format for uint_least8_t */ -#define PRIuLEAST8 "u" -/** \ingroup avr_inttypes - decimal printf format for uint_fast8_t */ -#define PRIuFAST8 "u" - -/** \ingroup avr_inttypes - hexadecimal printf format for uint8_t */ -#define PRIx8 "x" -/** \ingroup avr_inttypes - hexadecimal printf format for uint_least8_t */ -#define PRIxLEAST8 "x" -/** \ingroup avr_inttypes - hexadecimal printf format for uint_fast8_t */ -#define PRIxFAST8 "x" - -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint8_t */ -#define PRIX8 "X" -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint_least8_t */ -#define PRIXLEAST8 "X" -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint_fast8_t */ -#define PRIXFAST8 "X" - - -/** \ingroup avr_inttypes - octal printf format for uint16_t */ -#define PRIo16 "o" -/** \ingroup avr_inttypes - octal printf format for uint_least16_t */ -#define PRIoLEAST16 "o" -/** \ingroup avr_inttypes - octal printf format for uint_fast16_t */ -#define PRIoFAST16 "o" - -/** \ingroup avr_inttypes - decimal printf format for uint16_t */ -#define PRIu16 "u" -/** \ingroup avr_inttypes - decimal printf format for uint_least16_t */ -#define PRIuLEAST16 "u" -/** \ingroup avr_inttypes - decimal printf format for uint_fast16_t */ -#define PRIuFAST16 "u" - -/** \ingroup avr_inttypes - hexadecimal printf format for uint16_t */ -#define PRIx16 "x" -/** \ingroup avr_inttypes - hexadecimal printf format for uint_least16_t */ -#define PRIxLEAST16 "x" -/** \ingroup avr_inttypes - hexadecimal printf format for uint_fast16_t */ -#define PRIxFAST16 "x" - -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint16_t */ -#define PRIX16 "X" -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint_least16_t */ -#define PRIXLEAST16 "X" -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint_fast16_t */ -#define PRIXFAST16 "X" - - -/** \ingroup avr_inttypes - octal printf format for uint32_t */ -#define PRIo32 "lo" -/** \ingroup avr_inttypes - octal printf format for uint_least32_t */ -#define PRIoLEAST32 "lo" -/** \ingroup avr_inttypes - octal printf format for uint_fast32_t */ -#define PRIoFAST32 "lo" - -/** \ingroup avr_inttypes - decimal printf format for uint32_t */ -#define PRIu32 "lu" -/** \ingroup avr_inttypes - decimal printf format for uint_least32_t */ -#define PRIuLEAST32 "lu" -/** \ingroup avr_inttypes - decimal printf format for uint_fast32_t */ -#define PRIuFAST32 "lu" - -/** \ingroup avr_inttypes - hexadecimal printf format for uint32_t */ -#define PRIx32 "lx" -/** \ingroup avr_inttypes - hexadecimal printf format for uint_least32_t */ -#define PRIxLEAST32 "lx" -/** \ingroup avr_inttypes - hexadecimal printf format for uint_fast32_t */ -#define PRIxFAST32 "lx" - -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint32_t */ -#define PRIX32 "lX" -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint_least32_t */ -#define PRIXLEAST32 "lX" -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uint_fast32_t */ -#define PRIXFAST32 "lX" - - -#ifdef __avr_libc_does_not_implement_long_long_in_printf_or_scanf - -#define PRIo64 "llo" -#define PRIoLEAST64 "llo" -#define PRIoFAST64 "llo" - -#define PRIu64 "llu" -#define PRIuLEAST64 "llu" -#define PRIuFAST64 "llu" - -#define PRIx64 "llx" -#define PRIxLEAST64 "llx" -#define PRIxFAST64 "llx" - -#define PRIX64 "llX" -#define PRIXLEAST64 "llX" -#define PRIXFAST64 "llX" - -#define PRIoMAX "llo" -#define PRIuMAX "llu" -#define PRIxMAX "llx" -#define PRIXMAX "llX" - -#endif - -/** \ingroup avr_inttypes - octal printf format for uintptr_t */ -#define PRIoPTR PRIo16 -/** \ingroup avr_inttypes - decimal printf format for uintptr_t */ -#define PRIuPTR PRIu16 -/** \ingroup avr_inttypes - hexadecimal printf format for uintptr_t */ -#define PRIxPTR PRIx16 -/** \ingroup avr_inttypes - uppercase hexadecimal printf format for uintptr_t */ -#define PRIXPTR PRIX16 - - -#ifdef __avr_libc_does_not_implement_hh_in_scanf - -#define SCNd8 "hhd" -#define SCNdLEAST8 "hhd" -#define SCNdFAST8 "hhd" - -#define SCNi8 "hhi" -#define SCNiLEAST8 "hhi" -#define SCNiFAST8 "hhi" - -#endif - - -/** \ingroup avr_inttypes - decimal scanf format for int16_t */ -#define SCNd16 "d" -/** \ingroup avr_inttypes - decimal scanf format for int_least16_t */ -#define SCNdLEAST16 "d" -/** \ingroup avr_inttypes - decimal scanf format for int_fast16_t */ -#define SCNdFAST16 "d" - -/** \ingroup avr_inttypes - generic-integer scanf format for int16_t */ -#define SCNi16 "i" -/** \ingroup avr_inttypes - generic-integer scanf format for int_least16_t */ -#define SCNiLEAST16 "i" -/** \ingroup avr_inttypes - generic-integer scanf format for int_fast16_t */ -#define SCNiFAST16 "i" - - -/** \ingroup avr_inttypes - decimal scanf format for int32_t */ -#define SCNd32 "ld" -/** \ingroup avr_inttypes - decimal scanf format for int_least32_t */ -#define SCNdLEAST32 "ld" -/** \ingroup avr_inttypes - decimal scanf format for int_fast32_t */ -#define SCNdFAST32 "ld" - -/** \ingroup avr_inttypes - generic-integer scanf format for int32_t */ -#define SCNi32 "li" -/** \ingroup avr_inttypes - generic-integer scanf format for int_least32_t */ -#define SCNiLEAST32 "li" -/** \ingroup avr_inttypes - generic-integer scanf format for int_fast32_t */ -#define SCNiFAST32 "li" - - -#ifdef __avr_libc_does_not_implement_long_long_in_printf_or_scanf - -#define SCNd64 "lld" -#define SCNdLEAST64 "lld" -#define SCNdFAST64 "lld" - -#define SCNi64 "lli" -#define SCNiLEAST64 "lli" -#define SCNiFAST64 "lli" - -#define SCNdMAX "lld" -#define SCNiMAX "lli" - -#endif - -/** \ingroup avr_inttypes - decimal scanf format for intptr_t */ -#define SCNdPTR SCNd16 -/** \ingroup avr_inttypes - generic-integer scanf format for intptr_t */ -#define SCNiPTR SCNi16 - -#ifdef __avr_libc_does_not_implement_hh_in_scanf - -#define SCNo8 "hho" -#define SCNoLEAST8 "hho" -#define SCNoFAST8 "hho" - -#define SCNu8 "hhu" -#define SCNuLEAST8 "hhu" -#define SCNuFAST8 "hhu" - -#define SCNx8 "hhx" -#define SCNxLEAST8 "hhx" -#define SCNxFAST8 "hhx" - -#endif - -/** \ingroup avr_inttypes - octal scanf format for uint16_t */ -#define SCNo16 "o" -/** \ingroup avr_inttypes - octal scanf format for uint_least16_t */ -#define SCNoLEAST16 "o" -/** \ingroup avr_inttypes - octal scanf format for uint_fast16_t */ -#define SCNoFAST16 "o" - -/** \ingroup avr_inttypes - decimal scanf format for uint16_t */ -#define SCNu16 "u" -/** \ingroup avr_inttypes - decimal scanf format for uint_least16_t */ -#define SCNuLEAST16 "u" -/** \ingroup avr_inttypes - decimal scanf format for uint_fast16_t */ -#define SCNuFAST16 "u" - -/** \ingroup avr_inttypes - hexadecimal scanf format for uint16_t */ -#define SCNx16 "x" -/** \ingroup avr_inttypes - hexadecimal scanf format for uint_least16_t */ -#define SCNxLEAST16 "x" -/** \ingroup avr_inttypes - hexadecimal scanf format for uint_fast16_t */ -#define SCNxFAST16 "x" - - -/** \ingroup avr_inttypes - octal scanf format for uint32_t */ -#define SCNo32 "lo" -/** \ingroup avr_inttypes - octal scanf format for uint_least32_t */ -#define SCNoLEAST32 "lo" -/** \ingroup avr_inttypes - octal scanf format for uint_fast32_t */ -#define SCNoFAST32 "lo" - -/** \ingroup avr_inttypes - decimal scanf format for uint32_t */ -#define SCNu32 "lu" -/** \ingroup avr_inttypes - decimal scanf format for uint_least32_t */ -#define SCNuLEAST32 "lu" -/** \ingroup avr_inttypes - decimal scanf format for uint_fast32_t */ -#define SCNuFAST32 "lu" - -/** \ingroup avr_inttypes - hexadecimal scanf format for uint32_t */ -#define SCNx32 "lx" -/** \ingroup avr_inttypes - hexadecimal scanf format for uint_least32_t */ -#define SCNxLEAST32 "lx" -/** \ingroup avr_inttypes - hexadecimal scanf format for uint_fast32_t */ -#define SCNxFAST32 "lx" - - -#ifdef __avr_libc_does_not_implement_long_long_in_printf_or_scanf - -#define SCNo64 "llo" -#define SCNoLEAST64 "llo" -#define SCNoFAST64 "llo" - -#define SCNu64 "llu" -#define SCNuLEAST64 "llu" -#define SCNuFAST64 "llu" - -#define SCNx64 "llx" -#define SCNxLEAST64 "llx" -#define SCNxFAST64 "llx" - -#define SCNoMAX "llo" -#define SCNuMAX "llu" -#define SCNxMAX "llx" - -#endif - -/** \ingroup avr_inttypes - octal scanf format for uintptr_t */ -#define SCNoPTR SCNo16 -/** \ingroup avr_inttypes - decimal scanf format for uintptr_t */ -#define SCNuPTR SCNu16 -/** \ingroup avr_inttypes - hexadecimal scanf format for uintptr_t */ -#define SCNxPTR SCNx16 - -/* @} */ - - -#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ - - -#endif /* __INTTYPES_H_ */ diff --git a/include/log.h b/include/log.h index a97ff25..52a6e16 100644 --- a/include/log.h +++ b/include/log.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef LOG_H #define LOG_H diff --git a/include/misc.h b/include/misc.h index 25f3107..88254dd 100644 --- a/include/misc.h +++ b/include/misc.h @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + + #ifndef MISC_H #define MISC_H #include <stdio.h> diff --git a/include/stick10_commands.h b/include/stick10_commands.h index 8f3ceef..c9a5e5b 100644 --- a/include/stick10_commands.h +++ b/include/stick10_commands.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef STICK10_COMMANDS_H #define STICK10_COMMANDS_H diff --git a/include/stick10_commands_0.8.h b/include/stick10_commands_0.8.h index 361682d..a04946f 100644 --- a/include/stick10_commands_0.8.h +++ b/include/stick10_commands_0.8.h @@ -1,6 +1,24 @@ -// -// Created by sz on 08.11.16. -// +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef LIBNITROKEY_STICK10_COMMANDS_0_8_H #define LIBNITROKEY_STICK10_COMMANDS_0_8_H diff --git a/include/stick20_commands.h b/include/stick20_commands.h index eb58af7..34bd547 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef STICK20_COMMANDS_H #define STICK20_COMMANDS_H @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include <iostream> #include <string> #include <ctime> @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include <sstream> #include <string> #include "misc.h" diff --git a/python_bindings_example.py b/python_bindings_example.py index a8f0dbb..9d81dca 100755 --- a/python_bindings_example.py +++ b/python_bindings_example.py @@ -1,4 +1,25 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 +""" +Copyright (c) 2015-2018 Nitrokey UG + +This file is part of libnitrokey. + +libnitrokey is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +libnitrokey is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + +SPDX-License-Identifier: LGPL-3.0 +""" + import cffi from enum import Enum diff --git a/unittest/catch_main.cpp b/unittest/catch_main.cpp index c8270db..0ef4a4b 100644 --- a/unittest/catch_main.cpp +++ b/unittest/catch_main.cpp @@ -1,2 +1,23 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() #include "catch.hpp"
\ No newline at end of file diff --git a/unittest/conftest.py b/unittest/conftest.py index a53b005..8f386e0 100644 --- a/unittest/conftest.py +++ b/unittest/conftest.py @@ -1,3 +1,24 @@ +""" +Copyright (c) 2015-2018 Nitrokey UG + +This file is part of libnitrokey. + +libnitrokey is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +libnitrokey is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + +SPDX-License-Identifier: LGPL-3.0 +""" + import pytest from misc import ffi diff --git a/unittest/constants.py b/unittest/constants.py index f3e876a..3fb444a 100644 --- a/unittest/constants.py +++ b/unittest/constants.py @@ -1,3 +1,24 @@ +""" +Copyright (c) 2015-2018 Nitrokey UG + +This file is part of libnitrokey. + +libnitrokey is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +libnitrokey is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + +SPDX-License-Identifier: LGPL-3.0 +""" + from misc import to_hex def bb(x): diff --git a/unittest/misc.py b/unittest/misc.py index f4d7731..a41f2b2 100644 --- a/unittest/misc.py +++ b/unittest/misc.py @@ -1,3 +1,24 @@ +""" +Copyright (c) 2015-2018 Nitrokey UG + +This file is part of libnitrokey. + +libnitrokey is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +libnitrokey is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + +SPDX-License-Identifier: LGPL-3.0 +""" + import cffi ffi = cffi.FFI() diff --git a/unittest/test.cc b/unittest/test.cc index 15235bd..51a2ef6 100644 --- a/unittest/test.cc +++ b/unittest/test.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include "catch.hpp" #include <iostream> diff --git a/unittest/test2.cc b/unittest/test2.cc index bbe5b07..a943683 100644 --- a/unittest/test2.cc +++ b/unittest/test2.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + static const char *const default_admin_pin = "12345678"; static const char *const default_user_pin = "123456"; diff --git a/unittest/test3.cc b/unittest/test3.cc index b5289f7..84f952c 100644 --- a/unittest/test3.cc +++ b/unittest/test3.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + static const char *const default_admin_pin = "12345678"; static const char *const default_user_pin = "123456"; diff --git a/unittest/test_C_API.cpp b/unittest/test_C_API.cpp index 160145b..d5076c4 100644 --- a/unittest/test_C_API.cpp +++ b/unittest/test_C_API.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + static const int TOO_LONG_STRING = 200; #include "catch.hpp" diff --git a/unittest/test_HOTP.cc b/unittest/test_HOTP.cc index e6f7d7c..a4f42d2 100644 --- a/unittest/test_HOTP.cc +++ b/unittest/test_HOTP.cc @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + + #include "catch.hpp" #include <iostream> #include "device_proto.h" diff --git a/unittest/test_command_ids_header.h b/unittest/test_command_ids_header.h index cd55c8a..a563d90 100644 --- a/unittest/test_command_ids_header.h +++ b/unittest/test_command_ids_header.h @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #ifndef LIBNITROKEY_TEST_COMMAND_IDS_HEADER_H_H #define LIBNITROKEY_TEST_COMMAND_IDS_HEADER_H_H diff --git a/unittest/test_issues.cc b/unittest/test_issues.cc index 63ce678..fe80384 100644 --- a/unittest/test_issues.cc +++ b/unittest/test_issues.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + const char * const default_admin_pin = "12345678"; const char * const default_user_pin = "123456"; diff --git a/unittest/test_library.py b/unittest/test_library.py index 7012619..f6cf366 100644 --- a/unittest/test_library.py +++ b/unittest/test_library.py @@ -1,3 +1,24 @@ +""" +Copyright (c) 2015-2018 Nitrokey UG + +This file is part of libnitrokey. + +libnitrokey is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +libnitrokey is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + +SPDX-License-Identifier: LGPL-3.0 +""" + import pytest from misc import ffi, gs, to_hex, is_pro_rtm_07, is_long_OTP_secret_handled diff --git a/unittest/test_offline.cc b/unittest/test_offline.cc index 58c7555..2d1fcb3 100644 --- a/unittest/test_offline.cc +++ b/unittest/test_offline.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2015-2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-3.0 + */ + #include "catch.hpp" #include <NitrokeyManager.h> #include <memory> diff --git a/unittest/test_pro.py b/unittest/test_pro.py index 830946d..12a34e9 100644 --- a/unittest/test_pro.py +++ b/unittest/test_pro.py @@ -1,3 +1,24 @@ +""" +Copyright (c) 2015-2018 Nitrokey UG + +This file is part of libnitrokey. + +libnitrokey is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +libnitrokey is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + +SPDX-License-Identifier: LGPL-3.0 +""" + import pytest from conftest import skip_if_device_version_lower_than diff --git a/unittest/test_storage.py b/unittest/test_storage.py index 2466779..0f3e04e 100644 --- a/unittest/test_storage.py +++ b/unittest/test_storage.py @@ -1,3 +1,24 @@ +""" +Copyright (c) 2015-2018 Nitrokey UG + +This file is part of libnitrokey. + +libnitrokey is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +libnitrokey is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with libnitrokey. If not, see <http://www.gnu.org/licenses/>. + +SPDX-License-Identifier: LGPL-3.0 +""" + import pprint import pytest |