~ubuntu-branches/ubuntu/natty/libp11/natty

« back to all changes in this revision

Viewing changes to src/p11_key.c

  • Committer: Bazaar Package Importer
  • Author(s): Eric Dorland
  • Date: 2009-08-16 23:45:00 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090816234500-rmcz7zu0bm46pgv7
Tags: 0.2.6-1
* New upstream release.
* debian/compat: Upgrade to version 7.
* debian/rules, debian/control: Use dh instead of debhelper.
* debian/control: Upgrade Standards-Version to 3.8.3.
* debian/libp11-1.install,  debian/libp11-1.shlibs, debian/libp11-1.symbols,
  debian/control: Rename libp11-0 to libp11-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
                           CK_SESSION_HANDLE session, CK_OBJECT_HANDLE o,
32
32
                           CK_OBJECT_CLASS type, PKCS11_KEY **);
33
33
static int pkcs11_store_private_key(PKCS11_TOKEN *, EVP_PKEY *, char *,
34
 
                                    unsigned char *, unsigned int, PKCS11_KEY **);
 
34
                                    unsigned char *, size_t, PKCS11_KEY **);
35
35
static int pkcs11_store_public_key(PKCS11_TOKEN *, EVP_PKEY *, char *,
36
 
                                   unsigned char *, unsigned int, PKCS11_KEY **);
 
36
                                   unsigned char *, size_t, PKCS11_KEY **);
37
37
 
38
38
static CK_OBJECT_CLASS key_search_class;
39
39
static CK_ATTRIBUTE key_search_attrs[] = {
93
93
/*
94
94
 * Store a private key on the token
95
95
 */
96
 
int PKCS11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, unsigned int id_len)
 
96
int PKCS11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, size_t id_len)
97
97
{
98
98
        if (pkcs11_store_private_key(token, pk, label, id, id_len, NULL))
99
99
                return -1;
100
100
        return 0;
101
101
}
102
102
 
103
 
int PKCS11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, unsigned int id_len)
 
103
int PKCS11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, size_t id_len)
104
104
{
105
105
        if (pkcs11_store_public_key(token, pk, label, id, id_len, NULL))
106
106
                return -1;
114
114
 */
115
115
int
116
116
PKCS11_generate_key(PKCS11_TOKEN * token,
117
 
                    int algorithm, unsigned int bits, char *label, unsigned char* id, unsigned int id_len)
 
117
                    int algorithm, unsigned int bits, char *label, unsigned char* id, size_t id_len)
118
118
{
119
119
        PKCS11_KEY *key_obj;
120
120
        EVP_PKEY *pk;
283
283
        if (!pkcs11_getattr_s(token, obj, CKA_LABEL, label, sizeof(label)))
284
284
                key->label = BUF_strdup(label);
285
285
        key->id_len = sizeof(id);
286
 
        if (!pkcs11_getattr_var(token, obj, CKA_ID, id, (size_t *) & key->id_len)) {
 
286
        if (!pkcs11_getattr_var(token, obj, CKA_ID, id, &key->id_len)) {
287
287
                key->id = (unsigned char *) malloc(key->id_len);
288
288
                memcpy(key->id, id, key->id_len);
289
289
        }
329
329
 * Store private key
330
330
 */
331
331
static int pkcs11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk,
332
 
                char *label, unsigned char *id, unsigned int id_len,
 
332
                char *label, unsigned char *id, size_t id_len,
333
333
                PKCS11_KEY ** ret_key)
334
334
{
335
335
        PKCS11_SLOT *slot = TOKEN2SLOT(token);
392
392
 * Store public key
393
393
 */
394
394
static int pkcs11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk,
395
 
                char *label, unsigned char *id, unsigned int id_len,
 
395
                char *label, unsigned char *id, size_t id_len,
396
396
                PKCS11_KEY ** ret_key)
397
397
{
398
398
        PKCS11_SLOT *slot = TOKEN2SLOT(token);