Skip to content

Instantly share code, notes, and snippets.

Avatar
🏖️

Derry Pratama ibndias

🏖️
View GitHub Profile
@ibndias
ibndias / keychronfn.sh
Created Oct 14, 2021
Keychron Function Key Ubuntu, use F1-F12 first, press FN to use multimedia
View keychronfn.sh
echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all
sudo reboot # optional
@ibndias
ibndias / maven_single_test.sh
Created Aug 18, 2021
Maven run single test
View maven_single_test.sh
mvn -Dtest=ClassNameTest#TestMethod test -DfailIfNoTests=false
@ibndias
ibndias / erase_from_memory.h
Created Jul 15, 2021 — forked from mimoo/erase_from_memory.h
Include this file to get the `erase_from_memory` function that zeros memory. See https://www.cryptologie.net/article/419/zeroing-memory-compiler-optimizations-and-memset_s/
View erase_from_memory.h
#ifndef __ERASE_FROM_MEMORY_H__
#define __ERASE_FROM_MEMORY_H__ 1
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdlib.h>
#include <string.h>
void *erase_from_memory(void *pointer, size_t size_data, size_t size_to_remove) {
#ifdef __STDC_LIB_EXT1__
memset_s(pointer, size_data, 0, size_to_remove);
View printbuff.c
int i;
for (i = 0; i < 32; i++)
{
if (i > 0) printf(":");
printf("%02X", pk_buf[i]);
}
printf("\n");
ret =0;
View aria-cbc-test-openssl.c
#include <openssl/conf.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/engine.h>
#include <string.h>
#define MAX_MSG_LEN 256
static void handleErrors()
@ibndias
ibndias / build-openssl-clang-riscv.sh
Created May 11, 2021
How to build OpenSSL for RISCV using clang
View build-openssl-clang-riscv.sh
#Adapted from
#https://github.com/openssl/openssl/issues/11073
./Configure linux-generic64 -DSOMEMACRO CC="clang -march=rv64g"
CC="clang -march=rv64g" make
@ibndias
ibndias / rebuild-clang-riscv-linux.sh
Created May 11, 2021
Rebuild the clang using riscv64-unknown-linux-gnu
View rebuild-clang-riscv-linux.sh
#/bin/bash
set -e
#rm -rf build
#mkdir build
pushd build
#cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" -DLLVM_ENABLE_PROJECTS=clang -DBUILD_SHARED_LIBS=False -DLLVM_USE_SPLIT_DWARF=True -DCMAKE_INSTALL_PREFIX="/home/derry/riscv/" -DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False -DLLVM_PARALLEL_LINK_JOBS=False -DDEFAULT_SYSROOT="/home/derry/riscv/riscv64-unknown-elf" -DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-elf" -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm
cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" -DLLVM_ENABLE_PROJECTS=clang -DBUILD_SHARED_LIBS=False -DLLVM_USE_SPLIT_DWARF=True -DCMAKE_INSTALL_PREFIX="/home/derry/riscv/" -DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False -DLLVM_PARALLEL_LINK_JOBS=False -DDEFAULT_SYSROOT="/home/derry/riscv/sysroot" -DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-linux-gnu" -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm
cmake --build . --target install
popd
@ibndias
ibndias / make-clang-mbedtls.sh
Created May 11, 2021
Compile mbedtls with clang (RISCV64)
View make-clang-mbedtls.sh
CC="clang -march=rv64g -Dunix" make
@ibndias
ibndias / build-gnutls.md
Last active Apr 26, 2021
Solve build gnutls when error with Nettle
View build-gnutls.md

Follow GNUTLS README

Nettle (from source)

wget https://ftp.gnu.org/gnu/nettle/nettle-3.5.tar.gz
tar xvfz nettle-3.5.tar.gz
cd nettle-3.5
./configure
make
sudo make install
@ibndias
ibndias / log-executed-ins-riscv.gdb
Created Apr 14, 2021
GDB Script for log executed asm instruction (RISCV)
View log-executed-ins-riscv.gdb
set confirm off
tbreak start_trigger
r
set logging overwrite on
set logging on
set height 0
set style enabled off
while (1)
x/i $pc
stepi