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
#!/usr/bin/env bash | |
# SPDX: BSD-3-Clause | |
# Usage: | |
# ./script.sh or bash script.sh | |
# | |
# Arguments: | |
# (optional) arg1: A aorking directory to use. Defaults to $HOME. | |
# | |
# Example: mkdir tmp |
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
typedef union TPM2B_FOO TPM2B_FOO; | |
union TPM2B_FOO { | |
struct { | |
uint16_t size; | |
uint8_t data[32]; | |
}t; | |
TPM2B b; | |
}; | |
int main(int argc, char *argv[]) { |
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
#!/usr/bin/env python3 | |
import sys | |
TSS2_HEADER_SIZE=14 | |
path = sys.argv[1] if len(sys.argv) > 1 else "/dev/tpm0" | |
with open(path, "r+b") as f: |
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
# On a docker ubuntu:16.04 base image, to build tpm2-abrmd I perform the following commands | |
sudo apt-get update | |
# The dependency list is fat here, because its deps for all the various projects, I trimmed it a little bit. | |
# but know you're getting more than you need. | |
sudo apt-get install -y \ | |
autoconf-archive \ | |
curl \ | |
libcmocka0 \ | |
libcmocka-dev \ |
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
# | |
# Source this file to get commands for launching containers like the tpm2-software CI system | |
# Example Usage: | |
# git clone https://github.com/tpm2-software/tpm2-tss.git | |
# cd tpm2-tss | |
# docker_run ubuntu-20.04 | |
# Uses whatever arg1 is passed to it as container name. Useful for passing hashes from docker build results. | |
_docker_run() { | |
local b=$(basename $(pwd)) |
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
mssim_command() { | |
local raw="no" | |
local port="2322" | |
local ip="127.0.0.1" | |
while getopts "a:p:rh" opt; do | |
case ${opt} in | |
h) | |
echo "Send a command to the simulator" |
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
#!/usr/bin/env python3 | |
# SPDX-License-Identifier: BSD-2-Clause | |
''' | |
EXAMPLE CODE NOT INTENDED FOR PRODUCTION USE | |
Some Python code using ctypes to: | |
- enumerate the slot list | |
- find an empty slot | |
- Initialize a token | |
- Set the user pin |
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
wcrobert@wcrobert-MOBL1:~/workspace/tpm2-tools/tools$ find -name \*\.c | grep nv | xargs grep -lv on_arg_nv_index | wc -l | |
21 | |
wcrobert@wcrobert-MOBL1:~/workspace/tpm2-tools/tools$ find -name \*\.c | grep nv | wc -l | |
21 |
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
logging --level=info | |
# Keyboard layouts | |
keyboard 'us' | |
# Root password | |
rootpw --plaintext password | |
# user is needed for fedora? --disabled isn't an option | |
user --name="test" --password="password" | |
hostname fedoratest |
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
import yaml | |
y=yaml.load(open("props.yaml")) | |
for x in y: | |
print("{.property=%s, .value=0x%X}," % (x, y[x]['raw'])) |