Deleted Added
sdiff udiff text old ( 149749 ) new ( 157016 )
full compact
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.

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

21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25#include "includes.h"
26
27#include <openssl/rand.h>
28#include <openssl/crypto.h>
29
30#include "ssh.h"
31#include "misc.h"
32#include "xmalloc.h"
33#include "atomicio.h"
34#include "pathnames.h"
35#include "log.h"
36
37/*
38 * Portable OpenSSH PRNG seeding:
39 * If OpenSSL has not "internally seeded" itself (e.g. pulled data from
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.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)

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

140 * OpenSSL version numbers: MNNFFPPS: major minor fix patch status
141 * We match major, minor, fix and status (not patch)
142 */
143 if ((SSLeay() ^ OPENSSL_VERSION_NUMBER) & ~0xff0L)
144 fatal("OpenSSL version mismatch. Built against %lx, you "
145 "have %lx", OPENSSL_VERSION_NUMBER, SSLeay());
146
147#ifndef OPENSSL_PRNG_ONLY
148 if ((original_uid = getuid()) == -1)
149 fatal("getuid: %s", strerror(errno));
150 if ((original_euid = geteuid()) == -1)
151 fatal("geteuid: %s", strerror(errno));
152#endif
153}
154