Documentation updates and circleCI config update.

This commit is contained in:
Kyle Isom 2023-10-22 02:32:51 -07:00
parent d4065a9668
commit a682c339bf
3 changed files with 52 additions and 66 deletions

View File

@ -1,25 +1,18 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/configuration-reference
version: 2.1 version: 2.1
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/configuration-reference/#jobs
jobs: jobs:
ctest: ctest:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker: docker:
- image: git.wntrmute.dev/sc/dev:alpine - image: git.wntrmute.dev/sc/dev:main
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps: steps:
- checkout - checkout
- run: - run:
name: Setup cmake build name: Setup cmake build
command: setup-cmake.sh command: cmake-build-and-test.sh
- run:
name: Valgrind checks.
command: cmake-run-valgrind.sh
# Orchestrate jobs using workflows
# See: https://circleci.com/docs/configuration-reference/#workflows
workflows: workflows:
ctest: ctest:
jobs: jobs:

View File

@ -1,15 +1,15 @@
cmake_minimum_required(VERSION 3.22) cmake_minimum_required(VERSION 3.22)
project(emsha project(emsha
VERSION 1.1.0 VERSION 1.1.1
LANGUAGES CXX LANGUAGES CXX
DESCRIPTION "A compact HMAC-SHA-256 C++11 library.") DESCRIPTION "A compact HMAC-SHA-256 C++11 library.")
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_VERBOSE_MAKEFILES ON) set(CMAKE_VERBOSE_MAKEFILES ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(EMSHA_NO_HEXSTRING OFF CACHE BOOL set(SET_EMSHA_NO_HEXSTRING OFF CACHE BOOL
"Don't include support for hex strings.") "Don't include support for hex strings.")
if (EMSHA_NO_HEXSTRING) if (SET_EMSHA_NO_HEXSTRING)
add_definitions(EMSHA_NO_HEXSTRING) add_definitions(EMSHA_NO_HEXSTRING)
endif () endif ()
set(SET_EMSHA_NO_HEXLUT OFF CACHE BOOL set(SET_EMSHA_NO_HEXLUT OFF CACHE BOOL
@ -18,6 +18,13 @@ if (SET_EMSHA_NO_HEXLUT)
add_definitions("-DEMSHA_NO_HEXLUT") add_definitions("-DEMSHA_NO_HEXLUT")
endif () endif ()
set(SET_EMSHA_NO_SELFTEST OFF CACHE BOOL
"Disable the internal self-tests.")
if (SET_EMSHA_NO_SELFTEST)
add_definitions("-DEMSHA_NO_SELFTEST")
endif ()
include(CTest) include(CTest)
enable_testing() enable_testing()

View File

@ -1,74 +1,60 @@
libemsha # emsha
========
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/shimmering-clarity/emsha/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/shimmering-clarity/emsha/tree/master) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/shimmering-clarity/emsha/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/shimmering-clarity/emsha/tree/master)
[![image](https://scan.coverity.com/projects/29250/badge.svg)](https://scan.coverity.com/projects/shimmering-clarity-emsha) [![image](https://scan.coverity.com/projects/29250/badge.svg)](https://scan.coverity.com/projects/shimmering-clarity-emsha)
This library is an MIT-licensed HMAC-SHA-256 C++11 library designed for This library is an MIT-licensed HMAC-SHA-256 C++11 library designed for
embedded systems. It is built following the JPL [Power of embedded systems. It is built following the JPL [Power of Ten](http://spinroot.com/gerard/pdf/P10.pdf)
Ten](http://spinroot.com/gerard/pdf/P10.pdf) rules. It was written in rules. It was written in response to a need for a standalone HMAC-SHA-256
response to a need for a standalone HMAC-SHA-256 package that could run package that could run on several platforms, including several memory-
on several platforms. constrained embedded platforms.
Getting and Building the Source ### Getting and Building the Source
-------------------------------
The source code is available via The source code is available via
[Github](https://github.com/kisom/libemsha/); each version should be git [Git](https://git.wntrmute.dev/sc/emsha/); each version should be git
tagged. : tagged. There is also a [mirror on Github](https://github.com/shimmering-clarity/emsha).
git clone https://github.com/kisom/libemsha
git clone git@github.com:kisom/libemsha
```
git clone https://git.wntrmute.dev/sc/emsha
```
The current release is The current release is
[1.0.1](https://github.com/kisom/libemsha/releases/tag/v1.0.1). [1.1.1](https://git.wntrmute.dev/sc/emsha/releases/tag/v1.1.0).
The project is built using Autotools and `make`. The project is built using CMake. Packages are built using the `RelWithDebInfo`
configuration; artifacts are built using the [sc3dev](https://git.wntrmute.dev/sc/sc3dev/)
[build script](https://git.wntrmute.dev/sc/sc3dev/src/branch/master/cmake-build-and-test.sh).
When building from a git checkout, the [autobuild]{.title-ref} script
will bootstrap the project from the autotools sources (e.g. via
`autoreconf -i`), run `configure` (by default to use clang), and attempt
to build the library and run the unit tests.
Once the autotools infrastructure has been bootstrapped, the following There are two cache variables that might be useful:
should work: :
./configure && make && make check && make install - `SET EMSHA_NO_HEXSTRING` disables the provided `hexstring` function;
There are three flags to `configure` that might be useful:
- `--disable-hexstring` disables the provided `hexstring` function;
while this might be useful in many cases, it also adds extra size to while this might be useful in many cases, it also adds extra size to
the code. the code. For memory-constrained microcontrollers, this might be
- `--disable-hexlut` disables the larger lookup table used by desirable.
- `SET_EMSHA_NO_HEXLUT` disables the larger lookup table used by
`hexstring`, which can save around a kilobyte of program space. If `hexstring`, which can save around a kilobyte of program space. If
the `hexstring` function is disabled, this option has no effect. the `hexstring` function is disabled, this option has no effect.
- `--disable-selftest` disables the internal self-tests, which can - `SET_EMSHA_NO_SELFTEST` disables the internal self-tests, which can
reclaim some additional program space. reclaim some additional program space.
Documentation ### Documentation
-------------
Documentation is currently done with [Sphinx](http://sphinx-doc.org/). Documentation is currently done with Doxygen; documentation is
See `doc/`. available [online](https://docs.shimmering-clarity.net/emsha/).
### See also ### See also
- [FIPS 180-4, the Secure Hash - [FIPS 180-4, the Secure Hash Standard](http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf)
Standard](http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) - [FIPS 198-1, The Keyed-Hash Message Authentication Code (HMAC)](http://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf)
- [FIPS 198-1, The Keyed-Hash Message Authentication Code - [RFC 2014, HMAC: Keyed-Hashing for Message Authentication](https://tools.ietf.org/html/rfc2104)
(HMAC)](http://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf) - [RFC 6234, US Secure Hash Algorithms (SHA and SHA-based HMAC and HKDF)](https://tools.ietf.org/html/rfc6234)
- [RFC 2014, HMAC: Keyed-Hashing for Message
Authentication](https://tools.ietf.org/html/rfc2104)
- [RFC 6234, US Secure Hash Algorithms (SHA and SHA-based HMAC and
HKDF)](https://tools.ietf.org/html/rfc6234)[^1]
- The behaviour of this package was cross-checked using the Go 1.5.1 - The behaviour of this package was cross-checked using the Go 1.5.1
linux/amd64 standard library\'s linux/amd64 standard library's [crypto/sha256](https://golang.org/src/crypto/sha256/) package.
[crypto/sha256](https://golang.org/src/crypto/sha256/) package.
**Footnotes** ### Acknowledgements
[^1]: This library came about after extracting the relevant C code from This library came about after extracting the relevant C code from RFC
RFC 6234, and needing a C++ version. It draws heavy inspiration from 6234, and needing a C++ version. It draws heavy inspiration from that
that code base. code. I also pulled a lot of test vectors from Go's crypto/sha256.