$OpenBSD: patch-pith_smime_c,v 1.2 2015/01/27 13:38:05 ajacoutot Exp $

Remove never used RAND_egd code paths; needed to compile with gcc3 (gcc4
will optimize this out by itself)

--- pith/smime.c.orig	Mon Jan 12 06:12:25 2015
+++ pith/smime.c	Tue Jan 27 08:58:55 2015
@@ -48,9 +48,9 @@ static char rcsid[] = "$Id: smime.c 1176 2008-09-29 21
 
 /* internal prototypes */
 static void            forget_private_keys(void);
-static int             app_RAND_load_file(const char *file);
+static int             app_RAND_load_file(void);
 static void            openssl_extra_randomness(void);
-static int             app_RAND_write_file(const char *file);
+static int             app_RAND_write_file(void);
 static const char     *openssl_error_string(void);
 static int             load_private_key(PERSONAL_CERT *pcert);
 static void            create_local_cache(char *h, char *base, BODY *b, int type);
@@ -90,7 +90,6 @@ static X509_STORE   *s_cert_store;
 
 /* State management for randomness functions below */
 static int seeded = 0;
-static int egdsocket = 0;
 
 void *
 create_smime_sparep(SpareType stype, void *s)
@@ -809,18 +808,12 @@ int smime_path(char *rpath, char *fpath, size_t len)
  * taken from openssl/apps/app_rand.c
  */
 static int
-app_RAND_load_file(const char *file)
+app_RAND_load_file()
 {
     char buffer[200];
+    const char *file;
 
-    if(file == NULL)
-      file = RAND_file_name(buffer, sizeof buffer);
-    else if(RAND_egd(file) > 0){
-	/* we try if the given filename is an EGD socket.
-	   if it is, we don't write anything back to the file. */
-	egdsocket = 1;
-	return 1;
-    }
+    file = RAND_file_name(buffer, sizeof buffer);
 
     if(file == NULL || !RAND_load_file(file, -1)){
 	if(RAND_status() == 0){
@@ -880,11 +873,12 @@ openssl_extra_randomness(void)
 
 /* taken from openssl/apps/app_rand.c */
 static int
-app_RAND_write_file(const char *file)
+app_RAND_write_file()
 {
     char buffer[200];
+    const char *file;
 
-    if(egdsocket || !seeded)
+    if(!seeded)
 	/*
 	 * If we did not manage to read the seed file,
 	 * we should not write a low-entropy seed file back --
@@ -893,8 +887,7 @@ app_RAND_write_file(const char *file)
 	 */
 	return 0;
 
-    if(file == NULL)
-      file = RAND_file_name(buffer, sizeof buffer);
+    file = RAND_file_name(buffer, sizeof buffer);
 
     if(file == NULL || !RAND_write_file(file)){
 	dprint((1, "unable to write 'random state'\n"));
@@ -992,7 +985,7 @@ void
 smime_deinit(void)
 {
     dprint((9, "smime_deinit()"));
-    app_RAND_write_file(NULL);
+    app_RAND_write_file();
     free_smime_struct(&ps_global->smime);
 }
 
@@ -1024,7 +1017,7 @@ smime_init(void)
         OpenSSL_add_all_algorithms();
         ERR_load_crypto_strings();
 
-	app_RAND_load_file(NULL);
+	app_RAND_load_file();
     	openssl_extra_randomness();
 	ps_global->smime->inited = 1;
     }
