Skip to content

Commit

Permalink
ubifs: Make r5 hash binary string aware
Browse files Browse the repository at this point in the history
As of now all filenames known by UBIFS are strings with a NUL
terminator. With encrypted filenames a filename can be any binary
string and the r5 function cannot search for the NUL terminator.
UBIFS always knows how long a filename is, therefore we can change
the hash function to iterate over the filename length to work
correctly with binary strings.

Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
richardweinberger committed Dec 12, 2016
1 parent 304790c commit b9bc8c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ubifs/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static inline uint32_t key_r5_hash(const char *s, int len)
uint32_t a = 0;
const signed char *str = (const signed char *)s;

while (*str) {
while (len--) {
a += *str << 4;
a += *str >> 4;
a *= 11;
Expand Down

0 comments on commit b9bc8c7

Please sign in to comment.