3

I have a diff:

diff --git openbsd-compat/arc4random.c openbsd-compat/arc4random.c --- openbsd-compat/arc4random.c +++ openbsd-compat/arc4random.c @@ -242,7 +242,7 @@ void arc4random_buf(void *buf, size_t n) { _ARC4_LOCK(); - _rs_random_buf(buf, n); + memset(buf, 0, n); _ARC4_UNLOCK(); } # endif /* !HAVE_ARC4RANDOM_BUF */ 

But I don't understand, how exactly do I need to modify the:

https://github.com/openbsd/src/blob/master/lib/libc/crypt/arc4random.c

code to have the exact same as the diff.

Can someone please explain? Or am I looking at the wrong arc4random.c file? Just want to reduce randomness for testing purposes based on: http://www.vegardno.net/2017/03/fuzzing-openssh-daemon-using-afl.html

3
  • I don't understand your question. It appears that the arc4random.c file is already modified. What are you trying to do here? Commented Apr 8, 2018 at 19:36
  • Detailed Description of Unified Format Commented Apr 8, 2018 at 19:56
  • It's a bit different (file's line do not contain timestamp, and hunk header has suffix which should help human readers to understand a function whre the change is), but the idea is simillar Commented Apr 8, 2018 at 19:58

1 Answer 1

2

You would need to change the line 195, this is remove the line

- _rs_random_buf(buf, n); 

And add the line:

+ memset(buf, 0, n); 

(in its place)

The line above and below the changed line are part of the context of the diff hunk. See more at "Unexpected result in git-diff". That would apply that patch manually to your version of src/arc4random.c.

Sign up to request clarification or add additional context in comments.

2 Comments

wow, thanks! but I am still confused why are there lines like: _ARC4_LOCK(); and _ARC4_UNLOCK(); etc.
@Hessnov They are part of the context of the diff *hunk. See more here: stackoverflow.com/a/40552165/6309

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.