Skip to content

Commit

Permalink
Merge branch 'release-v0.55'
Browse files Browse the repository at this point in the history
Firmware changes:
- Guard configuration structure access to avoid rare event resulting in data loss
- Mark global variables volatile, where accessed between tasks
- Timeout and reset DMA channels on failure
- Introduce smart card start up delay to favor internal processes
- Increased firmware version to v0.55
- Configuration access refactorization for easier data manipulation

Development:
- Import project to Atmel Studio 7
- Allow to build using Makefile
- Add stub for CMake usage
- Remove obsolete code
- Add initial support for stack guard protection

Connected: #98

Tested on:
- macOS 10.15.2
- Linux Fedora 32
- Windows 10 20H2
with:
- libnitrokey 3.6 (Python test suites; skipped on Windows)
- Nitrokey App v1.4 (manual test)
For tests firmware was built using GCC 4.3.3 (AVR_Toolchain_3.0_124), -O0.
Firmware upgrade and downgrade tested on the previous latest firmware.

Test suite was modified to account TOTP#15 slot being disabled.
  • Loading branch information
szszszsz committed Dec 30, 2020
2 parents f66b2e6 + 2ad0f96 commit f376b08
Show file tree
Hide file tree
Showing 26 changed files with 3,205 additions and 1,537 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.bin
build*
cmake-build-debug
*.elf
*.hex
*.hex*
.idea
.idea/
*.list
*.log
*.o
*.sha256sum
*.sig
*.swp
*.tar.gz
tmp
*.txt
21 changes: 0 additions & 21 deletions Debug/Makefile

This file was deleted.

22 changes: 22 additions & 0 deletions STICK20_GIT-7.atsln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "STICK20_GIT", "STICK20_GIT.cproj", "{B19EB321-4623-42D6-8259-B5D025DAFC16}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B19EB321-4623-42D6-8259-B5D025DAFC16}.Debug|AVR.ActiveCfg = Debug|AVR
{B19EB321-4623-42D6-8259-B5D025DAFC16}.Debug|AVR.Build.0 = Debug|AVR
{B19EB321-4623-42D6-8259-B5D025DAFC16}.Release|AVR.ActiveCfg = Release|AVR
{B19EB321-4623-42D6-8259-B5D025DAFC16}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions STICK20_GIT.componentinfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement">
<ProjectComponents />
</Store>
2,655 changes: 1,336 additions & 1,319 deletions STICK20_GIT.cproj

Large diffs are not rendered by default.

1,320 changes: 1,320 additions & 0 deletions STICK20_GIT_6_1.cproj

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/CCID/USART/ISO7816_ADPU.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ u8 Text[20];

LockActive_u32 = FALSE;

// TODO set timeout instead of infinite loop
// TODO reorganize this loop to make clear what is the CRITICAL part

// Check lock
portENTER_CRITICAL ();
while (0 != USB_CCID_GetLockCounter ())
Expand Down
12 changes: 8 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
cmake_minimum_required(VERSION 3.9)
project(nitrokey_storage)

set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD 99)

MESSAGE(WARNING "This is only a stub. Not possible to build a firmware with it at the moment.")

# Copied from the AVR32 build log for the further processing
set(NKDEFINES "-DBOARD=EVK1104 -DFREERTOS_USED")
set(NKFLAGS "-O0 -fdata-sections -g3 -Wall -c -fmessage-length=0 -mpart=uc3a3256s -ffunction-sections -masm-addr-pseudos")
set(NKDEFINES -DBOARD=EVK1104 -DFREERTOS_USED)
set(NKFLAGS -O0 -fdata-sections -g3 -Wall -c -fmessage-length=0 -mpart=uc3a3256s -ffunction-sections -masm-addr-pseudos)
set(NKCOMPILER avr32-gcc)
set(NKLINKFLAGS "-nostartfiles -L../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS -L../src/SOFTWARE_FRAMEWORK/BOARDS -Wl,--gc-sections -Wl,-e,_trampoline -T../src/SOFTWARE_FRAMEWORK/UTILS/LINKER_SCRIPTS/AT32UC3A3/256/GCC/link_uc3a3256.lds -mpart=uc3a3256s -Wl,--gc-sections --rodata-writable -Wl,--direct-data -oUSB_MASS.elf -lnewlib_addons-at32ucr2-speed_opt")
set(NKLINKFLAGS -nostartfiles -L../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS -L../src/SOFTWARE_FRAMEWORK/BOARDS -Wl,--gc-sections -Wl,-e,_trampoline -T../src/SOFTWARE_FRAMEWORK/UTILS/LINKER_SCRIPTS/AT32UC3A3/256/GCC/link_uc3a3256.lds -mpart=uc3a3256s -Wl,--gc-sections --rodata-writable -Wl,--direct-data -oUSB_MASS.elf -lnewlib_addons-at32ucr2-speed_opt)

add_definitions(${NKDEFINES})
SET(CMAKE_C_COMPILER /home/sz/work/software/as4e-ide/plugins/com.atmel.avr.toolchains.linux.x86_64_3.0.0.201009140852/os/linux/x86_64/bin/avr32-gcc)

include_directories(.)

include_directories(/home/sz/work/software/as4e-ide/plugins/com.atmel.avr.toolchains.linux.x86_64_3.0.0.201009140852/os/linux/x86_64/avr32/include/)

include_directories(./CCID/LOCAL_ACCESS/)
include_directories(./CCID/UNIT_TEST/)
include_directories(./CCID/USART/)
Expand Down
Loading

0 comments on commit f376b08

Please sign in to comment.