]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Merge pull request #546 from pwpiwi/fix_tune
authorIceman <iceman@iuse.se>
Wed, 17 Jan 2018 15:11:56 +0000 (16:11 +0100)
committerGitHub <noreply@github.com>
Wed, 17 Jan 2018 15:11:56 +0000 (16:11 +0100)
hw tune improvements (based on issue #544)

CI/.travis.yml [new file with mode: 0644]
CI/appveyor.yml [new file with mode: 0644]
CI/readme.md [new file with mode: 0644]
CI/travis_test_commands.scr [new file with mode: 0644]
appveyor.yml [deleted file]
armsrc/iso14443a.c
armsrc/mifarecmd.c
armsrc/mifareutil.h
client/cmdhfmf.c
client/hardnested/hardnested_bf_core.c

diff --git a/CI/.travis.yml b/CI/.travis.yml
new file mode 100644 (file)
index 0000000..8e9289b
--- /dev/null
@@ -0,0 +1,55 @@
+# Travis-CI config
+# variable REPOSITORY_EP must be filled with repository name. as sample: "merlokk/proxmark3"
+language: c
+
+compiler: gcc
+
+# Test on Linux and MacOS
+matrix:
+  include:
+    - os: osx
+      osx_image: xcode7.3      # OS X 10.11
+    - os: osx
+      osx_image: xcode8.3   # OS X 10.12
+    - os: osx
+      osx_image: xcode9     # OS X 10.12
+    - os: osx
+      osx_image: xcode9.2   # OS X 10.12
+    - os: linux
+      dist: trusty
+      sudo: required
+
+before_install:
+## Install ARM toolchain on Linux.
+## add our homebrew tap for MacOS
+## Note: all dependencies on MacOS should be resolved by the brew install command
+  echo $REPOSITORY_EP;
+  if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then 
+    sudo apt-get update -qq;
+    sudo apt-get install -y gcc-arm-none-eabi;
+  elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+    brew update;
+    if [[ "$REPOSITORY_EP" == "" ]]; then
+      brew tap proxmark/proxmark3;
+    else
+      brew tap "$REPOSITORY_EP" --env=std;
+    fi
+  fi
+
+install:
+  if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then 
+    brew info proxmark3;
+    brew install -v --HEAD proxmark3;
+  elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then 
+    make all;
+  fi
+
+before_script:
+
+script: 
+## for the time being we are satisfied if it can be build and then successfully started
+  if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then 
+    proxmark3 /dev/notexists travis_test_commands.scr ;
+  elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then 
+    ./client/proxmark3  /dev/notexists travis_test_commands.scr ;
+  fi
diff --git a/CI/appveyor.yml b/CI/appveyor.yml
new file mode 100644 (file)
index 0000000..f5ae2c7
--- /dev/null
@@ -0,0 +1,297 @@
+version: 3.0.1.{build}
+image: Visual Studio 2017
+clone_folder: C:\ProxSpace\pm3
+init:
+- ps: >-
+    $psversiontable
+
+    #Get-ChildItem Env:
+
+
+    $releasename=""
+
+    $env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)
+
+    if ($env:appveyor_repo_tag -match "true"){
+      $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
+    }
+
+    $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT_SHORT + "]"
+
+
+    Write-Host "repository: $env:appveyor_repo_name branch:$env:APPVEYOR_REPO_BRANCH release: $releasename" -ForegroundColor Yellow
+
+    Add-AppveyorMessage -Message "[$env:APPVEYOR_REPO_COMMIT_SHORT]$env:appveyor_repo_name($env:APPVEYOR_REPO_BRANCH)" -Category Information -Details "repository: $env:appveyor_repo_name branch: $env:APPVEYOR_REPO_BRANCH release: $releasename"
+
+
+    iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
+clone_script:
+- ps: >-
+    Write-Host "Removing ProxSpace..." -NoNewLine
+
+    cd \
+
+    Remove-Item -Recurse -Force -Path c:\ProxSpace\*
+
+    Write-Host "[ OK ]" -ForegroundColor Green
+
+
+    Write-Host "Git clone ProxSpace..." -NoNewLine
+
+    git clone -q https://github.com/Gator96100/ProxSpace c:\ProxSpace
+
+    Write-Host "[ OK ]" -ForegroundColor Green
+
+
+    Write-Host "Removing pm3 dir..." -NoNewLine
+
+    Remove-Item -Recurse -Force -Path c:\ProxSpace\pm3\*
+
+    Write-Host "[ OK ]" -ForegroundColor Green
+
+
+    Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine
+
+    if(-not $env:appveyor_pull_request_number) {
+        git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder
+        cd $env:appveyor_build_folder
+        git checkout -qf $env:appveyor_repo_commit
+    } else {
+        git clone -q https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder
+        cd $env:appveyor_build_folder
+        git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge:
+        git checkout -qf FETCH_HEAD
+    }
+
+    Write-Host "[ OK ]" -ForegroundColor Green
+
+
+    Write-Host "Fill msys\etc\fstab file..." -NoNewLine
+
+    New-Item c:\ProxSpace\msys\etc\fstab -type file -force -value "#Win32_Path Mount_Point`nc:\ProxSpace\devkitARM /devkitARM`nc:\ProxSpace\Qt\5.6 /qt `nc:\ProxSpace\pm3 /pm3`n"
+
+    Write-Host "[ OK ]" -ForegroundColor Green
+install:
+- ps: >-
+    function Exec-External {
+              param(
+                [Parameter(Position=0,Mandatory=1)][scriptblock] $command
+              )
+              & $command
+              if ($LASTEXITCODE -ne 0) {
+                throw ("Command returned non-zero error-code ${LASTEXITCODE}: $command")
+              }
+            }
+build_script:
+- ps: >-
+    $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
+
+
+    #make
+
+    bash -lc -i "pwd;make all"
+
+
+    #some checks
+
+    if(!(Test-Path C:\ProxSpace\pm3\client\proxmark3.exe)){
+
+    throw "Main file proxmark3.exe not exists."
+
+    }
+
+    if(!(Test-Path C:\ProxSpace\pm3\armsrc\obj\fullimage.elf)){
+
+    throw "ARM file fullimage.elf not exists."
+
+    }
+
+    if(!(Test-Path C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z)){
+
+    throw "Files in hardnested\tables not exists."
+
+    }
+
+
+    #copy
+
+    Write-Host "Copy release files..." -NoNewLine -ForegroundColor Yellow
+
+    New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release
+
+    Copy-Item C:\ProxSpace\pm3\client\*.exe C:\ProxSpace\Release
+
+    New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\arm
+
+    Copy-Item C:\ProxSpace\pm3\armsrc\obj\*.elf C:\ProxSpace\Release\arm
+
+    Copy-Item C:\ProxSpace\pm3\bootrom\obj\*.elf C:\ProxSpace\Release\arm
+
+    New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\scripts
+
+    Copy-Item C:\ProxSpace\pm3\client\scripts\*.lua C:\ProxSpace\Release\scripts
+
+    New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\hardnested\tables
+
+    Copy-Item C:\ProxSpace\pm3\client\hardnested\*.bin C:\ProxSpace\Release\hardnested
+
+    Copy-Item C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z C:\ProxSpace\Release\hardnested\tables
+
+    Write-Host "[ OK ]" -ForegroundColor Green
+
+
+    #archive and push
+
+    $releasename=""
+
+    if ($env:appveyor_repo_tag -match "true"){
+
+    $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
+
+    }
+
+    $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) + "]"
+
+
+    Write-Host "Archive and publish release files ($releasename)..." -NoNewLine -ForegroundColor Yellow
+
+    cd C:\ProxSpace
+
+    7z a release.zip C:\ProxSpace\Release
+
+    Push-AppveyorArtifact release.zip -DeploymentName "$releasename"
+
+    Write-Host "[ OK ]" -ForegroundColor Green
+
+
+    Write-Host "Builded..." -ForegroundColor Yellow
+test_script:
+- ps: >-
+    $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
+
+    cd c:\ProxSpace\pm3
+
+
+    $global:TestsPassed=$true
+
+
+    Function ExecTest($Name, $File, $Cmd, $CheckResult) {
+
+    #--- begin Job
+
+    $Job = Start-Job -ScriptBlock {
+      [bool]$res=$false
+      $TestTime=[System.Environment]::TickCount
+      $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
+      Set-Location $using:PWD
+
+      $sb=[scriptblock]::Create("$using:Cmd")
+      #execute scriptblock
+      Write-host "Test [$using:Name] job: $using:Cmd"
+      $Cond=&$sb
+
+      if ($Cond -eq $null){
+      } ElseIf($using:CheckResult -ne $null) {
+        [String]$searchstr=""
+        if ($Cond -is [Object]){
+          ForEach($line in $Cond){
+            Write-host $line -ForegroundColor Gray
+            $searchstr += $line
+          }
+        }else{
+          Write-host "$Cond" -ForegroundColor Gray
+          $searchstr = $Cond
+        }
+        If($searchstr -like "*$using:CheckResult*") {
+          $res=$true
+        }
+        $Cond="*$using:CheckResult*"
+      } Else {
+        If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){
+            if ($Cond -is "String" -and $Cond -like "*passed*"){
+              $res= $true
+            }
+            if ($Cond -is "String" -and $Cond -like "*true*"){
+              $res= $true
+            }
+        } Else {
+          $res=$Cond
+        }
+      }
+
+      If ($res) {
+        Write-host "Result[$using:Name]: $Cond" -ForegroundColor Green
+        Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
+      }Else {
+        Write-host "Result[$using:Name]: $Cond" -ForegroundColor Red
+        Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" -ErrorMessage "command:$using:Cmd`nresult:$Cond"
+      }
+        return $res
+    }
+
+    #--- end Job
+
+      [bool]$res=$false
+      # Wait 120 sec timeout for Job
+      if(Wait-Job $Job -Timeout 120){
+        $Results = $Job | Receive-Job
+        if($Results -like "true"){
+          $res=$true
+        }
+      } else {
+        Write-host "Test [$Name] timeout" -ForegroundColor Red
+        Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Failed -Duration 40000 -ErrorMessage "timeout"
+      }
+      Remove-Job -Force $Job
+
+      if(!$res){
+        $global:TestsPassed=$false
+      }
+    }
+
+
+    Write-Host "Running tests..." -ForegroundColor Yellow
+
+
+    #file test
+
+    ExecTest "proxmark3 exists" "proxmark3.exe" {Test-Path C:\ProxSpace\Release\proxmark3.exe}
+
+    ExecTest "arm image exists" "\arm\fullimage1.elf" {Test-Path C:\ProxSpace\Release\arm\fullimage.elf}
+
+    ExecTest "bootrom exists" "bootrom.elf" {Test-Path C:\ProxSpace\Release\arm\bootrom.elf}
+
+    ExecTest "hardnested tables exists" "hardnested" {Test-Path C:\ProxSpace\Release\hardnested\tables\*.z}
+
+    ExecTest "release exists" "release.zip" {Test-Path C:\ProxSpace\release.zip}
+
+
+    #proxmark logic tests
+
+    ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;proxmark3 -h | grep -q Execute && echo Passed || echo Failed'}
+
+    ExecTest "proxmark help hardnested" "proxmark3 -h" {bash -lc 'cd ~/client;proxmark3 -h | grep -q hardnested && echo Passed || echo Failed'}
+
+
+    ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf'"} "at_enc"
+
+    ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf hardnested t 1 000000000000'"} "found:"
+
+
+    #proxmark crypto tests
+
+    ExecTest "hf emv test" "hf emv test" {bash -lc "cd ~/client;proxmark3 comx -c 'hf emv test'"} "Tests ?OK"
+
+
+    if ($global:TestsPassed) {
+      Write-Host "Tests [ OK ]" -ForegroundColor Green
+    } else {
+      Write-Host "Tests [ ERROR ]" -ForegroundColor Red
+      throw "Tests error."
+    }
+on_success:
+- ps: Write-Host "Build success..." -ForegroundColor Green
+on_failure:
+- ps: Write-Host "Build error." -ForegroundColor Red
+on_finish:
+- ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
diff --git a/CI/readme.md b/CI/readme.md
new file mode 100644 (file)
index 0000000..d415929
--- /dev/null
@@ -0,0 +1,20 @@
+# How to configure continuous integration
+
+Here 2 CI configuration files:
+
+1. for [travis](travis-ci.org)
+2. for [appveyor](appveyor.com)
+
+It needs to put files from this directory to repository root and then configure CI from appropriate WEB portal.
+
+## travis
+
+- Copy .travis.yml and travis_test_commands.scr files to repository root 
+- Configure CI from http://travis-ci.org
+- It needs to fork https://github.com/Proxmark/homebrew-proxmark3 from your proxmark repository home
+- Put to file `proxmark3.rb` in line `head "https://github.com/proxmark/proxmark3.git"` your repository link. As sample: `head "https://github.com/merlokk/proxmark3.git"`
+
+
+## appveyor
+
+- Just copy appveyor.yml file to root and configure it from http://appveyor.com
diff --git a/CI/travis_test_commands.scr b/CI/travis_test_commands.scr
new file mode 100644 (file)
index 0000000..4f5b025
--- /dev/null
@@ -0,0 +1,3 @@
+hf mf hardnested t 1 000000000000
+hf emv test
+exit
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644 (file)
index f5ae2c7..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-version: 3.0.1.{build}
-image: Visual Studio 2017
-clone_folder: C:\ProxSpace\pm3
-init:
-- ps: >-
-    $psversiontable
-
-    #Get-ChildItem Env:
-
-
-    $releasename=""
-
-    $env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)
-
-    if ($env:appveyor_repo_tag -match "true"){
-      $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
-    }
-
-    $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT_SHORT + "]"
-
-
-    Write-Host "repository: $env:appveyor_repo_name branch:$env:APPVEYOR_REPO_BRANCH release: $releasename" -ForegroundColor Yellow
-
-    Add-AppveyorMessage -Message "[$env:APPVEYOR_REPO_COMMIT_SHORT]$env:appveyor_repo_name($env:APPVEYOR_REPO_BRANCH)" -Category Information -Details "repository: $env:appveyor_repo_name branch: $env:APPVEYOR_REPO_BRANCH release: $releasename"
-
-
-    iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
-clone_script:
-- ps: >-
-    Write-Host "Removing ProxSpace..." -NoNewLine
-
-    cd \
-
-    Remove-Item -Recurse -Force -Path c:\ProxSpace\*
-
-    Write-Host "[ OK ]" -ForegroundColor Green
-
-
-    Write-Host "Git clone ProxSpace..." -NoNewLine
-
-    git clone -q https://github.com/Gator96100/ProxSpace c:\ProxSpace
-
-    Write-Host "[ OK ]" -ForegroundColor Green
-
-
-    Write-Host "Removing pm3 dir..." -NoNewLine
-
-    Remove-Item -Recurse -Force -Path c:\ProxSpace\pm3\*
-
-    Write-Host "[ OK ]" -ForegroundColor Green
-
-
-    Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine
-
-    if(-not $env:appveyor_pull_request_number) {
-        git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder
-        cd $env:appveyor_build_folder
-        git checkout -qf $env:appveyor_repo_commit
-    } else {
-        git clone -q https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder
-        cd $env:appveyor_build_folder
-        git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge:
-        git checkout -qf FETCH_HEAD
-    }
-
-    Write-Host "[ OK ]" -ForegroundColor Green
-
-
-    Write-Host "Fill msys\etc\fstab file..." -NoNewLine
-
-    New-Item c:\ProxSpace\msys\etc\fstab -type file -force -value "#Win32_Path Mount_Point`nc:\ProxSpace\devkitARM /devkitARM`nc:\ProxSpace\Qt\5.6 /qt `nc:\ProxSpace\pm3 /pm3`n"
-
-    Write-Host "[ OK ]" -ForegroundColor Green
-install:
-- ps: >-
-    function Exec-External {
-              param(
-                [Parameter(Position=0,Mandatory=1)][scriptblock] $command
-              )
-              & $command
-              if ($LASTEXITCODE -ne 0) {
-                throw ("Command returned non-zero error-code ${LASTEXITCODE}: $command")
-              }
-            }
-build_script:
-- ps: >-
-    $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
-
-
-    #make
-
-    bash -lc -i "pwd;make all"
-
-
-    #some checks
-
-    if(!(Test-Path C:\ProxSpace\pm3\client\proxmark3.exe)){
-
-    throw "Main file proxmark3.exe not exists."
-
-    }
-
-    if(!(Test-Path C:\ProxSpace\pm3\armsrc\obj\fullimage.elf)){
-
-    throw "ARM file fullimage.elf not exists."
-
-    }
-
-    if(!(Test-Path C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z)){
-
-    throw "Files in hardnested\tables not exists."
-
-    }
-
-
-    #copy
-
-    Write-Host "Copy release files..." -NoNewLine -ForegroundColor Yellow
-
-    New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release
-
-    Copy-Item C:\ProxSpace\pm3\client\*.exe C:\ProxSpace\Release
-
-    New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\arm
-
-    Copy-Item C:\ProxSpace\pm3\armsrc\obj\*.elf C:\ProxSpace\Release\arm
-
-    Copy-Item C:\ProxSpace\pm3\bootrom\obj\*.elf C:\ProxSpace\Release\arm
-
-    New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\scripts
-
-    Copy-Item C:\ProxSpace\pm3\client\scripts\*.lua C:\ProxSpace\Release\scripts
-
-    New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\hardnested\tables
-
-    Copy-Item C:\ProxSpace\pm3\client\hardnested\*.bin C:\ProxSpace\Release\hardnested
-
-    Copy-Item C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z C:\ProxSpace\Release\hardnested\tables
-
-    Write-Host "[ OK ]" -ForegroundColor Green
-
-
-    #archive and push
-
-    $releasename=""
-
-    if ($env:appveyor_repo_tag -match "true"){
-
-    $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
-
-    }
-
-    $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) + "]"
-
-
-    Write-Host "Archive and publish release files ($releasename)..." -NoNewLine -ForegroundColor Yellow
-
-    cd C:\ProxSpace
-
-    7z a release.zip C:\ProxSpace\Release
-
-    Push-AppveyorArtifact release.zip -DeploymentName "$releasename"
-
-    Write-Host "[ OK ]" -ForegroundColor Green
-
-
-    Write-Host "Builded..." -ForegroundColor Yellow
-test_script:
-- ps: >-
-    $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
-
-    cd c:\ProxSpace\pm3
-
-
-    $global:TestsPassed=$true
-
-
-    Function ExecTest($Name, $File, $Cmd, $CheckResult) {
-
-    #--- begin Job
-
-    $Job = Start-Job -ScriptBlock {
-      [bool]$res=$false
-      $TestTime=[System.Environment]::TickCount
-      $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
-      Set-Location $using:PWD
-
-      $sb=[scriptblock]::Create("$using:Cmd")
-      #execute scriptblock
-      Write-host "Test [$using:Name] job: $using:Cmd"
-      $Cond=&$sb
-
-      if ($Cond -eq $null){
-      } ElseIf($using:CheckResult -ne $null) {
-        [String]$searchstr=""
-        if ($Cond -is [Object]){
-          ForEach($line in $Cond){
-            Write-host $line -ForegroundColor Gray
-            $searchstr += $line
-          }
-        }else{
-          Write-host "$Cond" -ForegroundColor Gray
-          $searchstr = $Cond
-        }
-        If($searchstr -like "*$using:CheckResult*") {
-          $res=$true
-        }
-        $Cond="*$using:CheckResult*"
-      } Else {
-        If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){
-            if ($Cond -is "String" -and $Cond -like "*passed*"){
-              $res= $true
-            }
-            if ($Cond -is "String" -and $Cond -like "*true*"){
-              $res= $true
-            }
-        } Else {
-          $res=$Cond
-        }
-      }
-
-      If ($res) {
-        Write-host "Result[$using:Name]: $Cond" -ForegroundColor Green
-        Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
-      }Else {
-        Write-host "Result[$using:Name]: $Cond" -ForegroundColor Red
-        Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" -ErrorMessage "command:$using:Cmd`nresult:$Cond"
-      }
-        return $res
-    }
-
-    #--- end Job
-
-      [bool]$res=$false
-      # Wait 120 sec timeout for Job
-      if(Wait-Job $Job -Timeout 120){
-        $Results = $Job | Receive-Job
-        if($Results -like "true"){
-          $res=$true
-        }
-      } else {
-        Write-host "Test [$Name] timeout" -ForegroundColor Red
-        Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Failed -Duration 40000 -ErrorMessage "timeout"
-      }
-      Remove-Job -Force $Job
-
-      if(!$res){
-        $global:TestsPassed=$false
-      }
-    }
-
-
-    Write-Host "Running tests..." -ForegroundColor Yellow
-
-
-    #file test
-
-    ExecTest "proxmark3 exists" "proxmark3.exe" {Test-Path C:\ProxSpace\Release\proxmark3.exe}
-
-    ExecTest "arm image exists" "\arm\fullimage1.elf" {Test-Path C:\ProxSpace\Release\arm\fullimage.elf}
-
-    ExecTest "bootrom exists" "bootrom.elf" {Test-Path C:\ProxSpace\Release\arm\bootrom.elf}
-
-    ExecTest "hardnested tables exists" "hardnested" {Test-Path C:\ProxSpace\Release\hardnested\tables\*.z}
-
-    ExecTest "release exists" "release.zip" {Test-Path C:\ProxSpace\release.zip}
-
-
-    #proxmark logic tests
-
-    ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;proxmark3 -h | grep -q Execute && echo Passed || echo Failed'}
-
-    ExecTest "proxmark help hardnested" "proxmark3 -h" {bash -lc 'cd ~/client;proxmark3 -h | grep -q hardnested && echo Passed || echo Failed'}
-
-
-    ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf'"} "at_enc"
-
-    ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf hardnested t 1 000000000000'"} "found:"
-
-
-    #proxmark crypto tests
-
-    ExecTest "hf emv test" "hf emv test" {bash -lc "cd ~/client;proxmark3 comx -c 'hf emv test'"} "Tests ?OK"
-
-
-    if ($global:TestsPassed) {
-      Write-Host "Tests [ OK ]" -ForegroundColor Green
-    } else {
-      Write-Host "Tests [ ERROR ]" -ForegroundColor Red
-      throw "Tests error."
-    }
-on_success:
-- ps: Write-Host "Build success..." -ForegroundColor Green
-on_failure:
-- ps: Write-Host "Build error." -ForegroundColor Red
-on_finish:
-- ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
index 94ca52f542e242de6816f04e4970dd7fdda5e986..7d589f0e64f6354227db678b703d379ba71b4909 100644 (file)
@@ -2482,7 +2482,7 @@ void RAMFUNC SniffMifare(uint8_t param) {
        for(uint32_t sniffCounter = 0; true; ) {
        
                if(BUTTON_PRESS()) {
-                       DbpString("cancelled by button");
+                       DbpString("Canceled by button.");
                        break;
                }
 
@@ -2576,7 +2576,7 @@ void RAMFUNC SniffMifare(uint8_t param) {
 
        } // main cycle
 
-       DbpString("COMMAND FINISHED");
+       DbpString("COMMAND FINISHED.");
 
        FpgaDisableSscDma();
        MfSniffEnd();
index fcfd7e8fddb80f9c1bac092def66cd5fbb1d23c0..3854b5899611e1f573352467dfeac34c6e278cd1 100644 (file)
@@ -20,6 +20,9 @@
 #include "parity.h"\r
 #include "crc.h"\r
 \r
+#define HARDNESTED_AUTHENTICATION_TIMEOUT 848                  // card times out 1ms after wrong authentication (according to NXP documentation)\r
+#define HARDNESTED_PRE_AUTHENTICATION_LEADTIME 400             // some (non standard) cards need a pause after select before they are ready for first authentication \r
+\r
 // the block number for the ISO14443-4 PCB\r
 static uint8_t pcb_blocknum = 0;\r
 // Deselect card by sending a s-block. the crc is precalced for speed\r
@@ -677,7 +680,7 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags,
                }\r
 \r
                if (slow) {\r
-                       timeout = GetCountSspClk() + PRE_AUTHENTICATION_LEADTIME;\r
+                       timeout = GetCountSspClk() + HARDNESTED_PRE_AUTHENTICATION_LEADTIME;\r
                        while(GetCountSspClk() < timeout);\r
                }\r
 \r
@@ -694,10 +697,12 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags,
                        continue;\r
                }\r
 \r
-               // send a dummy response in order to trigger the cards authentication failure timeout\r
-               uint8_t dummy_answer[8] = {0};\r
-               ReaderTransmit(dummy_answer, 8, NULL);\r
+               // send an incomplete dummy response in order to trigger the card's authentication failure timeout\r
+               uint8_t dummy_answer[1] = {0};\r
+               ReaderTransmit(dummy_answer, 1, NULL);\r
 \r
+               timeout = GetCountSspClk() + HARDNESTED_AUTHENTICATION_TIMEOUT;\r
+               \r
                num_nonces++;\r
                if (num_nonces % 2) {\r
                        memcpy(buf+i, receivedAnswer, 4);\r
@@ -709,6 +714,9 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags,
                        i += 9;\r
                }\r
 \r
+               // wait for the card to become ready again\r
+               while(GetCountSspClk() < timeout);\r
+\r
        }\r
 \r
        LED_C_OFF();\r
index c34dc8f4d8983dfb89fb0e4ddd96fe43ce69491c..b2912895888fc47f948d9f5d68155cc946034564 100644 (file)
@@ -24,8 +24,6 @@
 #define CRYPT_REQUEST 2\r
 #define AUTH_FIRST    0        \r
 #define AUTH_NESTED   2\r
-#define AUTHENTICATION_TIMEOUT 848                     // card times out 1ms after wrong authentication (according to NXP documentation)\r
-#define PRE_AUTHENTICATION_LEADTIME 400                // some (non standard) cards need a pause after select before they are ready for first authentication\r
 \r
 // mifare 4bit card answers\r
 #define CARD_ACK      0x0A  // 1010 - ACK\r
index 4956df8c66e898f03fee4647db9722553a669f90..b653cf300a1a7199b0d7e869cda93a187188c895 100644 (file)
@@ -2527,14 +2527,13 @@ int CmdHF14AMfSniff(const char *Cmd){
                }\r
 \r
                UsbCommand resp;\r
-               if (WaitForResponseTimeout(CMD_ACK,&resp,2000)) {\r
+               if (WaitForResponseTimeoutW(CMD_ACK, &resp, 2000, false)) {\r
                        res = resp.arg[0] & 0xff;\r
                        uint16_t traceLen = resp.arg[1];\r
                        len = resp.arg[2];\r
 \r
                        if (res == 0) {                                                         // we are done\r
-                               free(buf);\r
-                               return 0;\r
+                               break;\r
                        }\r
 \r
                        if (res == 1) {                                                         // there is (more) data to be transferred\r
@@ -2610,6 +2609,9 @@ int CmdHF14AMfSniff(const char *Cmd){
        } // while (true)\r
 \r
        free(buf);\r
+       \r
+       msleep(300); // wait for exiting arm side.\r
+       PrintAndLog("Done.");\r
        return 0;\r
 }\r
 \r
index 78384bbc8773e238bdb47be9bca22539d05b3501..d02209e9da7d0888912374af13b7c0bd025d5a40 100644 (file)
@@ -590,9 +590,13 @@ SIMDExecInstr GetSIMDInstrAuto() {
 // determine the available instruction set at runtime and call the correct function
 const uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
        switch(GetSIMDInstrAuto()) {
+#if defined (__i386__) || defined (__x86_64__)
+#if !defined(__APPLE__) || (defined(__APPLE__) && (__clang_major__ > 8 || __clang_major__ == 8 && __clang_minor__ >= 1))
+#if (__GNUC__ >= 5) && (__GNUC__ > 5 || __GNUC_MINOR__ > 2) 
                case SIMD_AVX512:
                        crack_states_bitsliced_function_p = &crack_states_bitsliced_AVX512;
                        break;
+#endif
                case SIMD_AVX2:
                        crack_states_bitsliced_function_p = &crack_states_bitsliced_AVX2;
                        break;
@@ -605,6 +609,8 @@ const uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_firs
                case SIMD_MMX:
                        crack_states_bitsliced_function_p = &crack_states_bitsliced_MMX;
                        break;
+#endif
+#endif
                default:
                        crack_states_bitsliced_function_p = &crack_states_bitsliced_NOSIMD;
                        break;
@@ -616,9 +622,13 @@ const uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_firs
 
 void bitslice_test_nonces_dispatch(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonce, uint8_t *bf_test_nonce_par) {
        switch(GetSIMDInstrAuto()) {
+#if defined (__i386__) || defined (__x86_64__)
+#if !defined(__APPLE__) || (defined(__APPLE__) && (__clang_major__ > 8 || __clang_major__ == 8 && __clang_minor__ >= 1))
+#if (__GNUC__ >= 5) && (__GNUC__ > 5 || __GNUC_MINOR__ > 2) 
                case SIMD_AVX512:
                        bitslice_test_nonces_function_p = &bitslice_test_nonces_AVX512;
                        break;
+#endif
                case SIMD_AVX2:
                        bitslice_test_nonces_function_p = &bitslice_test_nonces_AVX2;
                        break;
@@ -631,6 +641,8 @@ void bitslice_test_nonces_dispatch(uint32_t nonces_to_bruteforce, uint32_t *bf_t
                case SIMD_MMX:
                        bitslice_test_nonces_function_p = &bitslice_test_nonces_MMX;
                        break;
+#endif
+#endif
                default:
                        bitslice_test_nonces_function_p = &bitslice_test_nonces_NOSIMD;
                        break;
Impressum, Datenschutz