GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Vanderhell/microcrypt: Minimalist C99 library with cryptographic primitives for embedded systems. Includes SHA-256, HMAC-SHA256 and AES-128 (ECB/CBC/GCM), with no external dependencies and no dynamic allocation.

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
cmake
cmake
 
 
docs
docs
 
 
include
include
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 

Repository files navigation

microcrypt

Portable C99 cryptographic primitives for embedded and constrained systems.

microcrypt is a low-level primitive library. It provides SHA-256, HMAC-SHA256, AES-128 block transforms, AES-128-CBC helpers, and AES-128-GCM AEAD. It does not provide padding or a message encryption protocol.

Security notice

This repository does not claim audit status, formal proof, FIPS validation, or side-channel resistance. AES uses lookup tables and is not suitable against cache/timing/power/EM attackers on observable platforms. CBC provides confidentiality only and must be used with authenticated designs.

Features

  • SHA-256 with checked init/update/final lifecycle
  • HMAC-SHA256 with checked verification
  • AES-128 block encrypt/decrypt
  • AES-128-CBC with explicit chaining output
  • AES-128-GCM authenticated encryption with a 12-byte nonce, 16-byte tag, and AAD
  • Secure clearing helpers for secret material

Build

cmake -S . -B build
cmake --build build --config Debug
ctest --test-dir build -C Debug --output-on-failure

Install

The CMake package exports microcrypt::microcrypt.

find_package(microcrypt CONFIG REQUIRED)
target_link_libraries(app PRIVATE microcrypt::microcrypt)

Documentation

  • Cookbook
  • Verification
  • Release process
  • Issue triage
  • Security policy

Usage

#include "mcrypt.h"

uint8_t digest[MCRYPT_SHA256_DIGEST_SIZE];
mcrypt_status_t status = mcrypt_sha256("abc", 3, digest);
if (status != MCRYPT_OK) {
    /* handle error */
}
mcrypt_hmac_sha256_t ctx;
uint8_t mac[MCRYPT_HMAC_SHA256_SIZE];

if (mcrypt_hmac_sha256_init(&ctx, key, key_len) == MCRYPT_OK &&
    mcrypt_hmac_sha256_update(&ctx, data, data_len) == MCRYPT_OK &&
    mcrypt_hmac_sha256_final(&ctx, mac) == MCRYPT_OK) {
    /* mac is ready */
}

Version

AES-GCM nonces must be unique for every encryption under a given key. The library neither generates nor manages nonces.

Current version: 3.0.1

3.0.0 ABI note

mcrypt_hmac_sha256_t changed layout in 3.0.0. Recompile consumers against 3.0.0: source uses such as mcrypt_hmac_sha256_t ctx; remain compatible after recompilation, but binary compatibility with the 2.x public layout is not guaranteed. The context is reduced from 320 B to 192 B, and SHA-256 uses a 16-word circular message schedule without changing algorithm outputs.

About

Minimalist C99 library with cryptographic primitives for embedded systems. Includes SHA-256, HMAC-SHA256 and AES-128 (ECB/CBC/GCM), with no external dependencies and no dynamic allocation.

Topics

aesaes-128cc99cryptographyembeddedfirmwarehmaciotno-allocsha256zero-dependency

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity

Stars

2 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.