aboutsummaryrefslogtreecommitdiff
path: root/hash.c
AgeCommit message (Collapse)Author
2018-05-20Drop <assert.h> now that everything should be using hal_assert() instead.Rob Austein
2018-05-20Better hal_core_alloc() semantics, assert() and printf() cleanup.Rob Austein
Various fixes extracted from the abandoned(-for-now?) reuse-cores branch, principally: * Change hal_core_alloc*() to support core reuse and to pick the least-recently-used core of a particular type otherwise; * Replace assert() and printf() calls with hal_assert() and hal_log(), respectively. assert() is particularly useless on the HSM, since it sends its error message into hyperspace then hangs the HSM.
2017-10-23Cleanup signed/unsigned mismatches, mostly in loop countersPaul Selkirk
2017-07-31Unconditionally set the allocated flag when initializing a hash statePaul Selkirk
structure. When running multiple concurrent unit tests, I observed multiple failures in the hmac tests, which I ultimately tracked down to different clients sharing the same hal_hmac_state struct. hal_hash_initialize is called twice in hal_hmac_initialize (once to get the state structure, then again if the supplied key is too long), and is called in hal_hmac_finalize, to hash the digest with the supplied key. In these subsequent cases, the caller supplies the state structure, which hal_hash_initialize zeroes, but it doesn't set the allocated flag. This marks an in-use struct as available, so it gets reassigned and reinitialized, and Bad Things Happen for both clients that are trying to use it.
2016-12-19Merge branch 'master' into ksngRob Austein
2016-10-25Uppercase HAL_DIGEST_ALGORITHM_ symbols for API consistency.Rob Austein
2016-09-20Clean up the defines around rpc client, software hash cores, etc.Paul Selkirk
2016-09-01Move in-memory keystore from client to server. Whack with club until compiles.Rob Austein
Fixes for various minor issues found while integrating with sw/stm32. Moving the in-memory keystore (PKCS #11 session objects, etc) from the client library to the HSM was on the near term to-do list in any case, doing it now turned out to be the easiest way to solve one of the build problems.
2016-07-05Attempt to add resource management, for multiple cores of the same type.Paul Selkirk
Find a suitable core, and mark it busy. Don't forget to release it as soon as you're done. This has a knock-on effect of un-const'ing core arguments and struct fields in a lot of places, and it moves some core checks around.
2016-06-09Typo in SHA-224/SHA-256 software core.Rob Austein
2016-05-31SHA-224 driver and soft core.Rob Austein
2016-05-15Silence unused variable warning.Rob Austein
2016-05-14Trailing whitespace cleanup.Rob Austein
2016-03-29Enable 'mixed' mode, with client-side hashing.Paul Selkirk
2016-03-21Merge branch 'master' into rpcPaul Selkirk
2016-03-16Added serial RPC transport and lots more...Paul Selkirk
Added RPC function to get server version number. Substantially reworked GNUMakefile with conditionals. Renamed rpc_*() and xdr_*() to hal_*() for consistency. Moved hal_io_fmc.c from stm32 repo.
2016-03-09Tweak handling of byte swapping in software hash cores to get rid ofRob Austein
some unnecessary data copying.
2016-03-09Optional (compile time conditional) software hash cores. At theRob Austein
moment this is all-or-nothing, but could easily be tweaked to allow compile-time selection of particular hashes.
2015-12-23RPC interface to TRNG and (incomplete) PIN code.Rob Austein
2015-12-13Merge Paul's copyright updates.Rob Austein
2015-12-13whack copyrightsPaul Selkirk
2015-12-13Add rpc_hash.c. Convert dynamic allocator in hash.c to use privateRob Austein
pool of pre-configured state blocks, suitable for an embedded system.
2015-11-13Merge branch 'config_core_selector'Paul Selkirk
2015-10-29Remove unused includes.Paul Selkirk
2015-10-04Whack libhal API to use current configure_core_selector mechanism.Rob Austein
Compiles, not yet tested.
2015-10-04off_t => hal_addr_t.Rob Austein
2015-09-08Merge branch 'master' into ecdsaRob Austein
This required a bit of manual cleanup in hal.h, hash.c, and rsa.c. No intended changes to functionality provided by parent comments, just a few tweaks to track API changes beyond git's ken.
2015-09-06Add ECPoint I/O functions. ASN.1 cleanup.Rob Austein
2015-09-02Clean up excessively complicated handling of opaque types in hash andRob Austein
RSA code; use simpler model (pointer to incomplete structure) used in ECDSA code. Refactor RSA code to use shared ASN.1 routines.
2015-07-18Add support for dynamic allocation of hash and HMAC state, for casesRob Austein
where it's unavoidable.
2015-07-17First cut at libhal support for hash cores with ability to save andRob Austein
restore internal state. Compiles, not yet tested.
2015-06-21libcryptech -> libhal, doh.Rob Austein
2015-06-21Add digest algorithm IDs.Rob Austein
2015-06-05HMAC for truncated SHA-512 digests would probably work better if weRob Austein
used the right digest length constants. Doh.
2015-06-04First cut at PBKDF2.Rob Austein
2015-06-04Disable HMAC-SHA-384 tests as neither my implementation nor PyCryptoRob Austein
passes them. Add missing copyright notices, other trivial cleanup (whitespace, etc).
2015-06-04Whoops, we're supposed to hash an entire block for the key regardlessRob Austein
of how long the key is. With this fix, HMAC passes tests on Novena.
2015-06-04HMAC implementation and test vectors.Rob Austein
2015-06-04Refactor hash code prior to adding HMAC (which we need for PBKDF2).Rob Austein
Main changes: moving the ten zillion core-related constants from closures into a driver structure, rework API to the more common initialize/update/finalize because it's easier to understand, particularly with HMAC.
2015-05-25Cleanup: names of *_core_present() functions, Makefile.Rob Austein
2015-05-24Debug hash-testing code.Rob Austein
2015-05-20Add AES Key Wrap using Cryptech AES core.Rob Austein
2015-05-20Add csprng and hash modules. Add real error codes instead of magicRob Austein
numbers, and propegate error codes up from lower layers. Whack C++-isms, add parenthesese to a lot of macro expressions for evaluation safety, other minor cleanup.