Remove C++-style // comments. Yes, I know that they
are ok in C99 spec, but who says that all compilers are already C99 compatible. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1272 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
118c7a4dcc
commit
beebb1bc47
|
@ -92,7 +92,7 @@ opensc_rsa_finish(RSA* rsa) {
|
||||||
|
|
||||||
struct sc_pkcs15_key_id *key_id;
|
struct sc_pkcs15_key_id *key_id;
|
||||||
key_id = RSA_get_app_data(rsa);
|
key_id = RSA_get_app_data(rsa);
|
||||||
free(key_id); // which free?
|
free(key_id);
|
||||||
if(sc_pin) {free(sc_pin);}
|
if(sc_pin) {free(sc_pin);}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -193,14 +193,14 @@ EVP_PKEY *opensc_load_public_key(ENGINE *e, const char *s_key_id,
|
||||||
|
|
||||||
r = sc_pkcs15_find_pubkey_by_id(p15card, id, &obj);
|
r = sc_pkcs15_find_pubkey_by_id(p15card, id, &obj);
|
||||||
if (r >= 0) {
|
if (r >= 0) {
|
||||||
// if (!quiet)
|
if (!quiet)
|
||||||
printf("Reading public key with ID '%s'\n", s_key_id);
|
printf("Reading public key with ID '%s'\n", s_key_id);
|
||||||
r = sc_pkcs15_read_pubkey(p15card, obj, &pubkey);
|
r = sc_pkcs15_read_pubkey(p15card, obj, &pubkey);
|
||||||
} else if (r == SC_ERROR_OBJECT_NOT_FOUND) {
|
} else if (r == SC_ERROR_OBJECT_NOT_FOUND) {
|
||||||
/* No pubkey - try if there's a certificate */
|
/* No pubkey - try if there's a certificate */
|
||||||
r = sc_pkcs15_find_cert_by_id(p15card, id, &obj);
|
r = sc_pkcs15_find_cert_by_id(p15card, id, &obj);
|
||||||
if (r >= 0) {
|
if (r >= 0) {
|
||||||
// if (!quiet)
|
if (!quiet)
|
||||||
printf("Reading certificate with ID '%s'\n", s_key_id);
|
printf("Reading certificate with ID '%s'\n", s_key_id);
|
||||||
r = sc_pkcs15_read_certificate(p15card,
|
r = sc_pkcs15_read_certificate(p15card,
|
||||||
(sc_pkcs15_cert_info_t *) obj->data,
|
(sc_pkcs15_cert_info_t *) obj->data,
|
||||||
|
@ -219,13 +219,15 @@ EVP_PKEY *opensc_load_public_key(ENGINE *e, const char *s_key_id,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now, set EVP_PKEY data from pubkey object
|
/* now, set EVP_PKEY data from pubkey object */
|
||||||
key_out=EVP_PKEY_new();
|
key_out=EVP_PKEY_new();
|
||||||
if(!key_out)
|
if(!key_out)
|
||||||
{fprintf(stderr, "failed to create new EVP_PKEY\n"); return NULL;};
|
{fprintf(stderr, "failed to create new EVP_PKEY\n"); return NULL;};
|
||||||
EVP_PKEY_assign_RSA(key_out,RSA_new_method(e));
|
EVP_PKEY_assign_RSA(key_out,RSA_new_method(e));
|
||||||
//RSA_set_method(keyout->rsa, sc_get_rsa_method());
|
#if 0
|
||||||
key_out->pkey.rsa->flags|=RSA_FLAG_EXT_PKEY||RSA_FLAG_SIGN_VER;// needed?
|
RSA_set_method(keyout->rsa, sc_get_rsa_method());
|
||||||
|
#endif
|
||||||
|
key_out->pkey.rsa->flags|=RSA_FLAG_EXT_PKEY||RSA_FLAG_SIGN_VER;
|
||||||
RSA_set_app_data(key_out->pkey.rsa, id);
|
RSA_set_app_data(key_out->pkey.rsa, id);
|
||||||
sc_set_pubkey_data(key_out, pubkey);
|
sc_set_pubkey_data(key_out, pubkey);
|
||||||
|
|
||||||
|
@ -260,17 +262,16 @@ EVP_PKEY *opensc_load_private_key(ENGINE *e, const char *s_key_id,
|
||||||
if(sc_pin) {free(sc_pin); sc_pin=NULL;}
|
if(sc_pin) {free(sc_pin); sc_pin=NULL;}
|
||||||
key_out=opensc_load_public_key(e, s_key_id, ui_method, callback_data);
|
key_out=opensc_load_public_key(e, s_key_id, ui_method, callback_data);
|
||||||
sc_pin=malloc(12);
|
sc_pin=malloc(12);
|
||||||
get_pin(ui_method,sc_pin,12); // do this here, when storing sc_pin in RSA
|
get_pin(ui_method,sc_pin,12); /* do this here, when storing sc_pin in RSA */
|
||||||
//memset(sc_pin,0x0,12);
|
#if 0
|
||||||
//free(sc_pin);
|
memset(sc_pin,0x0,12);
|
||||||
|
free(sc_pin);
|
||||||
|
#endif
|
||||||
if(!key_out) {
|
if(!key_out) {
|
||||||
fprintf(stderr,"Failed to get private key");
|
fprintf(stderr,"Failed to get private key");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return key_out;
|
return key_out;
|
||||||
//err:
|
|
||||||
// opensc_close();
|
|
||||||
// return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -293,7 +294,6 @@ sc_private_decrypt(int flen, const u_char *from, u_char *to, RSA *rsa,
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
err:
|
err:
|
||||||
//sc_close();
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,8 +315,7 @@ sc_sign(int type, const u_char *m, unsigned int m_len,
|
||||||
/* FIXME: check 'type' and modify flags accordingly */
|
/* FIXME: check 'type' and modify flags accordingly */
|
||||||
flags |= SC_ALGORITHM_RSA_PAD_PKCS1 ;
|
flags |= SC_ALGORITHM_RSA_PAD_PKCS1 ;
|
||||||
if(type==NID_sha1) flags|=SC_ALGORITHM_RSA_HASH_SHA1;
|
if(type==NID_sha1) flags|=SC_ALGORITHM_RSA_HASH_SHA1;
|
||||||
if(type==NID_md5) flags|=SC_ALGORITHM_RSA_HASH_MD5;
|
if(type==NID_md5) flags|=SC_ALGORITHM_RSA_HASH_MD5; /* SC_ALGORITHM_RSA_HASH_SHA1 */
|
||||||
// SC_ALGORITHM_RSA_HASH_SHA1;
|
|
||||||
r = sc_pkcs15_compute_signature(p15card, key_obj, flags,
|
r = sc_pkcs15_compute_signature(p15card, key_obj, flags,
|
||||||
m, m_len, sigret, RSA_size(rsa));
|
m, m_len, sigret, RSA_size(rsa));
|
||||||
sc_unlock(card);
|
sc_unlock(card);
|
||||||
|
@ -328,7 +327,6 @@ sc_sign(int type, const u_char *m, unsigned int m_len,
|
||||||
*siglen = r;
|
*siglen = r;
|
||||||
return 1;
|
return 1;
|
||||||
err:
|
err:
|
||||||
//sc_close();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,5 +47,5 @@ EVP_PKEY *pkcs11_load_public_key(ENGINE *e, const char *s_key_id,
|
||||||
EVP_PKEY *pkcs11_load_private_key(ENGINE *e, const char *s_key_id,
|
EVP_PKEY *pkcs11_load_private_key(ENGINE *e, const char *s_key_id,
|
||||||
UI_METHOD *ui_method, void *callback_data) ;
|
UI_METHOD *ui_method, void *callback_data) ;
|
||||||
|
|
||||||
// defined in p11_rsa.c
|
/* defined in p11_rsa.c */
|
||||||
RSA_METHOD * pkcs11_get_rsa_method();
|
RSA_METHOD * pkcs11_get_rsa_method();
|
||||||
|
|
Loading…
Reference in New Issue