Implementation of card_ctl function with SC_CARDCTL_GET_SERIALNR

Implementation of card_ctl function with SC_CARDCTL_GET_SERIALNR
Il 07/11/2014 12:03, Frank Morgner ha scritto:
>> +	if (r != SC_SUCCESS) {
>> +		return SC_ERROR_WRONG_CARD;
>> +	}
>> +	len = file->size;
>> +
>> +	//Returned file->size should be 16. 
>> +	//We choose to not consider it as critical, because some cards 
>> +	//do not return FCI/FCP templates that include the file size.
>> +	//Notify abnormal lenght anyway.
>> +	if (len != 16) {
>> +		sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, 
>> +				"Unexpected file length of EF_IDCarta (%lu)\n",
>> +				(unsigned long) len);
>> +	}
>> +
>> +	sc_read_binary(card, 0, rbuf, 256, 0);
> 
> `sc_read_binary` returns the number of bytes read. You should check for it to be at least 16.

Yes, of course ... my mistake. Currently checking for exactly 16, tested
with 3 kinds of cns actually.

Thanks,
rob