aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoey Yandle <dragon@dancingdragon.be>2016-01-12 11:53:16 -0800
committerRich Salz <rsalz@openssl.org>2016-05-29 13:36:59 -0400
commit888db7f224fec4ead34c32e82fa591dea61d14a2 (patch)
treef4064590762fa4a2212c0ac5992dd553f5bf87d0
parent4447d829de82ac2e26e2a8b3c8e2b248b09f5ac2 (diff)
downloadopenssl-888db7f224fec4ead34c32e82fa591dea61d14a2.tar.gz
cherry pick pr-512 changes
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1079)
-rw-r--r--apps/app_rand.c4
-rw-r--r--crypto/rand/rand_win.c95
-rw-r--r--doc/crypto/RAND_add.pod10
-rw-r--r--doc/crypto/rand.pod1
-rw-r--r--include/openssl/rand.h1
5 files changed, 1 insertions, 110 deletions
diff --git a/apps/app_rand.c b/apps/app_rand.c
index 8163d99edb..0d44af903b 100644
--- a/apps/app_rand.c
+++ b/apps/app_rand.c
@@ -19,10 +19,6 @@ int app_RAND_load_file(const char *file, int dont_warn)
int consider_randfile = (file == NULL);
char buffer[200];
-#ifdef OPENSSL_SYS_WINDOWS
- RAND_screen();
-#endif
-
if (file == NULL)
file = RAND_file_name(buffer, sizeof buffer);
#ifndef OPENSSL_NO_EGD
diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c
index 812ca9d2c8..facec53996 100644
--- a/crypto/rand/rand_win.c
+++ b/crypto/rand/rand_win.c
@@ -34,7 +34,6 @@
# define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider"
static void readtimer(void);
-static void readscreen(void);
/*
* It appears like CURSORINFO, PCURSORINFO and LPCURSORINFO are only defined
@@ -135,13 +134,6 @@ int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam)
return (RAND_status());
}
-void RAND_screen(void)
-{ /* function available for backward
- * compatibility */
- RAND_poll();
- readscreen();
-}
-
/* feed timing information to the PRNG */
static void readtimer(void)
{
@@ -179,91 +171,4 @@ static void readtimer(void)
}
}
-/* feed screen contents to PRNG */
-/*****************************************************************************
- *
- * Created 960901 by Gertjan van Oosten, gertjan@West.NL, West Consulting B.V.
- *
- * Code adapted from
- * <URL:http://support.microsoft.com/default.aspx?scid=kb;[LN];97193>;
- * the original copyright message is:
- *
- * (C) Copyright Microsoft Corp. 1993. All rights reserved.
- *
- * You have a royalty-free right to use, modify, reproduce and
- * distribute the Sample Files (and/or any modified version) in
- * any way you find useful, provided that you agree that
- * Microsoft has no warranty obligations or liability for any
- * Sample Application Files which are modified.
- */
-
-static void readscreen(void)
-{
-# if !defined(OPENSSL_SYS_WIN32_CYGWIN)
- HDC hScrDC; /* screen DC */
- HBITMAP hBitmap; /* handle for our bitmap */
- BITMAP bm; /* bitmap properties */
- unsigned int size; /* size of bitmap */
- char *bmbits; /* contents of bitmap */
- int w; /* screen width */
- int h; /* screen height */
- int y; /* y-coordinate of screen lines to grab */
- int n = 16; /* number of screen lines to grab at a time */
- BITMAPINFOHEADER bi; /* info about the bitmap */
-
- if (check_winnt() && OPENSSL_isservice() > 0)
- return;
-
- /* Get a reference to the screen DC */
- hScrDC = GetDC(NULL);
-
- /* Get screen resolution */
- w = GetDeviceCaps(hScrDC, HORZRES);
- h = GetDeviceCaps(hScrDC, VERTRES);
-
- /* Create a bitmap compatible with the screen DC */
- hBitmap = CreateCompatibleBitmap(hScrDC, w, n);
-
- /* Get bitmap properties */
- GetObject(hBitmap, sizeof(BITMAP), (LPSTR) & bm);
- size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;
-
- bi.biSize = sizeof(BITMAPINFOHEADER);
- bi.biWidth = bm.bmWidth;
- bi.biHeight = bm.bmHeight;
- bi.biPlanes = bm.bmPlanes;
- bi.biBitCount = bm.bmBitsPixel;
- bi.biCompression = BI_RGB;
- bi.biSizeImage = 0;
- bi.biXPelsPerMeter = 0;
- bi.biYPelsPerMeter = 0;
- bi.biClrUsed = 0;
- bi.biClrImportant = 0;
-
- bmbits = OPENSSL_malloc(size);
- if (bmbits != NULL) {
- /* Now go through the whole screen, repeatedly grabbing n lines */
- for (y = 0; y < h - n; y += n) {
- unsigned char md[MD_DIGEST_LENGTH];
-
- /* Copy the bits of the current line range into the buffer */
- GetDIBits(hScrDC, hBitmap, y, n,
- bmbits, (BITMAPINFO *) & bi, DIB_RGB_COLORS);
-
- /* Get the hash of the bitmap */
- MD(bmbits, size, md);
-
- /* Seed the random generator with the hash value */
- RAND_add(md, MD_DIGEST_LENGTH, 0);
- }
-
- OPENSSL_free(bmbits);
- }
-
- /* Clean up */
- DeleteObject(hBitmap);
- ReleaseDC(NULL, hScrDC);
-# endif /* !OPENSSL_SYS_WIN32_CYGWIN */
-}
-
#endif
diff --git a/doc/crypto/RAND_add.pod b/doc/crypto/RAND_add.pod
index 9561c2aae1..b2ffcb6197 100644
--- a/doc/crypto/RAND_add.pod
+++ b/doc/crypto/RAND_add.pod
@@ -2,7 +2,7 @@
=head1 NAME
-RAND_add, RAND_seed, RAND_status, RAND_event, RAND_screen - add
+RAND_add, RAND_seed, RAND_status, RAND_event - add
entropy to the PRNG
=head1 SYNOPSIS
@@ -16,7 +16,6 @@ entropy to the PRNG
int RAND_status(void);
int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);
- void RAND_screen(void);
=head1 DESCRIPTION
@@ -49,13 +48,6 @@ the window procedure. It will estimate the entropy contained in the
event message (if any), and add it to the PRNG. The program can then
process the messages as usual.
-The RAND_screen() function is available for the convenience of Windows
-programmers. It adds the current contents of the screen to the PRNG.
-For applications that can catch Windows events, seeding the PRNG by
-calling RAND_event() is a significantly better source of
-randomness. It should be noted that both methods cannot be used on
-servers that run without user interaction.
-
=head1 RETURN VALUES
RAND_status() and RAND_event() return 1 if the PRNG has been seeded
diff --git a/doc/crypto/rand.pod b/doc/crypto/rand.pod
index 45a6d6bb2d..9e3a5a052b 100644
--- a/doc/crypto/rand.pod
+++ b/doc/crypto/rand.pod
@@ -28,7 +28,6 @@ rand - pseudo-random number generator
RAND_METHOD *RAND_OpenSSL(void);
/* For Win32 only */
- void RAND_screen(void);
int RAND_event(UINT, WPARAM, LPARAM);
Deprecated:
diff --git a/include/openssl/rand.h b/include/openssl/rand.h
index 679cf09646..8b0188d74a 100644
--- a/include/openssl/rand.h
+++ b/include/openssl/rand.h
@@ -67,7 +67,6 @@ int RAND_poll(void);
# if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
-void RAND_screen(void);
int RAND_event(UINT, WPARAM, LPARAM);
# endif