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
#define OPENSSL_SUPPRESS_DEPRECATED | |
#include <openssl/bn.h> | |
#include <openssl/ec.h> | |
#include <openssl/obj_mac.h> | |
#include <openssl/objects.h> | |
#include <stdio.h> | |
#include <vector> | |
void check_rc(const char* where, int rc, int expected_rc = 1) { | |
if(rc != expected_rc) { |
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
#include <botan/internal/simd_avx2.h> | |
#include <botan/internal/simd_avx2_gfni.h> | |
#include <immintrin.h> | |
#include <botan/hex.h> | |
#include <botan/system_rng.h> | |
namespace Botan { | |
SIMD_8x32 camellia_s1(SIMD_8x32 x) { | |
constexpr uint64_t pre_a = gfni_matrix(R"( |
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
// Demo of constexpr asm (gcc 15) | |
#include <stdlib.h> | |
#include <array> | |
#include <string> | |
#include <algorithm> | |
consteval std::string body_i(std::string_view x, size_t i) { | |
std::string out; | |
for(char c : x) { |
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
#define OPENSSL_SUPPRESS_DEPRECATED | |
#include <openssl/bn.h> | |
#include <openssl/ec.h> | |
#include <stdio.h> | |
void check_rc(const char* where, int rc, int expected_rc = 1) { | |
if(rc != expected_rc) { | |
printf("%s returned %d\n", where, rc); | |
exit(1); | |
} |
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
def mods(ki, w): | |
if ki >= (1 << (w-1)): | |
return ki - (1 << w) | |
else: | |
return ki | |
def wnaf(k, w): | |
assert(w >= 2) | |
mask = (1 << w) - 1 | |
naf = [] |
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
[remote "origin"] | |
url = [email protected]:randombit/foo.git | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
fetch = +refs/pull/*/head:refs/remotes/origin/pr/* |
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
/** | |
Minimization of https://github.com/randombit/botan/issues/3637 | |
*/ | |
#define CAUSE_CODEGEN_BUG | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <type_traits> | |
#include <cstring> |
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
#include <argon2.h> | |
#include <stdint.h> | |
#include <time.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
uint64_t timestamp() | |
{ | |
struct timespec ts; | |
if(::clock_gettime(CLOCK_MONOTONIC_RAW, &ts) == 0) |
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
via https://twitter.com/mjos_crypto/status/1219610073816801286 | |
Cloned https://github.com/daniel-thompson/pinebook-pro-debian-installer/ | |
Inserted a 32GB sdcard into the built-in slot. | |
./install-debian | |
Installs the a system there, reboot from sdcard. | |
Clone again, now do: | |
./install-debian CRYPT=y BLKDEV=/dev/mmcblk2 | |
Answer questions, done! | |
Supafresh Debian with LUKS on PineBook Pro. |
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
void apply_simple_seccomp_filter(const std::vector<std::string>& allowed_syscalls) | |
{ | |
//scmp_filter_ctx seccomp_ctx = ::seccomp_init(SCMP_ACT_ERRNO(EPERM)); | |
scmp_filter_ctx seccomp_ctx = ::seccomp_init(SCMP_ACT_TRAP); | |
if(seccomp_ctx == NULL) | |
throw std::runtime_error("seccomp_init failed"); | |
for(std::string syscall : allowed_syscalls) | |
{ | |
int syscall_num = ::seccomp_syscall_resolve_name(syscall.c_str()); |
NewerOlder