From c7ed3da50288e6ab73cf318136bd5362053c370c Mon Sep 17 00:00:00 2001 From: vtarasov Date: Fri, 13 May 2011 12:57:18 +0000 Subject: [PATCH] libopensc: authentIC: use macros; use common CPLC data type git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5440 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/libopensc/authentic.h | 13 ------------- src/libopensc/card-authentic.c | 2 +- src/libopensc/iasecc-sdo.c | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/libopensc/authentic.h b/src/libopensc/authentic.h index b8aa0a09..805ad9c8 100644 --- a/src/libopensc/authentic.h +++ b/src/libopensc/authentic.h @@ -150,17 +150,4 @@ struct sc_authentic_sdo { unsigned magic; }; -#define SC_MAX_AUTHENTIC_CPLC 45 -struct sc_authentic_cplc { - unsigned char ic_data[4]; - unsigned char ic_serial[4]; - unsigned char ic_batch[4]; - unsigned char aid_last_bytes[2]; - unsigned char keyset_version; - unsigned char starting_index; - - unsigned char value[SC_MAX_AUTHENTIC_CPLC]; - size_t len; -}; - #endif diff --git a/src/libopensc/card-authentic.c b/src/libopensc/card-authentic.c index ba66622a..e58130dc 100644 --- a/src/libopensc/card-authentic.c +++ b/src/libopensc/card-authentic.c @@ -77,7 +77,7 @@ struct authentic_private_data { struct sc_pin_cmd_data pins[8]; unsigned char pins_sha1[8][SHA_DIGEST_LENGTH]; - struct sc_authentic_cplc cplc; + struct sc_cplc cplc; }; static struct sc_atr_table authentic_known_atrs[] = { diff --git a/src/libopensc/iasecc-sdo.c b/src/libopensc/iasecc-sdo.c index bb4f9215..bd47eb13 100644 --- a/src/libopensc/iasecc-sdo.c +++ b/src/libopensc/iasecc-sdo.c @@ -370,7 +370,7 @@ iasecc_se_parse(struct sc_card *card, unsigned char *data, size_t data_len, stru if (offs != data_len) LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, "parse error: not totaly parsed"); - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); } @@ -455,7 +455,7 @@ iasecc_parse_chv(struct sc_card *card, unsigned char *data, size_t data_len, str offs += rv; } - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); } @@ -483,7 +483,7 @@ iasecc_parse_prvkey(struct sc_card *card, unsigned char *data, size_t data_len, offs += rv; } - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); } @@ -519,7 +519,7 @@ iasecc_parse_pubkey(struct sc_card *card, unsigned char *data, size_t data_len, offs += rv; } - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); } @@ -547,7 +547,7 @@ iasecc_parse_keyset(struct sc_card *card, unsigned char *data, size_t data_len, offs += rv; } - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); } @@ -609,7 +609,7 @@ iasecc_parse_docp(struct sc_card *card, unsigned char *data, size_t data_len, st rv = iasecc_parse_acls(card, &sdo->docp, 0); LOG_TEST_RET(ctx, rv, "Cannot parse ACLs in DOCP"); - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); } @@ -739,7 +739,7 @@ iasecc_sdo_parse(struct sc_card *card, unsigned char *data, size_t data_len, str sc_log(ctx, "docp.acls_contact.size %i, docp.size.size %i", sdo->docp.acls_contact.size, sdo->docp.size.size); - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); } @@ -770,7 +770,7 @@ iasecc_sdo_allocate_and_parse(struct sc_card *card, unsigned char *data, size_t sc_log(ctx, "sdo_class 0x%X, sdo_ref 0x%X", sdo->sdo_class, sdo->sdo_ref); if (data_len == 3) { *out = sdo; - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); } size_size = iasecc_parse_size(data + 3, &size); @@ -808,7 +808,7 @@ iasecc_update_blob(struct sc_context *ctx, struct iasecc_extended_tlv *tlv, int offs = 0, sz = tlv->size + 2; if (tlv->size == 0) - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); sz = tlv->size + 2; @@ -918,7 +918,7 @@ iasecc_encode_docp(struct sc_context *ctx, struct iasecc_sdo_docp *docp, unsigne *out_len = blob_size; } - LOG_FUNC_RETURN(ctx, 0); + LOG_FUNC_RETURN(ctx, SC_SUCCESS); }