Skip to content

Instantly share code, notes, and snippets.

View haraldh's full-sized avatar
☀️
🍻

Harald Hoyer haraldh

☀️
🍻
View GitHub Profile
{"tcbInfo":{"id":"SGX","version":3,"issueDate":"2023-08-09T18:32:31Z","nextUpdate":"2023-09-08T18:32:31Z","fmspc":"00606a000000","pceId":"0000","tcbType":0,"tcbEvaluationDataNumber":16,"tcbLevels":[{"tcb":{"sgxtcbcomponents":[{"svn":12,"category":"BIOS","type":"Early Microcode Update"},{"svn":12,"category":"OS/VMM","type":"SGX Late Microcode Update"},{"svn":3,"category":"OS/VMM","type":"TXT SINIT"},{"svn":3,"category":"BIOS"},{"svn":255},{"svn":255},{"svn":1},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":13},"tcbDate":"2023-08-09T00:00:00Z","tcbStatus":"SWHardeningNeeded","advisoryIDs":["INTEL-SA-00615"]},{"tcb":{"sgxtcbcomponents":[{"svn":12,"category":"BIOS","type":"Early Microcode Update"},{"svn":12,"category":"OS/VMM","type":"SGX Late Microcode Update"},{"svn":3,"category":"OS/VMM","type":"TXT SINIT"},{"svn":3,"category":"BIOS"},{"svn":255},{"svn":255},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],

$2a$11$PbnKBsYBb8LZMo6CnZOznONzf5IEAGiuB5a0cRg1hNDMGswGPO0Kq

@haraldh
haraldh / qemu.bash
Created April 19, 2021 13:14
qemu_add_drive_args
# generate qemu arguments for named raw disks
#
# qemu_add_drive_args <index> <filename> <id-name> [<bootindex>]
#
# $1: name of the index variable (set to 0 at start)
# $2: name of the argument array variable (set to () at start)
# $3: filename of the raw disk image
# $4: name of the disk in /dev/disk/by-id -> /dev/disk/by-id/ata-disk_$name
# $5: optional bootindex number
#
@haraldh
haraldh / getarg.sh
Created March 4, 2021 15:48
getargs
_dogetarg() {
local _search_key
local _in_quote
local _key
local _val
local _equals
local _STATE
local _lastchar
local _want_value
local _multi_args
use ::sev::certs::{ca, sev};
use ::sev::launch::Policy;
use ::sev::session::Session;
use codicon::{Decoder, Encoder};
use koine::attestation::sev::*;
use process_control::{ChildExt, Timeout};
use serde::de::Deserialize;
use serde_cbor as serde_flavor;
use std::convert::TryFrom;
use std::os::unix::net::{UnixListener, UnixStream};
use crate::aesm_proto::Request_InitQuoteRequest;
use byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
use protobuf::Message;
use std::io::{Read, Write};
use std::mem::size_of;
use std::os::unix::net::UnixStream;
mod aesm_proto;
fn main() -> std::io::Result<()> {
@haraldh
haraldh / ref_mut.rs
Created June 23, 2020 11:45
use &mut T, Box<T> and &mut dyn T in one function
use std::ops::DerefMut;
use std::thread::sleep;
use std::time::Duration;
trait DigitalInput {
fn set_state(&mut self, _new_state: bool);
}
trait Mutable<T: ?Sized> {
fn ref_mut(&mut self) -> &mut T;
extern "C" {
static _DYNAMIC: u64;
}
use core::mem::size_of;
use goblin::elf::dynamic::dyn64::Dyn;
use goblin::elf::dynamic::{DT_REL, DT_RELA, DT_RELASZ, DT_RELSZ};
use goblin::elf::reloc::reloc64::Rel;
use goblin::elf::reloc::reloc64::Rela;
use goblin::elf::reloc::reloc64::R_X86_64_RELATIVE;
# dnf install tar tpm2-tools openssl /usr/bin/xxd 

# ## Encrypt

# dd if=/dev/random of=shared_key bs=64 count=1

# openssl enc \
  -aes-256-cbc -salt \
 -iv $(dd if=shared_key bs=1 skip=32 | xxd -l 16 -c 32 -p ) \
@haraldh
haraldh / test.ks
Last active April 23, 2020 13:30
test kickstart
text
lang en_US.UTF-8
keyboard us
timezone US/Eastern
selinux --enforcing
firewall --enabled
services --enabled=sshd,systemd-networkd,systemd-resolved,chronyd,zram-swap
network --bootproto=dhcp --device=link --activate
reboot