Skip to content

Commit

Permalink
COMPAT. LAYER : fix missing return value and alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Nov 8, 2016
1 parent f7a9517 commit 4a677f7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5653,6 +5653,7 @@ int wolfSSL_get_client_random(WOLFSSL* ssl, unsigned char* out, int outSz)

if (ssl->options.saveArrays == 0 || ssl->arrays == NULL) {
WOLFSSL_MSG("Arrays struct not saved after handshake");
return BAD_FUNC_ARG;
}

if (outSz > RAN_LEN) {
Expand Down Expand Up @@ -13324,12 +13325,12 @@ void wolfSSL_DES_set_key(WOLFSSL_const_DES_cblock* myDes,
/* return true in fail case (1) */
static int DES_check(word32 mask, word32 mask2, unsigned char* key)
{
if ((*(word32*)(key + 0) ^ mask) == 0) {
if ((*(word32*)(key + 4) ^ mask2) == 0) {
return 1;
}
}
return 0;
word32 value[2];

/* sanity check on length made in wolfSSL_DES_set_key_checked */
value[0] = mask;
value[1] = mask2;
return (XMEMCMP(value, key, sizeof(value)) == 0)? 1: 0;
}


Expand All @@ -13343,6 +13344,12 @@ void wolfSSL_DES_set_key_checked(WOLFSSL_const_DES_cblock* myDes,
else {
word32 i, mask, mask2;

/* sanity check before call to DES_check */
if (sizeof(WOLFSSL_DES_key_schedule) != (sizeof(word32) * 2)) {
WOLFSSL_MSG("Unexpected WOLFSSL_DES_key_schedule size");
return;
}

/* check odd parity */
for (i = 0; i < sizeof(WOLFSSL_DES_key_schedule); i++) {
unsigned char c = *((unsigned char*)key + i);
Expand Down

0 comments on commit 4a677f7

Please sign in to comment.