aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-07-05Add load_novena_fpga script.Rob Austein
2015-07-05Use C99 variadic macro as safety wrapper around variadic function.Rob Austein
Are we having fun yet?
2015-07-05NULL-terminate string list, doh.Rob Austein
2015-07-05novena-eim.h had an invisible dependency on <sys/types.h>, at least onRob Austein
Debian Wheezy (ie, on the Novena).
2015-07-05Get rid of autoconf, as we don't really need it. Add eim_peek_pokeRob Austein
utility program, based on Paul's example in the core/platform/novena repository.
2015-07-01Change default to use software modexp until we sort out performanceRob Austein
issues in ModExp core.
2015-06-30Track ModExp core exponent padding change: this enables the short exponent ↵Rob Austein
fast path.
2015-06-26Verify signature in key generation test.Rob Austein
2015-06-24Rework API for loading keys from components. Relax key sizeRob Austein
constraints to allow any key size within our supported range, since hsmbully seems to want to twist this knob to every possible setting.
2015-06-21libcryptech -> libhal, doh.Rob Austein
2015-06-21Check for hash core present before running PBKDF2 tests.Rob Austein
2015-06-21Add digest algorithm IDs.Rob Austein
2015-06-19Add methods to extract public components from an RSA key. Other minorRob Austein
cleanup and commenting within RSA module.
2015-06-19Add README.md.Rob Austein
2015-06-19Add temporary workaround to let us use software ModExp when we'reRob Austein
testing other code and don't want to wait for the as-yet-unoptimized FPGA ModExp core.
2015-06-19Add replacement for fp_exptmod() using our ModExp core, so we don'tRob Austein
drag in all of TFM's Montgomery just to support the Miller-Rabin test.
2015-06-18Supply public exponent as bigendian byte string rather than unsignedRob Austein
long, since that's the form we'll need for PKCS #11.
2015-06-18Helps to set the return value when reading a key, doh.Rob Austein
2015-06-18Add round-trip test for DER I/O code.Rob Austein
2015-06-18Add RSA blinding.Rob Austein
2015-06-18Refactor CRT code into public API.Rob Austein
2015-06-17Debug RSA key generation.Rob Austein
2015-06-17RSA key generation and DER support.Rob Austein
2015-06-17RSA key generation. Compiles, not (yet) tested otherwise.Rob Austein
2015-06-16Refactor key loading code.Rob Austein
2015-06-11Debug modexp_fp() buffer handling. Add basic timing report.Rob Austein
Compensate for PyCrypto's weird inversion of p and q when calculating CRT coefficients, and add key the key components PyCrypto doesn't bother pre-calculating to our test data.
2015-06-11Build issues on Novena.Rob Austein
2015-06-11First cut at RSA decryption/signature using the Chinese RemainderRob Austein
Theorem. Not yet tested, and given the number of moving parts I would be astonished if this version actually worked, but it does compile. Added some timing code to tests/test-rsa.c so we can see whether this is doing anything useful once it does work.
2015-06-10Operand lengths weren't including bug-workaround padding.Rob Austein
2015-06-10Add hal_modexp(), since the protocol is a bit complex. RewriteRob Austein
test-rsa to use hal_modexp(), and generate a new set of test keys without the whacky padding, since hal_modexp() now handles that.
2015-06-05This time for sure, Rocky!Rob Austein
2015-06-05Get feedback cycle right in PBKDF2 iteration.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-06-03ModExp now working!Rob Austein
2015-06-01Add padding options to test workaround for current ModExp bugs.Rob Austein
2015-05-28More fun with RSA test cases, still not working.Rob Austein
2015-05-27First pass at RSA tests.Rob Austein
2015-05-25Cleanup: names of *_core_present() functions, Makefile.Rob Austein
2015-05-25Doh, skip tests when we know core isn't present.Rob Austein
2015-05-25Add missing truncated SHA-512 cases.Rob Austein
2015-05-24Cleanup.Rob Austein
2015-05-24Debug hash-testing code.Rob Austein
2015-05-24First pass on hash test code.Rob Austein
2015-05-24AES key wrap now working with AES core.Rob Austein
2015-05-24Typing "!" when one meant "~" has interesting effects when bit masking.Rob Austein
d.h> #include <sys/un.h> #include "hal.h" #include "hal_internal.h" static int sock = -1; hal_error_t hal_rpc_client_transport_init(void) { const char *sockname = getenv("CRYPTECH_RPC_CLIENT_SOCKET_NAME"); struct sockaddr_un name; sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock == -1) return perror("socket"), HAL_ERROR_RPC_TRANSPORT; if (sockname == NULL) sockname = HAL_CLIENT_DAEMON_DEFAULT_SOCKET_NAME; memset(&name, 0, sizeof(struct sockaddr_un)); name.sun_family = AF_UNIX; strncpy(name.sun_path, sockname, sizeof(name.sun_path) - 1); if (connect(sock, (const struct sockaddr *) &name, sizeof(struct sockaddr_un)) < 0) return perror("connect"), HAL_ERROR_RPC_TRANSPORT; return HAL_OK; } hal_error_t hal_rpc_client_transport_close(void) { int ret = close(sock); sock = -1; if (ret != 0) return perror("close"), HAL_ERROR_RPC_TRANSPORT; return HAL_OK; } hal_error_t hal_rpc_send(const uint8_t * const buf, const size_t len) { return hal_slip_send(buf, len); } hal_error_t hal_rpc_recv(uint8_t * const buf, size_t * const len) { size_t maxlen = *len; *len = 0; hal_error_t err = hal_slip_recv(buf, len, maxlen); return err; } /* * These two are sort of mis-named, fix eventually, but this is what * the code in slip.c expects. */ hal_error_t hal_serial_send_char(const uint8_t c) { if (write(sock, &c, 1) != 1) return perror("write"), HAL_ERROR_RPC_TRANSPORT; return HAL_OK; } hal_error_t hal_serial_recv_char(uint8_t * const c) { if (read(sock, c, 1) != 1) return perror("read"), HAL_ERROR_RPC_TRANSPORT; return HAL_OK; }