diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-08-14 20:43:11 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-08-14 20:43:11 +0000 |
commit | 190bccfd2168f565f10c3f668829388ad07935ec (patch) | |
tree | 89efcdc499078fa6da4613886912d0428ea7bc59 /distrib/crunch | |
parent | 132a0e7b03bc5484c352e1dc29924931af16e2ea (diff) |
On mips systems, use arc4random() instead of time(NULL) and rand() as a random
source, and thus don't stupidly sleep(1) every time to get a different value
from time().
ok deraadt@
Diffstat (limited to 'distrib/crunch')
-rw-r--r-- | distrib/crunch/crunchide/elf_hide.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/distrib/crunch/crunchide/elf_hide.c b/distrib/crunch/crunchide/elf_hide.c index 65918e618af..a63702bd13a 100644 --- a/distrib/crunch/crunchide/elf_hide.c +++ b/distrib/crunch/crunchide/elf_hide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elf_hide.c,v 1.11 2007/08/07 05:42:05 ray Exp $ */ +/* $OpenBSD: elf_hide.c,v 1.12 2007/08/14 20:43:10 miod Exp $ */ /* * Copyright (c) 1997 Dale Rahn. @@ -303,9 +303,7 @@ hide_sym(Elf_Ehdr * ehdr, Elf_Shdr * symsect, Elf_Sym *psymtab; #ifdef __mips__ - int f; - sleep(1); - f = time(NULL) * 200; + u_int32_t f = arc4random(); #endif for (i = 0; i < (symtabsize / sizeof(Elf_Sym)); i++) { @@ -327,25 +325,17 @@ hide_sym(Elf_Ehdr * ehdr, Elf_Shdr * symsect, #else /* * XXX This is a small ugly hack to be able to use - * chrunchide with MIPS. - */ - /* + * XXX chrunchide with MIPS. * XXX Because MIPS needs global symbols to stay - * global (has to do with GOT) - */ - /* - * XXX we mess around with the symbol names instead. - * For most uses this - */ - /* - * XXX will be no problem, symbols are stripped - * anyway. However, if many - */ - /* XXX one character symbols exist, names may clash. + * XXX global (has to do with GOT), we mess around + * XXX with the symbol names instead. For most uses + * XXX this will be no problem, symbols are stripped + * XXX anyway. However, if many one character + * XXX symbols exist, names may clash. */ { - char *p; - int n, z; + char *p; + u_int32_t n, z; z = f++; p = get_str(psymtab->st_name); @@ -356,7 +346,7 @@ hide_sym(Elf_Ehdr * ehdr, Elf_Shdr * symsect, p[n] = z; z >>= 8; while (p[n] == 0) - p[n] += rand(); + p[n] += arc4random(); } } |