2 * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include <openssl/rand.h>
13 #if defined(OPENSSL_SYS_VMS)
20 # pragma message disable DOLLARID
24 * Use 32-bit pointers almost everywhere. Define the type to which to cast a
25 * pointer passed to an external function.
27 # if __INITIAL_POINTER_SIZE == 64
28 # define PTR_T __void_ptr64
29 # pragma pointer_size save
30 # pragma pointer_size 32
31 # else /* __INITIAL_POINTER_SIZE == 64 */
33 # endif /* __INITIAL_POINTER_SIZE == 64 [else] */
35 static struct items_data_st {
36 short length, code; /* length is amount of bytes */
73 unsigned char data_buffer[256];
74 short total_length = 0;
75 struct items_data_st *pitems_data;
77 pitems_data = items_data;
81 while (pitems_data->length && (total_length + pitems_data->length <= 256)) {
82 pitem->length = pitems_data->length;
83 pitem->code = pitems_data->code;
84 pitem->buffer = (long *)&data_buffer[total_length];
86 total_length += pitems_data->length;
90 pitem->length = pitem->code = 0;
93 * Scan through all the processes in the system and add entropy with
94 * results from the processes that were possible to look at.
95 * However, view the information as only half trustable.
97 pid = -1; /* search context */
98 while ((status = sys$getjpiw(0, &pid, 0, item, iosb, 0, 0))
100 if (status == SS$_NORMAL) {
101 RAND_add((PTR_T) data_buffer, total_length, total_length / 2);
105 RAND_add((PTR_T) iosb, sizeof(iosb), sizeof(iosb) / 2);