Skip to content

Instantly share code, notes, and snippets.

View josephlr's full-sized avatar

Joe Richey josephlr

View GitHub Profile
@josephlr
josephlr / sources.list
Created September 6, 2018 06:59
/etc/apt/sources.list for Ubuntu Bionic 18.04
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb [arch=amd64,i386] http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe multiverse
deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
@josephlr
josephlr / BUILD
Created June 19, 2019 21:48
Bazel BUILD file for Ring (x86_64-unknown-linux-gnu)
package(default_visibility = ["//visibility:private"])
licenses(["notice"]) # ISC-style
load("@io_bazel_rules_rust//rust:rust.bzl",
"rust_library",
"rust_binary",
"rust_test",
)
@josephlr
josephlr / BUILD
Last active June 20, 2019 09:48
BUILD file for Ring (x86_64 only, needs perlasm.bzl)
package(
default_visibility = ["//visibility:private"],
licenses = ["notice"], # ISC-style
)
## C Code
cc_library(
name = "base",
hdrs = ["include/GFp/base.h"],
@josephlr
josephlr / perlasm.bzl
Created June 20, 2019 09:34
Bazel file to support OpenSSl-style perl -> asm generation
load("@bazel_skylib//lib:paths.bzl", "paths")
def perlasm(src, perlasm_utils, name=None):
""" Creates a genrule to process the src. Returns rule name."""
(filename, ext) = paths.split_extension(paths.basename(src))
if ext != ".pl":
fail("Provided perlasm file {} must be a Perl file".format(src))
if name == None:
name = filename
@josephlr
josephlr / gist:39a723baa1f36346d1b904eaa8e98479
Created June 20, 2019 09:37
Output of "bazel test --test_output=all //ring:all"
INFO: Analyzed 34 targets (29 packages loaded, 871 targets configured).
INFO: Found 21 targets and 13 test targets...
INFO: From Testing //ring:ecdsa_tests:
==================== Test output for //ring:ecdsa_tests:
running 5 tests
test ecdsa_from_pkcs8_test ... ok
test ecdsa_generate_pkcs8_test ... ok
test ecdsa_test_public_key_coverage ... ok
test signature_ecdsa_verify_fixed_test ... ok
early console in extract_kernel
input_data: 0x000000000243b3b1
input_len: 0x0000000000497de4
output: 0x0000000001000000
output_len: 0x00000000018aa2c0
kernel_total_size: 0x000000000162c000
trampoline_32bit: 0x000000000009d000
booted via startup_64()
Physical KASLR using RDRAND RDTSC...
Virtual KASLR using RDRAND RDTSC...
early console in extract_kernel
input_data: 0x000000000243b3b1
input_len: 0x0000000000497de4
output: 0x0000000001000000
output_len: 0x00000000018aa2c0
kernel_total_size: 0x000000000162c000
trampoline_32bit: 0x000000000009d000
booted via startup_64()
@josephlr
josephlr / objdump.asm
Created January 3, 2020 12:19
use_file::getrandom_inner
0000000000004740 <_ZN9getrandom8use_file15getrandom_inner17h89c10d768f32f0baE>:
4740: 55 push %rbp
4741: 41 57 push %r15
4743: 41 56 push %r14
4745: 41 55 push %r13
4747: 41 54 push %r12
4749: 53 push %rbx
474a: 50 push %rax
474b: 48 89 f3 mov %rsi,%rbx
474e: 49 89 fe mov %rdi,%r14
@josephlr
josephlr / main.rs
Created January 7, 2020 07:29
getrandom example program
use getrandom::getrandom;
fn main() {
let mut data = [0u8; 4];
getrandom(&mut data).unwrap();
println!("{}", u32::from_ne_bytes(data));
}
#!/usr/bin/env python3
singles = {
0: "", # This is wrong for "zero", but is right for everything else.
1: "one",
2: "two",
3: "three",
4: "four",
5: "five",
6: "six",