Skip to content
Permalink
Browse files Browse the repository at this point in the history
wo#7449 . verify padding contents for IKEv2 RSA sig check
Special thanks to Sze Yiu Chau of Purdue University (schau@purdue.edu)
who reported the issue.
  • Loading branch information
bartman committed Aug 22, 2018
1 parent d28ef9e commit 9eaa6c2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/liboswkeys/signatures.c
Expand Up @@ -157,8 +157,21 @@ err_t verify_signed_hash(const struct RSA_public_key *k
return "3""SIG padding does not check out";
}

s += padlen + 3;
(*psig) = s;
/* signature starts after ASN wrapped padding [00,01,FF..FF,00] */
(*psig) = s + padlen + 3;

/* verify padding contents */
{
const u_char *p;
size_t cnt_ffs = 0;

for (p = s+2; p < s+padlen+2; p++)
if (*p == 0xFF)
cnt_ffs ++;

if (cnt_ffs != padlen)
return "4" "invalid Padding String";
}

/* return SUCCESS */
return NULL;
Expand Down

0 comments on commit 9eaa6c2

Please sign in to comment.