Deleted Added
full compact
entropy.c (126274) entropy.c (149749)
1/*
2 * Copyright (c) 2001 Damien Miller. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 31 unchanged lines hidden (view full) ---

40 * /dev/random), then we execute a "ssh-rand-helper" program which
41 * collects entropy and writes it to stdout. The child program must
42 * write at least RANDOM_SEED_SIZE bytes. The child is run with stderr
43 * attached, so error/debugging output should be visible.
44 *
45 * XXX: we should tell the child how many bytes we need.
46 */
47
1/*
2 * Copyright (c) 2001 Damien Miller. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 31 unchanged lines hidden (view full) ---

40 * /dev/random), then we execute a "ssh-rand-helper" program which
41 * collects entropy and writes it to stdout. The child program must
42 * write at least RANDOM_SEED_SIZE bytes. The child is run with stderr
43 * attached, so error/debugging output should be visible.
44 *
45 * XXX: we should tell the child how many bytes we need.
46 */
47
48RCSID("$Id: entropy.c,v 1.48 2003/11/21 12:56:47 djm Exp $");
48RCSID("$Id: entropy.c,v 1.49 2005/07/17 07:26:44 djm Exp $");
49
50#ifndef OPENSSL_PRNG_ONLY
51#define RANDOM_SEED_SIZE 48
52static uid_t original_uid, original_euid;
53#endif
54
55void
56seed_rng(void)

--- 52 unchanged lines hidden (view full) ---

109 fatal("Couldn't read from ssh-rand-helper: %s",
110 strerror(errno));
111 if (ret != sizeof(buf))
112 fatal("ssh-rand-helper child produced insufficient data");
113
114 close(p[0]);
115
116 if (waitpid(pid, &ret, 0) == -1)
49
50#ifndef OPENSSL_PRNG_ONLY
51#define RANDOM_SEED_SIZE 48
52static uid_t original_uid, original_euid;
53#endif
54
55void
56seed_rng(void)

--- 52 unchanged lines hidden (view full) ---

109 fatal("Couldn't read from ssh-rand-helper: %s",
110 strerror(errno));
111 if (ret != sizeof(buf))
112 fatal("ssh-rand-helper child produced insufficient data");
113
114 close(p[0]);
115
116 if (waitpid(pid, &ret, 0) == -1)
117 fatal("Couldn't wait for ssh-rand-helper completion: %s",
118 strerror(errno));
117 fatal("Couldn't wait for ssh-rand-helper completion: %s",
118 strerror(errno));
119 signal(SIGCHLD, old_sigchld);
120
121 /* We don't mind if the child exits upon a SIGPIPE */
122 if (!WIFEXITED(ret) &&
123 (!WIFSIGNALED(ret) || WTERMSIG(ret) != SIGPIPE))
124 fatal("ssh-rand-helper terminated abnormally");
125 if (WEXITSTATUS(ret) != 0)
126 fatal("ssh-rand-helper exit with exit status %d", ret);

--- 28 unchanged lines hidden ---
119 signal(SIGCHLD, old_sigchld);
120
121 /* We don't mind if the child exits upon a SIGPIPE */
122 if (!WIFEXITED(ret) &&
123 (!WIFSIGNALED(ret) || WTERMSIG(ret) != SIGPIPE))
124 fatal("ssh-rand-helper terminated abnormally");
125 if (WEXITSTATUS(ret) != 0)
126 fatal("ssh-rand-helper exit with exit status %d", ret);

--- 28 unchanged lines hidden ---