Skip to content

Commit

Permalink
fixed aes-128-cbs
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Aug 11, 2024
1 parent fb039b5 commit 5377fda
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
14 changes: 11 additions & 3 deletions hcxpmktool.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,23 @@ if(memcmp(wpa2, hashlinestring, 7) == 0)
if(flen != 6) return false;
plen += flen *2;
if(hashlinestring[plen++] != '*') return false;
essidlen = hex2bin(&hashlinestring[plen], essid, 34);
flen = getfieldlen(&hashlinestring[plen], 34);
if((flen %2) != 0) return false;
flen /= 2;
if((flen <= 0) || (flen > 32)) return false;
essidlen = hex2bin(&hashlinestring[plen], essid, flen);
if((essidlen <= 0) || (essidlen > 32)) return false;
plen += essidlen *2;
if(hashlinestring[plen++] != '*') return false;
flen = hex2bin(&hashlinestring[plen], anonce, 32);
if(flen == -1) return false;
plen += flen *2;
if(hashlinestring[plen++] != '*') return false;
eapollen = hex2bin(&hashlinestring[plen], eapol, 1024);
flen = getfieldlen(&hashlinestring[plen], 1024);
if((flen %2) != 0) return false;
flen /= 2;
if((flen <= 0) || (flen > 1024)) return false;
eapollen = hex2bin(&hashlinestring[plen], eapol, flen);
eapptr = (eapauth_t*)eapol;
eapauthlen = ntohs(eapptr->len);
if(eapollen < eapauthlen +4) return false;
Expand Down Expand Up @@ -412,7 +420,7 @@ char sha256[] = "sha256";
paramssha256[0] = OSSL_PARAM_construct_utf8_string("digest", sha256, 0);
paramssha256[1] = OSSL_PARAM_construct_end();

char aes[] = "aes-1280-cbc";
char aes[] = "aes-128-cbc";
paramsaes128[0] = OSSL_PARAM_construct_utf8_string("cipher", aes, 0);
paramsaes128[1] = OSSL_PARAM_construct_end();

Expand Down
11 changes: 11 additions & 0 deletions include/strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ for(i = 0; i < len; i++)
return true;
}
/*===========================================================================*/
size_t getfieldlen(const char *str, size_t len)
{
size_t i;

for(i = 0; i < len; i++)
{
if(str[i] == '*') return i;
}
return -1;
}
/*===========================================================================*/
bool ishexvalue(const char *str, size_t len)
{
size_t i;
Expand Down

0 comments on commit 5377fda

Please sign in to comment.