summaryrefslogtreecommitdiff
path: root/Cryptlib/OpenSSL/crypto/rand/rand_os2.c
diff options
context:
space:
mode:
authorGary Ching-Pang Lin <glin@suse.com>2015-05-12 13:51:02 -0400
committerPeter Jones <pjones@redhat.com>2015-05-12 13:51:02 -0400
commitf3653b08a475372a0849cd9a3387a5997ce121c9 (patch)
treea3149decea22d31dfe81cc7054f55d65fc45f46a /Cryptlib/OpenSSL/crypto/rand/rand_os2.c
parentf3af1acfec86794ae2d78f63cab100503bfc9a7b (diff)
downloadefi-boot-shim-f3653b08a475372a0849cd9a3387a5997ce121c9.tar.gz
efi-boot-shim-f3653b08a475372a0849cd9a3387a5997ce121c9.zip
Update Cryptlib and openssl
Update Cryptlib to r16559 and openssl to 0.9.8zf Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
Diffstat (limited to 'Cryptlib/OpenSSL/crypto/rand/rand_os2.c')
-rw-r--r--Cryptlib/OpenSSL/crypto/rand/rand_os2.c74
1 files changed, 44 insertions, 30 deletions
diff --git a/Cryptlib/OpenSSL/crypto/rand/rand_os2.c b/Cryptlib/OpenSSL/crypto/rand/rand_os2.c
index c3e36d4e..4de2115f 100644
--- a/Cryptlib/OpenSSL/crypto/rand/rand_os2.c
+++ b/Cryptlib/OpenSSL/crypto/rand/rand_os2.c
@@ -7,7 +7,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -59,27 +59,30 @@
#ifdef OPENSSL_SYS_OS2
-#define INCL_DOSPROCESS
-#define INCL_DOSPROFILE
-#define INCL_DOSMISC
-#define INCL_DOSMODULEMGR
-#include <os2.h>
+# define INCL_DOSPROCESS
+# define INCL_DOSPROFILE
+# define INCL_DOSMISC
+# define INCL_DOSMODULEMGR
+# include <os2.h>
-#define CMD_KI_RDCNT (0x63)
+# define CMD_KI_RDCNT (0x63)
typedef struct _CPUUTIL {
- ULONG ulTimeLow; /* Low 32 bits of time stamp */
- ULONG ulTimeHigh; /* High 32 bits of time stamp */
- ULONG ulIdleLow; /* Low 32 bits of idle time */
- ULONG ulIdleHigh; /* High 32 bits of idle time */
- ULONG ulBusyLow; /* Low 32 bits of busy time */
- ULONG ulBusyHigh; /* High 32 bits of busy time */
- ULONG ulIntrLow; /* Low 32 bits of interrupt time */
+ ULONG ulTimeLow; /* Low 32 bits of time stamp */
+ ULONG ulTimeHigh; /* High 32 bits of time stamp */
+ ULONG ulIdleLow; /* Low 32 bits of idle time */
+ ULONG ulIdleHigh; /* High 32 bits of idle time */
+ ULONG ulBusyLow; /* Low 32 bits of busy time */
+ ULONG ulBusyHigh; /* High 32 bits of busy time */
+ ULONG ulIntrLow; /* Low 32 bits of interrupt time */
ULONG ulIntrHigh; /* High 32 bits of interrupt time */
} CPUUTIL;
-APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL;
-APIRET APIENTRY(*DosQuerySysState) (ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL;
+APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1,
+ ULONG ulParm2, ULONG ulParm3) = NULL;
+APIRET APIENTRY(*DosQuerySysState) (ULONG func, ULONG arg1, ULONG pid,
+ ULONG _res_, PVOID buf, ULONG bufsz) =
+ NULL;
HMODULE hDoscalls = 0;
int RAND_poll(void)
@@ -89,15 +92,19 @@ int RAND_poll(void)
ULONG SysVars[QSV_FOREGROUND_PROCESS];
if (hDoscalls == 0) {
- ULONG rc = DosLoadModule(failed_module, sizeof(failed_module), "DOSCALLS", &hDoscalls);
+ ULONG rc =
+ DosLoadModule(failed_module, sizeof(failed_module), "DOSCALLS",
+ &hDoscalls);
if (rc == 0) {
- rc = DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall);
+ rc = DosQueryProcAddr(hDoscalls, 976, NULL,
+ (PFN *) & DosPerfSysCall);
if (rc)
DosPerfSysCall = NULL;
- rc = DosQueryProcAddr(hDoscalls, 368, NULL, (PFN *)&DosQuerySysState);
+ rc = DosQueryProcAddr(hDoscalls, 368, NULL,
+ (PFN *) & DosQuerySysState);
if (rc)
DosQuerySysState = NULL;
@@ -108,33 +115,40 @@ int RAND_poll(void)
DosTmrQueryTime(&qwTime);
RAND_add(&qwTime, sizeof(qwTime), 2);
- /* Sample a bunch of system variables, includes various process & memory statistics */
+ /*
+ * Sample a bunch of system variables, includes various process & memory
+ * statistics
+ */
DosQuerySysInfo(1, QSV_FOREGROUND_PROCESS, SysVars, sizeof(SysVars));
RAND_add(SysVars, sizeof(SysVars), 4);
- /* If available, sample CPU registers that count at CPU MHz
- * Only fairly new CPUs (PPro & K6 onwards) & OS/2 versions support this
+ /*
+ * If available, sample CPU registers that count at CPU MHz Only fairly
+ * new CPUs (PPro & K6 onwards) & OS/2 versions support this
*/
if (DosPerfSysCall) {
CPUUTIL util;
- if (DosPerfSysCall(CMD_KI_RDCNT, (ULONG)&util, 0, 0) == 0) {
+ if (DosPerfSysCall(CMD_KI_RDCNT, (ULONG) & util, 0, 0) == 0) {
RAND_add(&util, sizeof(util), 10);
- }
- else {
+ } else {
DosPerfSysCall = NULL;
}
}
- /* DosQuerySysState() gives us a huge quantity of process, thread, memory & handle stats */
+ /*
+ * DosQuerySysState() gives us a huge quantity of process, thread, memory
+ * & handle stats
+ */
if (DosQuerySysState) {
char *buffer = OPENSSL_malloc(256 * 1024);
if (DosQuerySysState(0x1F, 0, 0, 0, buffer, 256 * 1024) == 0) {
- /* First 4 bytes in buffer is a pointer to the thread count
- * there should be at least 1 byte of entropy per thread
+ /*
+ * First 4 bytes in buffer is a pointer to the thread count there
+ * should be at least 1 byte of entropy per thread
*/
- RAND_add(buffer, 256 * 1024, **(ULONG **)buffer);
+ RAND_add(buffer, 256 * 1024, **(ULONG **) buffer);
}
OPENSSL_free(buffer);
@@ -144,4 +158,4 @@ int RAND_poll(void)
return 0;
}
-#endif /* OPENSSL_SYS_OS2 */
+#endif /* OPENSSL_SYS_OS2 */