fixed warnings about possible data loss

This commit is contained in:
Frank Morgner 2015-09-13 14:18:34 +02:00
parent f261426303
commit fb9dfc5b71
2 changed files with 7 additions and 7 deletions

View File

@ -1127,10 +1127,10 @@ static int flex_generate_key(sc_card_t *card, struct sc_cardctl_cryptoflex_genke
apdu.lc = 4;
/* Little endian representation of exponent */
sbuf[0] = data->exponent;
sbuf[1] = data->exponent >> 8;
sbuf[2] = data->exponent >> 16;
sbuf[3] = data->exponent >> 24;
sbuf[0] = data->exponent & 0xFF;
sbuf[1] = (data->exponent >> 8) & 0xFF;
sbuf[2] = (data->exponent >> 16) & 0xFF;
sbuf[3] = (data->exponent >> 24) & 0xFF;
r = sc_transmit_apdu(card, &apdu);
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");

View File

@ -500,8 +500,8 @@ static int get_se_num_from_keyd(sc_card_t * card, unsigned short fid,
char dbgbuf[2048];
u8 fidbuf[2];
fidbuf[0] = fid >> 8;
fidbuf[1] = fid;
fidbuf[0] = (fid >> 8) & 0xFF;
fidbuf[1] = fid & 0xFF;
dfi = get_df_info(card);
if (!dfi || !dfi->keyd_file) {
@ -1271,7 +1271,7 @@ static int mcrd_set_security_env(sc_card_t * card,
if (card->type == SC_CARD_TYPE_MCRD_DTRUST
|| card->type == SC_CARD_TYPE_MCRD_GENERIC) {
unsigned short fid;
unsigned char fid;
fid = env->key_ref[0];
*p = fid;