aboutsummaryrefslogtreecommitdiff
path: root/pkcs11.c
AgeCommit message (Collapse)Author
2016-11-19New branch for PKCS #11 without SQLite3. Checkpoint, doesn't compile yet.Rob Austein
We're going to want this in a separate branch from ksng at least for a little while, so that we can flip back and forth easily to run the same tests. Current code doesn't even compile yet, but is far enough along to be worth backing up off-machine.
2016-11-14hal_rpc_pkey_find() -> hal_rpc_pkey_open().Rob Austein
2016-10-25Track libhal HAL_DIGEST_ALGORITHM_ change.Rob Austein
2016-10-07Track changes to libhal RPC pkey API.Rob Austein
2016-09-09Track removal of `type` argument from hal_rpc_pkey_find().Rob Austein
2016-09-03Hack PKCS #11 to work with revised libhal pkey API.Rob Austein
2016-08-16More pkcs11test fixes: nuanced read-only, error code proliferation.Rob Austein
PKCS #11's notion of a "read-only" session is odd: read-only sessions can still create/modify/destroy objects, just not "token" objects. C_SeedRandom() has its own special "nope, didn't implement that" error code, apparently the one everything else uses wasn't good enough. C_Login() has different error codes for "you're already logged in" and "you're already logged in as somebody else".
2016-08-14First round of fixes for bugs found by Google pkcs11test.Rob Austein
Testing against https://github.com/google/pkcs11test.git found various bugs, some trivial, some more interesting, some arguably places where the specification is looser than pkcs11test. I'm still digging through the test results, but this commit fixes several of the most obvious issues.
2016-07-13Add "cryptech" to public "pkcs11" names.Rob Austein
Database location environment variable is now CRYPTECH_PKCS11_DATABASE. Installed library is now libcryptech-pkcs11.{so,dylib}.
2016-07-12Light the "user PIN initialized" bit, for OpenSSL's pkcs11 engine.Rob Austein
Like several other recent commits, this just nails up some value which really should be coming from the HSM via some as-yet-unwritten RPC call, but that can wait until after the upcoming workshop.
2016-07-12Whoops, CKR_BUFFER_TOO_SMALL doesn't terminate a sign or digest operation.Rob Austein
2016-07-12Add a few missing informational functions that pkcs11-tool wanted.Rob Austein
opensc's pkcs11-tool wants to use C_GetInfo(), C_GetSlotInfo(), and C_GetMechanismList(). All are trivial functions, but we hadn't implemented any of them. As with most of the informational functions, some of the returned values are nonsense: in the long run, fixing this just means adding one or more new informational queries to the RPC protocol, but I'm not going to do that while we're in, well, not code freeze, but at least code jello. Adding C_GetMechanismList() exposed that we had never added all the SHA-224 variants to pkcs11.c: since these are just a pass-through to libhal, adding them now seems low-risk (famous last words). Closes #40.
2016-06-28Move hal_pkey_* columns from the object table intoRob Austein
{session,token}_object tables to preserve the mapping from pkcs11 token objects to libhal pkey objects.
2016-06-13Set return value properly in C_CreateObject().Rob Austein
2016-06-13Support for adding private keys via C_CreateObject().Rob Austein
2016-06-10Support split keypairs, where private key is a token object and publicRob Austein
key is a session object. Doesn't actually save us anything, but Jakob tells us that this makes a difference on some HSMs so we people use this kind of setup and we need to support it. Explicitly disallow private keys as session objects, since we have no way to protect them. Update unit-tests now that we return the correct error code for this case.
2016-05-25Track PIN changes on libhal master branch.Rob Austein
2016-05-18Refactor object creation code.Rob Austein
2016-05-17Bugfixes to new error handling code, refactor some unreadable nested logic ↵Rob Austein
in handle lookup code. The mapping between PKCS #11 objects and libhal handles isn't quite right yet. This is a snapshot of bugfixes accumulated along the way, before refactoring mapping code to deal with the underlying problem.
2016-05-17Start error handling cleanup and rewrite.Rob Austein
Error handling and hte underlying functions and macros that support it will probably change a bit more as it goes along. Trying to strike the right balance between having the main code be readable and having the underlying support code be at least comprehensible and straightforward to review. Also need to address current over-use of CKR_FUNCTION_FAILED.
2016-05-15Use key hashes instead of CKA_ID to name objects in libhal keystore.Rob Austein
2016-05-14Key flag handling, more trailing whitespace cleanup.Rob Austein
At this point we are passing most of the unit tests in RPC loopback mode. Remaining failure is TestKeys.test_keygen_token_vs_session(), which gets HAL_ERROR_KEY_NAME_IN_USE when attempting to generate a session key and a token key with the same CKA_ID value, so clearly something is not quite right yet in the keystore selection logic.
2016-05-14Add (back) ability to construct public keys from stored attributes.Rob Austein
2016-05-14Track (trivial) libhal API change.Rob Austein
2016-05-13The libhal RPC channel works better when one remembers to initialize it.Rob Austein
2016-05-12Fix RSA key length and CKA_ID lookup.Rob Austein
libhal RPC API takes RSA key lengths in bits, not bytes. Insisting on receiving matching CKA_ID in both public and private templates on key generation is probably unwise, so back down using CKA_ID from private template if provided, otherwise from the public template, and only raise incompete template error if both are missing.
2016-05-12Remove vestigial KEK code, that's all handled by libhal now.Rob Austein
2016-05-12p11util now uses libhal and doesn't need to touch SQL.Rob Austein
"p11util" is now something of a misnomer, since there's no longer anything about it that's specific to PKCS #11. Probably should become a libhal utility program, eventually.
2016-05-12First pass on converting from direct libhal calls to libhal RPC calls.Rob Austein
This version isn't really expected to work properly, but it's far enough along to be worth archiving before starting runtime testing.
2016-05-06Track API changes on sw/libhal rpc branch.Rob Austein
So far this is just dumb little things like changed names for old data types and functions. Changes to use new API features will come later.
2015-12-13whack copyrightsPaul Selkirk
2015-10-04Minimal conversion to config_core_selector libhal API. Not doingRob Austein
anything particularly clever with the new capabilities (yet).
2015-09-22Makefile cleanup.Rob Austein
2015-09-21Unit tests for init, session, and login functions.Rob Austein
2015-09-16Add C_SignUpdate(), C_SignFinal(), C_VerifyUpdate(), C_VerifyFinal().Rob Austein
2015-09-15py11 support for C_CreateObject().Rob Austein
2015-09-15Add C_CreateObject(), which required refactoring some of the ↵Rob Austein
template-checking code.
2015-09-14Debug PKCS #11 ECDSA signature and verification.Rob Austein
2015-09-11Fix size_t vs CK_ULONG type mismatch (platform dependent).Rob Austein
2015-09-11verify_rsa_pkcs() should be static.Rob Austein
2015-09-09Add ECDSA signature and verification. Compiles, not tested.Rob Austein
2015-09-09Refactor C_Sign() and C_Verify() to move algorithm-dependent code toRob Austein
helper functions. As a happy side effect, this also simplifies locking slightly and gives us a straightforward path towards the *Update() and *Final() incremental-hashing functions. Compiles, not yet tested.
2015-09-08Merge branch 'master' into ecdsaRob Austein
2015-09-07Checkpoint of partial support for ECDSA. Compiles, not yet tested,Rob Austein
probably doesn't work. Probably should merge state_access branch before going much further with this.
2015-09-02Track changes to hal_rsa_key_t and hal_hash_state_t.Rob Austein
2015-07-23First pass at adding incremental digest support. C_Digest*() only soRob Austein
far. Compiles, not yet tested.
2015-07-17Add C_GetSessionInfo().Rob Austein
2015-07-17Don't insist that both keys in a pair must be token objects if eitherRob Austein
one is. Apparently making the public key be a session object is a standard hack for conserving space on the token.
2015-07-09Might help to spell function name correctly.Rob Austein
2015-07-09Add hashes to C_GetMechanismInfo().Rob Austein