aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-09-02 22:51:33 -0400
committerRob Austein <sra@hactrn.net>2015-09-02 22:51:33 -0400
commitb2d4db9254788a0d84b247ba14692eb4291d8f9a (patch)
tree8ff17ff570394b68e62a2c38e8952494974177ed
parent60a46afc01b73e763251370642cf61b15ba067d0 (diff)
Track changes to hal_rsa_key_t and hal_hash_state_t.
-rw-r--r--pkcs11.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/pkcs11.c b/pkcs11.c
index 318055e..93e051a 100644
--- a/pkcs11.c
+++ b/pkcs11.c
@@ -1142,7 +1142,7 @@ static CK_OBJECT_HANDLE p11_object_create(const p11_session_t *session,
*/
static int p11_object_set_rsa_private_key(const CK_OBJECT_HANDLE object_handle,
- const hal_rsa_key_t key)
+ const hal_rsa_key_t * const key)
{
static const char select_kek[] =
" SELECT kek FROM global";
@@ -1191,7 +1191,7 @@ static int p11_object_set_rsa_private_key(const CK_OBJECT_HANDLE object_handle,
*/
static int p11_object_get_rsa_private_key(const CK_OBJECT_HANDLE object_handle,
- hal_rsa_key_t *key,
+ hal_rsa_key_t **key,
uint8_t *keybuf, const size_t keybuf_len)
{
static const char select_format[] =
@@ -1215,7 +1215,7 @@ static int p11_object_get_rsa_private_key(const CK_OBJECT_HANDLE object_handle,
}
else if (sqlite3_column_type(q, 1) == SQLITE_NULL) {
- key->key = NULL;
+ *key = NULL;
ok = 1;
}
@@ -1233,7 +1233,7 @@ static int p11_object_get_rsa_private_key(const CK_OBJECT_HANDLE object_handle,
memset(wrapbuf, 0, sizeof(wrapbuf));
}
- if (!ok || key->key == NULL)
+ if (!ok || *key == NULL)
memset(keybuf, 0, keybuf_len);
sqlite3_finalize(q);
@@ -1251,7 +1251,7 @@ static int p11_object_get_rsa_private_key(const CK_OBJECT_HANDLE object_handle,
*/
static int p11_object_get_rsa_public_key(const CK_OBJECT_HANDLE object_handle,
- hal_rsa_key_t *key,
+ hal_rsa_key_t **key,
uint8_t *keybuf, const size_t keybuf_len)
{
static const char select_format[] =
@@ -1730,7 +1730,7 @@ static CK_RV generate_keypair_rsa_pkcs(p11_session_t *session,
public_exponent[hal_rsa_key_t_size/8];
size_t modulus_len;
CK_ULONG public_exponent_len;
- hal_rsa_key_t key = { NULL };
+ hal_rsa_key_t *key = NULL;
CK_ULONG keysize = 0;
CK_RV rv;
int i;
@@ -1860,7 +1860,7 @@ static int pkcs1_construct_digestinfo(const hal_hash_descriptor_t * const desc,
uint8_t *digest_info, const size_t digest_info_len)
{
uint8_t statebuf[desc->hash_state_length];
- hal_hash_state_t state = { NULL };
+ hal_hash_state_t *state = NULL;
uint8_t *d = digest_info;
/*
@@ -1950,7 +1950,7 @@ static int pkcs1_5_pad(const uint8_t * const data, const size_t data_len,
* (decryption) operation (both use the private key as exponent).
*/
-static CK_RV sign_rsa_pkcs(hal_rsa_key_t key,
+static CK_RV sign_rsa_pkcs(const hal_rsa_key_t * const key,
const uint8_t * const digest_info, const size_t digest_info_len,
uint8_t *signature, const size_t signature_len)
{
@@ -1981,7 +1981,7 @@ static CK_RV sign_rsa_pkcs(hal_rsa_key_t key,
* unnecessary, but it's also harmless.
*/
-static CK_RV verify_rsa_pkcs(hal_rsa_key_t key,
+static CK_RV verify_rsa_pkcs(const hal_rsa_key_t * const key,
const uint8_t * const digest_info, const size_t digest_info_len,
const uint8_t * const signature, const size_t signature_len)
{
@@ -3052,7 +3052,7 @@ CK_RV C_Digest(CK_SESSION_HANDLE hSession,
{
uint8_t statebuf[session->digest_descriptor->hash_state_length];
- hal_hash_state_t state = { NULL };
+ hal_hash_state_t *state = NULL;
if (!hal_check(hal_hash_initialize(session->digest_descriptor,
&state, statebuf, sizeof(statebuf))) ||
@@ -3127,7 +3127,7 @@ CK_RV C_Sign(CK_SESSION_HANDLE hSession,
ENTER_PUBLIC_FUNCTION(C_Sign);
uint8_t keybuf[hal_rsa_key_t_size];
- hal_rsa_key_t key = { NULL };
+ hal_rsa_key_t *key = NULL;
p11_session_t *session;
size_t signature_len;
CK_RV rv;
@@ -3263,7 +3263,7 @@ CK_RV C_Verify(CK_SESSION_HANDLE hSession,
ENTER_PUBLIC_FUNCTION(C_Verify);
uint8_t keybuf[hal_rsa_key_t_size];
- hal_rsa_key_t key = { NULL };
+ hal_rsa_key_t *key = NULL;
p11_session_t *session;
CK_RV rv;