VirtualBox

Ignore:
Timestamp:
Mar 3, 2022 7:17:34 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150325
Message:

libs/openssl-3.0.1: started applying and adjusting our OpenSSL changes to 3.0.1. bugref:10128

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  
        1212/vendor/openssl/1.1.1c:131722-131725
        1313/vendor/openssl/1.1.1k:145841-145843
         14/vendor/openssl/3.0.1:150323-150324
         15/vendor/openssl/current:147554-150322
  • trunk/src/libs/openssl-3.0.1/crypto/rand/rand_egd.c

    r91772 r94082  
    11/*
    2  * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
    3  *
    4  * Licensed under the OpenSSL license (the "License").  You may not use
     2 * 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
    55 * this file except in compliance with the License.  You can obtain a copy
    66 * in the file LICENSE in the source distribution or at
     
    99
    1010#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>
    1815
    1916/*
     
    2118 */
    2219
    23 # 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)
     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)
    2421int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
    2522{
     
    3734}
    3835
     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
    3948# else
    40 
    41 #  include OPENSSL_UNISTD
    42 #  include <stddef.h>
    43 #  include <sys/types.h>
    44 #  include <sys/socket.h>
    45 #  ifndef NO_SYS_UN_H
    46 #   ifdef OPENSSL_SYS_VXWORKS
    47 #    include <streams/un.h>
    48 #   else
    49 #    include <sys/un.h>
    50 #   endif
    51 #  else
    5249struct sockaddr_un {
    5350    short sun_family;           /* AF_UNIX */
    5451    char sun_path[108];         /* path name (gag) */
    5552};
    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
     72int 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
     106static int hpns_connect_attempt = 0;
     107
     108# endif /* defined(OPENSSL_SYS_HPNS) */
     109
    59110
    60111int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
     
    75126    strcpy(addr.sun_path, path);
    76127    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
    77131    fd = socket(AF_UNIX, SOCK_STREAM, 0);
     132#endif
    78133    if (fd == -1 || (fp = fdopen(fd, "r+")) == NULL)
    79134        return -1;
     
    84139        if (connect(fd, (struct sockaddr *)&addr, i) == 0)
    85140            break;
    86 #  ifdef EISCONN
     141# ifdef EISCONN
    87142        if (errno == EISCONN)
    88143            break;
    89 #  endif
     144# endif
    90145        switch (errno) {
    91 #  ifdef EINTR
     146# ifdef EINTR
    92147        case EINTR:
    93 #  endif
    94 #  ifdef EAGAIN
     148# endif
     149# ifdef EAGAIN
    95150        case EAGAIN:
    96 #  endif
    97 #  ifdef EINPROGRESS
     151# endif
     152# ifdef EINPROGRESS
    98153        case EINPROGRESS:
    99 #  endif
    100 #  ifdef EALREADY
     154# endif
     155# ifdef EALREADY
    101156        case EALREADY:
    102 #  endif
     157# endif
    103158            /* No error, try again */
    104159            break;
    105160        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
    106173            ret = -1;
    107174            goto err;
     
    154221}
    155222
    156 # endif
    157 
    158223#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette