Changeset 94082 in vbox for trunk/src/libs/openssl-3.0.1/crypto/rand/rand_egd.c
- Timestamp:
- Mar 3, 2022 7:17:34 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 150325
- Location:
- trunk/src/libs/openssl-3.0.1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/openssl-3.0.1
- Property svn:mergeinfo
-
old new 12 12 /vendor/openssl/1.1.1c:131722-131725 13 13 /vendor/openssl/1.1.1k:145841-145843 14 /vendor/openssl/3.0.1:150323-150324 15 /vendor/openssl/current:147554-150322
-
- Property svn:mergeinfo
-
trunk/src/libs/openssl-3.0.1/crypto/rand/rand_egd.c
r91772 r94082 1 1 /* 2 * Copyright 2000-20 18The OpenSSL Project Authors. All Rights Reserved.3 * 4 * Licensed under the OpenSSL license(the "License"). You may not use2 * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. 3 * 4 * Licensed under the Apache License 2.0 (the "License"). You may not use 5 5 * this file except in compliance with the License. You can obtain a copy 6 6 * in the file LICENSE in the source distribution or at … … 9 9 10 10 #include <openssl/opensslconf.h> 11 #ifdef OPENSSL_NO_EGD 12 NON_EMPTY_TRANSLATION_UNIT 13 #else 14 15 # include <openssl/crypto.h> 16 # include <openssl/e_os2.h> 17 # include <openssl/rand.h> 11 12 #include <openssl/crypto.h> 13 #include <openssl/e_os2.h> 14 #include <openssl/rand.h> 18 15 19 16 /* … … 21 18 */ 22 19 23 # 20 #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_UEFI) 24 21 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) 25 22 { … … 37 34 } 38 35 36 #else 37 38 # include <unistd.h> 39 # include <stddef.h> 40 # include <sys/types.h> 41 # include <sys/socket.h> 42 # ifndef NO_SYS_UN_H 43 # ifdef OPENSSL_SYS_VXWORKS 44 # include <streams/un.h> 45 # else 46 # include <sys/un.h> 47 # endif 39 48 # else 40 41 # include OPENSSL_UNISTD42 # include <stddef.h>43 # include <sys/types.h>44 # include <sys/socket.h>45 # ifndef NO_SYS_UN_H46 # ifdef OPENSSL_SYS_VXWORKS47 # include <streams/un.h>48 # else49 # include <sys/un.h>50 # endif51 # else52 49 struct sockaddr_un { 53 50 short sun_family; /* AF_UNIX */ 54 51 char sun_path[108]; /* path name (gag) */ 55 52 }; 56 # endif /* NO_SYS_UN_H */ 57 # include <string.h> 58 # include <errno.h> 53 # endif /* NO_SYS_UN_H */ 54 # include <string.h> 55 # include <errno.h> 56 57 # if defined(OPENSSL_SYS_TANDEM) 58 /* 59 * HPNS: 60 * 61 * Our current MQ 5.3 EGD requies compatability-mode sockets 62 * This code forces the mode to compatibility if required 63 * and then restores the mode. 64 * 65 * Needs review: 66 * 67 * The better long-term solution is to either run two EGD's each in one of 68 * the two modes or revise the EGD code to listen on two different sockets 69 * (each in one of the two modes). 70 */ 71 _variable 72 int hpns_socket(int family, 73 int type, 74 int protocol, 75 char* transport) 76 { 77 int socket_rc; 78 char current_transport[20]; 79 80 # define AF_UNIX_PORTABILITY "$ZAFN2" 81 # define AF_UNIX_COMPATIBILITY "$ZPLS" 82 83 if (!_arg_present(transport) || transport != NULL || transport[0] == '\0') 84 return socket(family, type, protocol); 85 86 socket_transport_name_get(AF_UNIX, current_transport, 20); 87 88 if (strcmp(current_transport,transport) == 0) 89 return socket(family, type, protocol); 90 91 /* set the requested socket transport */ 92 if (socket_transport_name_set(AF_UNIX, transport)) 93 return -1; 94 95 socket_rc = socket(family,type,protocol); 96 97 /* set mode back to what it was */ 98 if (socket_transport_name_set(AF_UNIX, current_transport)) 99 return -1; 100 101 return socket_rc; 102 } 103 104 /*#define socket(a,b,c,...) hpns_socket(a,b,c,__VA_ARGS__) */ 105 106 static int hpns_connect_attempt = 0; 107 108 # endif /* defined(OPENSSL_SYS_HPNS) */ 109 59 110 60 111 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) … … 75 126 strcpy(addr.sun_path, path); 76 127 i = offsetof(struct sockaddr_un, sun_path) + strlen(path); 128 #if defined(OPENSSL_SYS_TANDEM) 129 fd = hpns_socket(AF_UNIX, SOCK_STREAM, 0, AF_UNIX_COMPATIBILITY); 130 #else 77 131 fd = socket(AF_UNIX, SOCK_STREAM, 0); 132 #endif 78 133 if (fd == -1 || (fp = fdopen(fd, "r+")) == NULL) 79 134 return -1; … … 84 139 if (connect(fd, (struct sockaddr *)&addr, i) == 0) 85 140 break; 86 # 141 # ifdef EISCONN 87 142 if (errno == EISCONN) 88 143 break; 89 # 144 # endif 90 145 switch (errno) { 91 # 146 # ifdef EINTR 92 147 case EINTR: 93 # 94 # 148 # endif 149 # ifdef EAGAIN 95 150 case EAGAIN: 96 # 97 # 151 # endif 152 # ifdef EINPROGRESS 98 153 case EINPROGRESS: 99 # 100 # 154 # endif 155 # ifdef EALREADY 101 156 case EALREADY: 102 # 157 # endif 103 158 /* No error, try again */ 104 159 break; 105 160 default: 161 # if defined(OPENSSL_SYS_TANDEM) 162 if (hpns_connect_attempt == 0) { 163 /* try the other kind of AF_UNIX socket */ 164 close(fd); 165 fd = hpns_socket(AF_UNIX, SOCK_STREAM, 0, AF_UNIX_PORTABILITY); 166 if (fd == -1) 167 return -1; 168 ++hpns_connect_attempt; 169 break; /* try the connect again */ 170 } 171 # endif 172 106 173 ret = -1; 107 174 goto err; … … 154 221 } 155 222 156 # endif157 158 223 #endif
Note:
See TracChangeset
for help on using the changeset viewer.