all repos — TinyCrypT @ 7c83dae0a692a5e2936e84d6072b57be373b0b66

Short and sweet classical cryptographic primitives

Libraries and vanity, as always
Juniper Beatitudes [email protected]
Thu, 01 Jan 2026 13:24:58 -0600
commit

7c83dae0a692a5e2936e84d6072b57be373b0b66

parent

c2d17ee44bbcfcdbf6c1a0ba8ce4c48a605d4336

4 files changed, 25 insertions(+), 14 deletions(-)

jump to
M .gitignore.gitignore

@@ -52,6 +52,7 @@ Module.symvers

Mkfile.old dkms.conf -build/test-main +test-main .cache/ -compile_commands.json+compile_commands.json +lib/
M MakefileMakefile

@@ -1,13 +1,25 @@

-CC ?= gcc +CC ?= clang +AR ?= ar INCLUDE_PATH := . -SOURCE_FILES := tinycrypt/*.c +SOURCE_FILES := $(wildcard tinycrypt/*.c) +SOURCE_OBJECTS := $(SOURCE_FILES:tinycrypt/%.c=lib/%.o) TEST_SOURCE_FILES := tinycrypt/tests/*.c +COMPILER_OPTS := -O3 -ffreestanding -std=c99 -build/test-main: $(SOURCE_FILES) $(TEST_SOURCE_FILES) - @ $(CC) -o build/test-main -I$(INCLUDE_PATH) $(SOURCE_FILES) $(TEST_SOURCE_FILES) +test-main: $(SOURCE_OBJECTS) $(TEST_SOURCE_FILES) + @ $(CC) -o test-main -O3 -I$(INCLUDE_PATH) $(SOURCE_FILES) $(TEST_SOURCE_FILES) -tests: build/test-main - @ ./build/test-main +tests: test-main + @ ./test-main + +memcheck: test-main + @ valgrind ./test-main -memcheck: build/test-main - @ valgrind ./build/test-main+lib/%.o: tinycrypt/%.c + @ $(CC) -c $(COMPILER_OPTS) -I$(INCLUDE_PATH) $< -o $@ + +lib: $(SOURCE_OBJECTS) + @ $(AR) rcs lib/libtinycrypt.a lib/*.o + +clean: + rm lib/*.o test-main
M flake.nixflake.nix

@@ -18,11 +18,12 @@ shl = pkgs.mkShell {

name = "tct-tooling-env"; packages = with pkgs; [ cmake - gcc + clang clang-tools gnumake valgrind bear + tokei ]; }; in
M tinycrypt/ed25519.ctinycrypt/ed25519.c

@@ -1,6 +1,5 @@

#include <stdbool.h> #include <stdint.h> -#include <string.h> #include "tinycrypt/sha2.h" #include "tinycrypt/ed25519.h"

@@ -150,8 +149,6 @@ h[i] = 255 - (acc & 0xFF);

acc >>= 8; } } - -#include <stdio.h> static bool greater264 (const uint8_t *a, const uint8_t *b)