Skip to content

Commit

Permalink
Fix cases of -Wunused in CcidLocalAccess.c
Browse files Browse the repository at this point in the history
This includes a missing return, which fixes Nitrokey#9
  • Loading branch information
FlorianUekermann committed Jul 30, 2016
1 parent f9ea48d commit 29f17bf
Showing 1 changed file with 6 additions and 49 deletions.
55 changes: 6 additions & 49 deletions src/ccid/CcidLocalAccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,24 +634,18 @@ int CcidAesDec (int nSendLength, unsigned char* cSendData, int nReceiveLength, u

u32 getRandomNumber (u32 Size_u32, u8 * Data_pu8)
{
u32 Ret_u32;

u32 i;

time_t now;

static u8 FlasgTimeIsSet_u8 = FALSE;

// Size ok ?
if (APDU_MAX_RESPONSE_LEN <= Size_u32)
{
return (FALSE);
}

// Get a random number from smartcard
Ret_u32 = CcidGetChallenge (Size_u32, Data_pu8);
// TODO: COMMENT FROM FLORIAN: IGNORE RETURN VALUE?
CcidGetChallenge (Size_u32, Data_pu8);

#ifdef GENERATE_RANDOM_NUMBER_WITH_2ND_SOURCE
// TODO: COMMENT FROM FLORIAN: DOES THIS ACTUALLY ADD ENTROPY?
// Paranoia: if the random number is not really random, xor it with
// another random number from a second source
if (FALSE == FlasgTimeIsSet_u8)
Expand Down Expand Up @@ -879,40 +873,15 @@ int getAID (void)

InitSCTStruct (&tSCT);

unsigned short cRet;

unsigned char nReturnSize;

CcidSelectOpenPGPApp ();
cRet = CcidGetData (0x00, 0x4F, &nReturnSize);
// TODO: COMMENT FROM FLORIAN: IGNORE RETURN VALUE?
CcidGetData (0x00, 0x4F, &nReturnSize);

return nReturnSize;
}

uint32_t getSerialNumber (void)
{

uint32_t serial;

uint8_t buffer[4];

InitSCTStruct (&tSCT);

unsigned short cRet;

unsigned char nReturnSize;

CcidSelectOpenPGPApp ();
cRet = CcidGetData (0x00, 0x4F, &nReturnSize);



return 0;


}


uint8_t getByteOfData (uint8_t x)
{

Expand All @@ -926,8 +895,6 @@ uint8_t cardAuthenticate (uint8_t * password)

unsigned short cRet;

unsigned char nReturnSize;

CcidSelectOpenPGPApp ();
cRet = CcidVerifyPin (3, password);

Expand All @@ -946,8 +913,6 @@ uint8_t userAuthenticate (uint8_t * password)

unsigned short cRet;

unsigned char nReturnSize;

CcidSelectOpenPGPApp ();
cRet = CcidVerifyPin (1, password);

Expand Down Expand Up @@ -1006,8 +971,6 @@ uint8_t changeUserPin (uint8_t * password, uint8_t * new_password)

unsigned short cRet;

unsigned char nReturnSize;

CcidSelectOpenPGPApp ();
cRet = CcidChangePin (1, password, new_password);

Expand All @@ -1026,8 +989,6 @@ uint8_t changeAdminPin (uint8_t * password, uint8_t * new_password)

unsigned short cRet;

unsigned char nReturnSize;

CcidSelectOpenPGPApp ();
cRet = CcidChangePin (3, password, new_password);

Expand Down Expand Up @@ -1174,7 +1135,7 @@ unsigned char acBufferOut[32];
memset (pcKey, 0, nLen);
return FALSE;
default:
nRet;
return nRet;
}
/*
if (APDU_ANSWER_COMMAND_CORRECT == nRet) { //CI_LocalPrintf ("Decrypted AES key : "); //HexPrint (nLen,acBufferOut); //CI_LocalPrintf
Expand All @@ -1187,10 +1148,6 @@ uint8_t testSendUserPW2 (unsigned char* pcPW)
{
unsigned short nRet;

int n;

n = strlen ((char *) pcPW);

// CI_LocalPrintf ("Send user password : ");
nRet = CcidVerifyPin (2, pcPW);
if (APDU_ANSWER_COMMAND_CORRECT == nRet)
Expand Down

0 comments on commit 29f17bf

Please sign in to comment.