summaryrefslogtreecommitdiff
path: root/dev-libs/libressl/files/libressl-2.8.3-solaris10.patch
blob: 20a0af0800bdec8e320c28802032b253a8ea52b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From libressl  Thu Jul 21 09:25:08 2016
From: schily () schily ! net (Joerg Schilling)
Date: Thu, 21 Jul 2016 09:25:08 +0000
To: libressl
Subject: Non-portable code in ./crypto/compat/getentropy_solaris.c
Message-Id: <579094f4.Ca9M384ri4oiBOIa%schily () schily ! net>
X-MARC-Message: https://marc.info/?l=libressl&m=146910737815443

Hi,

the code works only on Solaris based on OpenSolaris-ON from February 18 2010 or 
later.

Many people however still use Solaris 10.

BTW: there is an official portable ELF way based on the AUX vector to do the same 
but this was unfortunately not made a public libc interface, so it would need to 
be incorporated into your code:

https://sourceforge.net/p/schillix-on/schillix-on/ci/default/tree/usr/src/lib/libc/port/gen/getauxv.c

___getauxptr(AT_PHDR)	returns the address of &phdr[0]
___getauxval(AT_PHENT)	returns sizeof(phdr[0])
___getauxval(AT_PHNUM)	returns # phdr entries


Here is a patch to disable the non-portable code getting the code to compile at 
all:



--- a/crypto/compat/getentropy_solaris.c
+++ b/crypto/compat/getentropy_solaris.c
@@ -72,7 +72,9 @@
 static int getentropy_urandom(void *buf, size_t len, const char *path,
     int devfscheck);
 static int getentropy_fallback(void *buf, size_t len);
+#ifdef	ElfW
 static int getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data);
+#endif
 
 int
 getentropy(void *buf, size_t len)
@@ -244,6 +246,7 @@
 #endif
 };
 
+#ifdef	ElfW
 static int
 getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
 {
@@ -252,6 +255,7 @@
 	SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr));
 	return (0);
 }
+#endif
 
 static int
 getentropy_fallback(void *buf, size_t len)
@@ -290,7 +294,9 @@
 				cnt += (int)tv.tv_usec;
 			}
 
+#ifdef	ElfW
 			dl_iterate_phdr(getentropy_phdr, &ctx);
+#endif
 
 			for (ii = 0; ii < sizeof(cl)/sizeof(cl[0]); ii++)
 				HX(clock_gettime(cl[ii], &ts) == -1, ts);