Skip to content

Commit 854a362

Browse files
committed
Replace WMEMCMP in CheckAuthKeysLine
1 parent aaf3e55 commit 854a362

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/wolfsshd/auth.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ static int CheckAuthKeysLine(char* line, word32 lineSz, const byte* key,
229229
}
230230
}
231231
if (ret == WSSHD_AUTH_SUCCESS) {
232-
if (keyCandSz != keySz || WMEMCMP(key, keyCand, keySz) != 0) {
232+
/* Constant-time compare to avoid leaking which prefix bytes of an
233+
* authorized key match a candidate offered by a remote peer. */
234+
if (keyCandSz != keySz ||
235+
ConstantCompare(key, keyCand, keySz) != 0) {
233236
ret = WSSHD_AUTH_FAILURE;
234237
}
235238
}

0 commit comments

Comments
 (0)