-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d1d95d5
Showing
146 changed files
with
22,912 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
.idea/ | ||
build/ | ||
|
||
# Created by https://www.gitignore.io/api/linux,macos,visualstudiocode | ||
# Edit at https://www.gitignore.io/?templates=linux,macos,visualstudiocode | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
### VisualStudioCode Patch ### | ||
# Ignore all local history of files | ||
.history | ||
|
||
# End of https://www.gitignore.io/api/linux,macos,visualstudiocode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "type-safely-firmware/libopencm3"] | ||
path = type-safely-firmware/libopencm3 | ||
url = https://github.com/libopencm3/libopencm3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# type-safely | ||
_Cambridge Computer Science Tripos -- Part II_ | ||
|
||
Hardware USB keyloggers and programmable USB keystroke injection tools are widely available, inexpensive, and small enough to be easily concealable. Such devices can even be embedded inside a standard-size USB connector, making their detection nearly impossible. These devices allow the interception of sensitive details and the spoofing of keyboard input, so the threats to computer users can range from theft of sensitive information to the complete compromise of their computer. | ||
|
||
This project aims to mitigate these threats by bringing the guarantees of confidentiality, integrity, authentication, and authorisation---provided by protocols such as TLS and Bluetooth---to communication with USB keyboards. This will be achieved by designing and implementing a new protocol, on top of the USB stack, for communication with USB keyboards. | ||
|
||
In order to give a reasonable confidence in the security properties of the new protocol, the core of the cryptographic protocol will be based upon an existing, well-studied one, such as Bluetooth's \textit{Simple Secure Pairing}. The implementation will be made from scratch, and will consist of both software for the microcontroller inside the keyboards, and host-side drivers and keyboard management software for Ubuntu Linux. | ||
|
||
## Building | ||
|
||
#### Firmware | ||
Make sure to have `gcc-arm-none-eabi` and GNU make installed. | ||
```bash | ||
cd type-safely-firmware | ||
# Pull in libopencm3 | ||
git submodule init | ||
git submodule update | ||
# Run make on the libopencm3 directory | ||
make -j8 -C ./libopencm3 | ||
# Make the project itself | ||
make PLATFORM=STM32F4_1BITSY -j8 | ||
``` | ||
Edit: apply the fix at https://github.com/libopencm3/libopencm3/pull/794 to the libopencm3 dir before `make`ing it | ||
|
||
#### C++ Protocol test | ||
Make sure to have CMake, `libusb-1.0.0-dev`, and `libssl-dev` installed. | ||
```bash | ||
cd common/protobuf_test_cpp | ||
mkdir build && cd build | ||
cmake .. | ||
make -j8 | ||
./proto_test_cpp | ||
``` | ||
|
||
#### Host daemon | ||
Similar to the C++ Protocol test. Requires Qt to be installed! | ||
```bash | ||
cd type-safely-daemon | ||
mkdir build && cd build | ||
cmake -DCMAKE_PREFIX_PATH=/Users/Harry/Qt5.12.0/5.12.0/clang_64/lib/cmake .. | ||
make -j8 | ||
./typesafely_daemon | ||
``` | ||
Note that you'll have to adjust CMAKE_PREFIX_PATH to match your installation directory. | ||
|
||
Extra steps: | ||
```bash | ||
# [Linux only] Allow root to display windows on X | ||
xhost +SI:localuser:root | ||
|
||
# Make the LTK storage directory | ||
sudo mkdir /etc/typesafely | ||
sudo chmod -R 700 /etc/typesafely | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
|
||
# Created by https://www.gitignore.io/api/c,c++,clion,cmake,macos,visualstudiocode | ||
# Edit at https://www.gitignore.io/?templates=c,c++,clion,cmake,macos,visualstudiocode | ||
|
||
### C ### | ||
# Prerequisites | ||
*.d | ||
|
||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Linker output | ||
*.ilk | ||
*.map | ||
*.exp | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
# Debug files | ||
*.dSYM/ | ||
*.su | ||
*.idb | ||
*.pdb | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
*.cmd | ||
.tmp_versions/ | ||
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
|
||
### C++ ### | ||
# Prerequisites | ||
|
||
# Compiled Object files | ||
*.slo | ||
|
||
# Precompiled Headers | ||
|
||
# Compiled Dynamic libraries | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
|
||
# Executables | ||
|
||
### CLion ### | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
### CLion Patch ### | ||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 | ||
|
||
# *.iml | ||
# modules.xml | ||
# .idea/misc.xml | ||
# *.ipr | ||
|
||
# Sonarlint plugin | ||
.idea/sonarlint | ||
|
||
### CMake ### | ||
CMakeLists.txt.user | ||
CMakeCache.txt | ||
CMakeFiles | ||
CMakeScripts | ||
Testing | ||
Makefile | ||
cmake_install.cmake | ||
install_manifest.txt | ||
compile_commands.json | ||
CTestTestfile.cmake | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
### VisualStudioCode Patch ### | ||
# Ignore all local history of files | ||
.history | ||
|
||
# End of https://www.gitignore.io/api/c,c++,clion,cmake,macos,visualstudiocode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
typesafely_protocol.connection.ConnectRequest.id_host max_size:7 | ||
typesafely_protocol.connection.ConnectResponse.id_device max_size:7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
syntax = "proto3"; | ||
package typesafely_protocol.connection; | ||
|
||
|
||
// ========= Connection initialisation | ||
message ConnectRequest { | ||
bytes id_host = 1; | ||
} | ||
|
||
message ConnectResponse { | ||
bool device_recognises_host_id = 1; | ||
bytes id_device = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
typesafely_protocol.pairing.ECDHPublicKey.public_key max_size:32 | ||
|
||
typesafely_protocol.pairing.CommitmentExchangeRequest.host_commitment max_size:16 | ||
typesafely_protocol.pairing.CommitmentExchangeResponse.device_commitment max_size:16 | ||
|
||
typesafely_protocol.pairing.NonceExchangeRequest.host_nonce max_size:16 | ||
typesafely_protocol.pairing.NonceExchangeResponse.device_nonce max_size:16 | ||
|
||
typesafely_protocol.pairing.ParameterConfirmationRequest.host_parameter_confirmation max_size:16 | ||
typesafely_protocol.pairing.ParameterConfirmationResponse.device_parameter_confirm max_size:16 |
Oops, something went wrong.