- paving way for version 0.3.5

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@77 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
jey 2001-12-15 01:29:51 +00:00
parent 166b369ffe
commit 0191d6c07d
10 changed files with 26 additions and 21 deletions

5
README
View File

@ -17,9 +17,8 @@ See the INSTALL file for instructions.
Troubleshooting
===============
A mailing-list will be set up for support and discussion about the
OpenSC project in the future. Meanwhile, contact the authors directly.
(See the AUTHORS file for email addresses)
A mailing-list has been set up for support and discussion about the
OpenSC project. Additional info is available at OpenSC web site.
Resources

View File

@ -2,7 +2,7 @@
AC_INIT(libopensc)
AC_CONFIG_SRCDIR(src/sc.c)
AM_CONFIG_HEADER(config.h:config.h.in)
AM_INIT_AUTOMAKE(libopensc, 0.3.2)
AM_INIT_AUTOMAKE(libopensc, 0.3.5)
# Checks for programs.

View File

@ -7,7 +7,7 @@ libopensc_la_SOURCES = sc-asn1.c sc-base64.c sc-defaults.c \
sc-pkcs15.c sc-pkcs15-cert.c \
sc-pkcs15-pin.c sc-pkcs15-prkey.c \
sc-pkcs15-defaults.c sc-pkcs15-sec.c
libopensc_la_LDFLAGS = -version-info 0:2:0
libopensc_la_LDFLAGS = -version-info 0:3:0
libopensc_la_CFLAGS = $(AM_CFLAGS) -Werror
include_HEADERS = opensc.h opensc-pkcs15.h
noinst_HEADERS = sc-asn1.h

View File

@ -96,8 +96,10 @@ void do_log2(struct sc_context *ctx, int facility, const char *file,
if (vsnprintf(p, left, format, args) < 0)
return;
if (ctx->use_std_output)
if (ctx->use_std_output) {
fputs(buf, outf);
fflush(outf);
}
}
void sc_hex_dump(struct sc_context *ctx, const u8 *in, int count,

View File

@ -59,7 +59,7 @@ void debug2(struct sc_context *ctx, const char *format, ...);
#define SC_TEST_RET(ctx, r, text) {\
int _ret = r;\
if (_ret < 0) {\
error(ctx, text": %s", sc_strerror(r));\
error(ctx, text": %s\n", sc_strerror(r));\
return _ret;\
}\
}

View File

@ -93,6 +93,7 @@ extern "C" {
#define SC_FILE_EF_LINEAR_FIXED_TLV 0x03
#define SC_MAX_READERS 4
#define SC_MAX_APDU_BUFFER_SIZE 255
#define SC_MAX_PATH_SIZE 16
#define SC_MAX_PIN_SIZE 16
#define SC_MAX_ATR_SIZE 33

View File

@ -24,6 +24,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int sc_pkcs15_decipher(struct sc_pkcs15_card *p15card,
const struct sc_pkcs15_prkey_info *prkey,

View File

@ -59,7 +59,7 @@ void debug2(struct sc_context *ctx, const char *format, ...);
#define SC_TEST_RET(ctx, r, text) {\
int _ret = r;\
if (_ret < 0) {\
error(ctx, text": %s", sc_strerror(r));\
error(ctx, text": %s\n", sc_strerror(r));\
return _ret;\
}\
}

View File

@ -148,7 +148,7 @@ int sc_check_apdu(const struct sc_apdu *apdu)
static int sc_transceive_t0(struct sc_card *card, struct sc_apdu *apdu)
{
SCARD_IO_REQUEST sSendPci, sRecvPci;
BYTE s[MAX_BUFFER_SIZE], r[MAX_BUFFER_SIZE];
BYTE s[SC_MAX_APDU_BUFFER_SIZE], r[SC_MAX_APDU_BUFFER_SIZE];
DWORD dwSendLength, dwRecvLength;
LONG rv;
u8 *data = s;
@ -240,9 +240,9 @@ int sc_transmit_apdu(struct sc_card *card, struct sc_apdu *apdu)
SC_FUNC_CALLED(card->ctx);
r = sc_check_apdu(apdu);
SC_TEST_RET(card->ctx, r, "APDU sanity check failed\n");
SC_TEST_RET(card->ctx, r, "APDU sanity check failed");
r = sc_transceive_t0(card, apdu);
SC_TEST_RET(card->ctx, r, "transceive_t0() failed\n");
SC_TEST_RET(card->ctx, r, "transceive_t0() failed");
if (sc_debug > 3) {
char buf[2048];
@ -256,7 +256,7 @@ int sc_transmit_apdu(struct sc_card *card, struct sc_apdu *apdu)
}
if (apdu->sw1 == 0x61 && apdu->resplen == 0) {
struct sc_apdu rspapdu;
BYTE rsp[MAX_BUFFER_SIZE];
BYTE rsp[SC_MAX_APDU_BUFFER_SIZE];
if (apdu->no_response)
return 0;
@ -275,7 +275,7 @@ int sc_transmit_apdu(struct sc_card *card, struct sc_apdu *apdu)
if (sc_debug > 3) {
char buf[2048];
buf[0] = 0;
if (apdu->resplen) {
if (rspapdu.resplen) {
sc_hex_dump(card->ctx, rspapdu.resp,
rspapdu.resplen,
buf, sizeof(buf));
@ -387,7 +387,7 @@ int sc_select_file(struct sc_card *card,
{
struct sc_context *ctx;
struct sc_apdu apdu;
char buf[MAX_BUFFER_SIZE];
char buf[SC_MAX_APDU_BUFFER_SIZE];
u8 pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf;
int r, pathlen;
@ -402,7 +402,7 @@ int sc_select_file(struct sc_card *card,
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xA4, 0, 0);
apdu.resp = buf;
apdu.resplen = 0;
apdu.resplen = sizeof(buf);
switch (pathtype) {
case SC_SELECT_FILE_BY_FILE_ID:
@ -468,7 +468,7 @@ int sc_read_binary(struct sc_card *card,
{
#define RB_BUF_SIZE 250
struct sc_apdu apdu;
u8 recvbuf[MAX_BUFFER_SIZE];
u8 recvbuf[SC_MAX_APDU_BUFFER_SIZE];
int r;
assert(card != NULL && buf != NULL);
@ -890,11 +890,11 @@ static int construct_fci(const struct sc_file *file, u8 *out, int *outlen)
int sc_create_file(struct sc_card *card, const struct sc_file *file)
{
int r, len;
u8 sbuf[MAX_BUFFER_SIZE];
u8 rbuf[MAX_BUFFER_SIZE];
u8 sbuf[SC_MAX_APDU_BUFFER_SIZE];
u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];
struct sc_apdu apdu;
len = MAX_BUFFER_SIZE;
len = SC_MAX_APDU_BUFFER_SIZE;
r = construct_fci(file, sbuf, &len);
if (r)
return r;
@ -916,7 +916,7 @@ int sc_delete_file(struct sc_card *card, int file_id)
{
int r;
u8 sbuf[2];
u8 rbuf[MAX_BUFFER_SIZE];
u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];
struct sc_apdu apdu;
sbuf[0] = (file_id >> 8) & 0xFF;

View File

@ -68,11 +68,13 @@ int sc_restore_security_env(struct sc_card *card, int num)
{
struct sc_apdu apdu;
int r;
u8 rbuf[MAX_BUFFER_SIZE];
assert(card != NULL);
SC_FUNC_CALLED(card->ctx);
sc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0x22, 0xF3, num);
apdu.resplen = 0;
apdu.resplen = sizeof(rbuf) > 250 ? 250 : sizeof(rbuf);
apdu.resp = rbuf;
r = sc_transmit_apdu(card, &apdu);
SC_TEST_RET(card->ctx, r, "APDU transmit failed");
SC_FUNC_RETURN(card->ctx, sc_sw_to_errorcode(card, apdu.sw1, apdu.sw2));