~ubuntu-branches/ubuntu/karmic/opensc/karmic-updates

« back to all changes in this revision

Viewing changes to src/pkcs15init/pkcs15-cardos.c

  • Committer: Bazaar Package Importer
  • Author(s): Eric Dorland
  • Date: 2009-03-29 03:56:10 UTC
  • mto: (8.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20090329035610-y7v5a3f0852p4da8
Tags: upstream-0.11.7
ImportĀ upstreamĀ versionĀ 0.11.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
308
308
        u8              abignum[256];
309
309
        int             algorithm, r, delete_it = 0, use_ext_rsa = 0;
310
310
        size_t          keybits, rsa_max_size;
311
 
        
 
311
        int             pin_id = -1;
 
312
 
312
313
        if (obj->type != SC_PKCS15_TYPE_PRKEY_RSA)
313
314
                return SC_ERROR_NOT_SUPPORTED;
314
315
 
334
335
                                "for key generation.");
335
336
                return SC_ERROR_NOT_SUPPORTED;
336
337
        }
 
338
       pin_id = sc_keycache_find_named_pin(&key_info->path, SC_PKCS15INIT_USER_PIN);
 
339
       if (pin_id > 0) {
 
340
                r = sc_pkcs15init_verify_key(profile, card, NULL, SC_AC_CHV, pin_id);
 
341
                if (r < 0)
 
342
                        return r;
 
343
        }
337
344
        if (use_ext_rsa == 0)
338
345
                temp->ef_structure = SC_FILE_EF_LINEAR_VARIABLE_TLV;
339
346
        else
544
551
        struct sc_cardctl_cardos_obj_info args;
545
552
        struct tlv      tlv;
546
553
        unsigned char   buffer[256];
547
 
#if SET_SM_BYTES
 
554
#ifdef SET_SM_BYTES
548
555
        unsigned int    n;
549
556
#endif
550
557
        int             r;
582
589
        tlv_add(&tlv, 0);
583
590
#endif
584
591
 
585
 
#if SET_SM_BYTES
 
592
#ifdef SET_SM_BYTES
586
593
        /* it shouldn't be necessary to set the default value */
587
594
        /* SM bytes */
588
595
        tlv_next(&tlv, 0x8B);
622
629
                pin_id = 0;
623
630
 
624
631
        if (key_info->modulus_length > 1024 && (card->type == SC_CARD_TYPE_CARDOS_M4_2 ||
625
 
            card->type == SC_CARD_TYPE_CARDOS_M4_3 ||card->type == SC_CARD_TYPE_CARDOS_M4_2B)) {
 
632
            card->type == SC_CARD_TYPE_CARDOS_M4_3 ||card->type == SC_CARD_TYPE_CARDOS_M4_2B ||
 
633
            card->type == SC_CARD_TYPE_CARDOS_M4_2C )) {
626
634
                r = cardos_store_key_component(card, algorithm, key_id, pin_id, 0,
627
635
                        key->p.data, key->p.len, 0, 0);
628
636
                if (r != SC_SUCCESS)