113498266Sopenharmony_ci#ifndef HEADER_CURL_SETUP_VMS_H
213498266Sopenharmony_ci#define HEADER_CURL_SETUP_VMS_H
313498266Sopenharmony_ci/***************************************************************************
413498266Sopenharmony_ci *                                  _   _ ____  _
513498266Sopenharmony_ci *  Project                     ___| | | |  _ \| |
613498266Sopenharmony_ci *                             / __| | | | |_) | |
713498266Sopenharmony_ci *                            | (__| |_| |  _ <| |___
813498266Sopenharmony_ci *                             \___|\___/|_| \_\_____|
913498266Sopenharmony_ci *
1013498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
1113498266Sopenharmony_ci *
1213498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which
1313498266Sopenharmony_ci * you should have received as part of this distribution. The terms
1413498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html.
1513498266Sopenharmony_ci *
1613498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1713498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is
1813498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file.
1913498266Sopenharmony_ci *
2013498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2113498266Sopenharmony_ci * KIND, either express or implied.
2213498266Sopenharmony_ci *
2313498266Sopenharmony_ci * SPDX-License-Identifier: curl
2413498266Sopenharmony_ci *
2513498266Sopenharmony_ci ***************************************************************************/
2613498266Sopenharmony_ci
2713498266Sopenharmony_ci/*                                                                         */
2813498266Sopenharmony_ci/* JEM, 12/30/12, VMS now generates config.h, so only define wrappers for  */
2913498266Sopenharmony_ci/*                getenv(), getpwuid() and provide is_vms_shell()          */
3013498266Sopenharmony_ci/*                Also need upper case symbols for system services, and    */
3113498266Sopenharmony_ci/*                OpenSSL, and some Kerberos image                         */
3213498266Sopenharmony_ci
3313498266Sopenharmony_ci#ifdef __DECC
3413498266Sopenharmony_ci#pragma message save
3513498266Sopenharmony_ci#pragma message disable dollarid
3613498266Sopenharmony_ci#endif
3713498266Sopenharmony_ci
3813498266Sopenharmony_ci/* Hide the stuff we are overriding */
3913498266Sopenharmony_ci#define getenv decc_getenv
4013498266Sopenharmony_ci#ifdef __DECC
4113498266Sopenharmony_ci#   if __INITIAL_POINTER_SIZE != 64
4213498266Sopenharmony_ci#       define getpwuid decc_getpwuid
4313498266Sopenharmony_ci#   endif
4413498266Sopenharmony_ci#endif
4513498266Sopenharmony_ci#include <stdlib.h>
4613498266Sopenharmony_cichar *decc$getenv(const char *__name);
4713498266Sopenharmony_ci#include <pwd.h>
4813498266Sopenharmony_ci
4913498266Sopenharmony_ci#include <string.h>
5013498266Sopenharmony_ci#include <unixlib.h>
5113498266Sopenharmony_ci
5213498266Sopenharmony_ci#undef getenv
5313498266Sopenharmony_ci#undef getpwuid
5413498266Sopenharmony_ci#define getenv vms_getenv
5513498266Sopenharmony_ci#define getpwuid vms_getpwuid
5613498266Sopenharmony_ci
5713498266Sopenharmony_ci/* VAX needs these in upper case when compiling exact case */
5813498266Sopenharmony_ci#define sys$assign SYS$ASSIGN
5913498266Sopenharmony_ci#define sys$dassgn SYS$DASSGN
6013498266Sopenharmony_ci#define sys$qiow SYS$QIOW
6113498266Sopenharmony_ci
6213498266Sopenharmony_ci#ifdef __DECC
6313498266Sopenharmony_ci#   if __INITIAL_POINTER_SIZE
6413498266Sopenharmony_ci#       pragma __pointer_size __save
6513498266Sopenharmony_ci#   endif
6613498266Sopenharmony_ci#endif
6713498266Sopenharmony_ci
6813498266Sopenharmony_ci#if __USE_LONG_GID_T
6913498266Sopenharmony_ci#   define decc_getpwuid DECC$__LONG_GID_GETPWUID
7013498266Sopenharmony_ci#else
7113498266Sopenharmony_ci#   if __INITIAL_POINTER_SIZE
7213498266Sopenharmony_ci#       define decc_getpwuid decc$__32_getpwuid
7313498266Sopenharmony_ci#   else
7413498266Sopenharmony_ci#       define decc_getpwuid decc$getpwuid
7513498266Sopenharmony_ci#   endif
7613498266Sopenharmony_ci#endif
7713498266Sopenharmony_ci
7813498266Sopenharmony_ci    struct passwd *decc_getpwuid(uid_t uid);
7913498266Sopenharmony_ci
8013498266Sopenharmony_ci#ifdef __DECC
8113498266Sopenharmony_ci#   if __INITIAL_POINTER_SIZE == 32
8213498266Sopenharmony_ci/* Translate the path, but only if the path is a VMS file specification */
8313498266Sopenharmony_ci/* The translation is usually only needed for older versions of VMS */
8413498266Sopenharmony_cistatic char *vms_translate_path(const char *path)
8513498266Sopenharmony_ci{
8613498266Sopenharmony_ci  char *unix_path;
8713498266Sopenharmony_ci  char *test_str;
8813498266Sopenharmony_ci
8913498266Sopenharmony_ci  /* See if the result is in VMS format, if not, we are done */
9013498266Sopenharmony_ci  /* Assume that this is a PATH, not just some data */
9113498266Sopenharmony_ci  test_str = strpbrk(path, ":[<^");
9213498266Sopenharmony_ci  if(!test_str) {
9313498266Sopenharmony_ci    return (char *)path;
9413498266Sopenharmony_ci  }
9513498266Sopenharmony_ci
9613498266Sopenharmony_ci  unix_path = decc$translate_vms(path);
9713498266Sopenharmony_ci
9813498266Sopenharmony_ci  if((int)unix_path <= 0) {
9913498266Sopenharmony_ci    /* We can not translate it, so return the original string */
10013498266Sopenharmony_ci    return (char *)path;
10113498266Sopenharmony_ci  }
10213498266Sopenharmony_ci}
10313498266Sopenharmony_ci#   else
10413498266Sopenharmony_ci    /* VMS translate path is actually not needed on the current 64 bit */
10513498266Sopenharmony_ci    /* VMS platforms, so instead of figuring out the pointer settings */
10613498266Sopenharmony_ci    /* Change it to a noop */
10713498266Sopenharmony_ci#   define vms_translate_path(__path) __path
10813498266Sopenharmony_ci#   endif
10913498266Sopenharmony_ci#endif
11013498266Sopenharmony_ci
11113498266Sopenharmony_ci#ifdef __DECC
11213498266Sopenharmony_ci#   if __INITIAL_POINTER_SIZE
11313498266Sopenharmony_ci#       pragma __pointer_size __restore
11413498266Sopenharmony_ci#   endif
11513498266Sopenharmony_ci#endif
11613498266Sopenharmony_ci
11713498266Sopenharmony_cistatic char *vms_getenv(const char *envvar)
11813498266Sopenharmony_ci{
11913498266Sopenharmony_ci  char *result;
12013498266Sopenharmony_ci  char *vms_path;
12113498266Sopenharmony_ci
12213498266Sopenharmony_ci  /* first use the DECC getenv() function */
12313498266Sopenharmony_ci  result = decc$getenv(envvar);
12413498266Sopenharmony_ci  if(!result) {
12513498266Sopenharmony_ci    return result;
12613498266Sopenharmony_ci  }
12713498266Sopenharmony_ci
12813498266Sopenharmony_ci  vms_path = result;
12913498266Sopenharmony_ci  result = vms_translate_path(vms_path);
13013498266Sopenharmony_ci
13113498266Sopenharmony_ci  /* note that if you backport this to use VAX C RTL, that the VAX C RTL */
13213498266Sopenharmony_ci  /* may do a malloc(2048) for each call to getenv(), so you will need   */
13313498266Sopenharmony_ci  /* to add a free(vms_path) */
13413498266Sopenharmony_ci  /* Do not do a free() for DEC C RTL builds, which should be used for */
13513498266Sopenharmony_ci  /* VMS 5.5-2 and later, even if using GCC */
13613498266Sopenharmony_ci
13713498266Sopenharmony_ci  return result;
13813498266Sopenharmony_ci}
13913498266Sopenharmony_ci
14013498266Sopenharmony_ci
14113498266Sopenharmony_cistatic struct passwd vms_passwd_cache;
14213498266Sopenharmony_ci
14313498266Sopenharmony_cistatic struct passwd *vms_getpwuid(uid_t uid)
14413498266Sopenharmony_ci{
14513498266Sopenharmony_ci  struct passwd *my_passwd;
14613498266Sopenharmony_ci
14713498266Sopenharmony_ci/* Hack needed to support 64 bit builds, decc_getpwnam is 32 bit only */
14813498266Sopenharmony_ci#ifdef __DECC
14913498266Sopenharmony_ci#   if __INITIAL_POINTER_SIZE
15013498266Sopenharmony_ci  __char_ptr32 unix_path;
15113498266Sopenharmony_ci#   else
15213498266Sopenharmony_ci  char *unix_path;
15313498266Sopenharmony_ci#   endif
15413498266Sopenharmony_ci#else
15513498266Sopenharmony_ci  char *unix_path;
15613498266Sopenharmony_ci#endif
15713498266Sopenharmony_ci
15813498266Sopenharmony_ci  my_passwd = decc_getpwuid(uid);
15913498266Sopenharmony_ci  if(!my_passwd) {
16013498266Sopenharmony_ci    return my_passwd;
16113498266Sopenharmony_ci  }
16213498266Sopenharmony_ci
16313498266Sopenharmony_ci  unix_path = vms_translate_path(my_passwd->pw_dir);
16413498266Sopenharmony_ci
16513498266Sopenharmony_ci  if((long)unix_path <= 0) {
16613498266Sopenharmony_ci    /* We can not translate it, so return the original string */
16713498266Sopenharmony_ci    return my_passwd;
16813498266Sopenharmony_ci  }
16913498266Sopenharmony_ci
17013498266Sopenharmony_ci  /* If no changes needed just return it */
17113498266Sopenharmony_ci  if(unix_path == my_passwd->pw_dir) {
17213498266Sopenharmony_ci    return my_passwd;
17313498266Sopenharmony_ci  }
17413498266Sopenharmony_ci
17513498266Sopenharmony_ci  /* Need to copy the structure returned */
17613498266Sopenharmony_ci  /* Since curl is only using pw_dir, no need to fix up */
17713498266Sopenharmony_ci  /* the pw_shell when running under Bash */
17813498266Sopenharmony_ci  vms_passwd_cache.pw_name = my_passwd->pw_name;
17913498266Sopenharmony_ci  vms_passwd_cache.pw_uid = my_passwd->pw_uid;
18013498266Sopenharmony_ci  vms_passwd_cache.pw_gid = my_passwd->pw_uid;
18113498266Sopenharmony_ci  vms_passwd_cache.pw_dir = unix_path;
18213498266Sopenharmony_ci  vms_passwd_cache.pw_shell = my_passwd->pw_shell;
18313498266Sopenharmony_ci
18413498266Sopenharmony_ci  return &vms_passwd_cache;
18513498266Sopenharmony_ci}
18613498266Sopenharmony_ci
18713498266Sopenharmony_ci#ifdef __DECC
18813498266Sopenharmony_ci#pragma message restore
18913498266Sopenharmony_ci#endif
19013498266Sopenharmony_ci
19113498266Sopenharmony_ci/* Bug - VMS OpenSSL and Kerberos universal symbols are in uppercase only */
19213498266Sopenharmony_ci/* VMS libraries should have universal symbols in exact and uppercase */
19313498266Sopenharmony_ci
19413498266Sopenharmony_ci#define ASN1_INTEGER_get ASN1_INTEGER_GET
19513498266Sopenharmony_ci#define ASN1_STRING_data ASN1_STRING_DATA
19613498266Sopenharmony_ci#define ASN1_STRING_length ASN1_STRING_LENGTH
19713498266Sopenharmony_ci#define ASN1_STRING_print ASN1_STRING_PRINT
19813498266Sopenharmony_ci#define ASN1_STRING_to_UTF8 ASN1_STRING_TO_UTF8
19913498266Sopenharmony_ci#define ASN1_STRING_type ASN1_STRING_TYPE
20013498266Sopenharmony_ci#define BIO_ctrl BIO_CTRL
20113498266Sopenharmony_ci#define BIO_free BIO_FREE
20213498266Sopenharmony_ci#define BIO_new BIO_NEW
20313498266Sopenharmony_ci#define BIO_s_mem BIO_S_MEM
20413498266Sopenharmony_ci#define BN_bn2bin BN_BN2BIN
20513498266Sopenharmony_ci#define BN_num_bits BN_NUM_BITS
20613498266Sopenharmony_ci#define CRYPTO_cleanup_all_ex_data CRYPTO_CLEANUP_ALL_EX_DATA
20713498266Sopenharmony_ci#define CRYPTO_free CRYPTO_FREE
20813498266Sopenharmony_ci#define CRYPTO_malloc CRYPTO_MALLOC
20913498266Sopenharmony_ci#define CONF_modules_load_file CONF_MODULES_LOAD_FILE
21013498266Sopenharmony_ci#ifdef __VAX
21113498266Sopenharmony_ci#  ifdef VMS_OLD_SSL
21213498266Sopenharmony_ci  /* Ancient OpenSSL on VAX/VMS missing this constant */
21313498266Sopenharmony_ci#    define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
21413498266Sopenharmony_ci#    undef CONF_modules_load_file
21513498266Sopenharmony_ci     static int CONF_modules_load_file(const char *filename,
21613498266Sopenharmony_ci                                       const char *appname,
21713498266Sopenharmony_ci                                       unsigned long flags) {
21813498266Sopenharmony_ci             return 1;
21913498266Sopenharmony_ci     }
22013498266Sopenharmony_ci#  endif
22113498266Sopenharmony_ci#endif
22213498266Sopenharmony_ci#define DES_ecb_encrypt DES_ECB_ENCRYPT
22313498266Sopenharmony_ci#define DES_set_key DES_SET_KEY
22413498266Sopenharmony_ci#define DES_set_odd_parity DES_SET_ODD_PARITY
22513498266Sopenharmony_ci#define ENGINE_ctrl ENGINE_CTRL
22613498266Sopenharmony_ci#define ENGINE_ctrl_cmd ENGINE_CTRL_CMD
22713498266Sopenharmony_ci#define ENGINE_finish ENGINE_FINISH
22813498266Sopenharmony_ci#define ENGINE_free ENGINE_FREE
22913498266Sopenharmony_ci#define ENGINE_get_first ENGINE_GET_FIRST
23013498266Sopenharmony_ci#define ENGINE_get_id ENGINE_GET_ID
23113498266Sopenharmony_ci#define ENGINE_get_next ENGINE_GET_NEXT
23213498266Sopenharmony_ci#define ENGINE_init ENGINE_INIT
23313498266Sopenharmony_ci#define ENGINE_load_builtin_engines ENGINE_LOAD_BUILTIN_ENGINES
23413498266Sopenharmony_ci#define ENGINE_load_private_key ENGINE_LOAD_PRIVATE_KEY
23513498266Sopenharmony_ci#define ENGINE_set_default ENGINE_SET_DEFAULT
23613498266Sopenharmony_ci#define ERR_clear_error ERR_CLEAR_ERROR
23713498266Sopenharmony_ci#define ERR_error_string ERR_ERROR_STRING
23813498266Sopenharmony_ci#define ERR_error_string_n ERR_ERROR_STRING_N
23913498266Sopenharmony_ci#define ERR_free_strings ERR_FREE_STRINGS
24013498266Sopenharmony_ci#define ERR_get_error ERR_GET_ERROR
24113498266Sopenharmony_ci#define ERR_peek_error ERR_PEEK_ERROR
24213498266Sopenharmony_ci#define ERR_remove_state ERR_REMOVE_STATE
24313498266Sopenharmony_ci#define EVP_PKEY_copy_parameters EVP_PKEY_COPY_PARAMETERS
24413498266Sopenharmony_ci#define EVP_PKEY_free EVP_PKEY_FREE
24513498266Sopenharmony_ci#define EVP_cleanup EVP_CLEANUP
24613498266Sopenharmony_ci#define GENERAL_NAMES_free GENERAL_NAMES_FREE
24713498266Sopenharmony_ci#define i2d_X509_PUBKEY I2D_X509_PUBKEY
24813498266Sopenharmony_ci#define MD4_Final MD4_FINAL
24913498266Sopenharmony_ci#define MD4_Init MD4_INIT
25013498266Sopenharmony_ci#define MD4_Update MD4_UPDATE
25113498266Sopenharmony_ci#define MD5_Final MD5_FINAL
25213498266Sopenharmony_ci#define MD5_Init MD5_INIT
25313498266Sopenharmony_ci#define MD5_Update MD5_UPDATE
25413498266Sopenharmony_ci#define OPENSSL_add_all_algo_noconf OPENSSL_ADD_ALL_ALGO_NOCONF
25513498266Sopenharmony_ci#ifndef __VAX
25613498266Sopenharmony_ci#define OPENSSL_load_builtin_modules OPENSSL_LOAD_BUILTIN_MODULES
25713498266Sopenharmony_ci#endif
25813498266Sopenharmony_ci#define PEM_read_X509 PEM_READ_X509
25913498266Sopenharmony_ci#define PEM_write_bio_X509 PEM_WRITE_BIO_X509
26013498266Sopenharmony_ci#define PKCS12_PBE_add PKCS12_PBE_ADD
26113498266Sopenharmony_ci#define PKCS12_free PKCS12_FREE
26213498266Sopenharmony_ci#define PKCS12_parse PKCS12_PARSE
26313498266Sopenharmony_ci#define RAND_add RAND_ADD
26413498266Sopenharmony_ci#define RAND_bytes RAND_BYTES
26513498266Sopenharmony_ci#define RAND_file_name RAND_FILE_NAME
26613498266Sopenharmony_ci#define RAND_load_file RAND_LOAD_FILE
26713498266Sopenharmony_ci#define RAND_status RAND_STATUS
26813498266Sopenharmony_ci#define SSL_CIPHER_get_name SSL_CIPHER_GET_NAME
26913498266Sopenharmony_ci#define SSL_CTX_add_client_CA SSL_CTX_ADD_CLIENT_CA
27013498266Sopenharmony_ci#define SSL_CTX_callback_ctrl SSL_CTX_CALLBACK_CTRL
27113498266Sopenharmony_ci#define SSL_CTX_check_private_key SSL_CTX_CHECK_PRIVATE_KEY
27213498266Sopenharmony_ci#define SSL_CTX_ctrl SSL_CTX_CTRL
27313498266Sopenharmony_ci#define SSL_CTX_free SSL_CTX_FREE
27413498266Sopenharmony_ci#define SSL_CTX_get_cert_store SSL_CTX_GET_CERT_STORE
27513498266Sopenharmony_ci#define SSL_CTX_load_verify_locations SSL_CTX_LOAD_VERIFY_LOCATIONS
27613498266Sopenharmony_ci#define SSL_CTX_new SSL_CTX_NEW
27713498266Sopenharmony_ci#define SSL_CTX_set_cipher_list SSL_CTX_SET_CIPHER_LIST
27813498266Sopenharmony_ci#define SSL_CTX_set_def_passwd_cb_ud SSL_CTX_SET_DEF_PASSWD_CB_UD
27913498266Sopenharmony_ci#define SSL_CTX_set_default_passwd_cb SSL_CTX_SET_DEFAULT_PASSWD_CB
28013498266Sopenharmony_ci#define SSL_CTX_set_msg_callback SSL_CTX_SET_MSG_CALLBACK
28113498266Sopenharmony_ci#define SSL_CTX_set_verify SSL_CTX_SET_VERIFY
28213498266Sopenharmony_ci#define SSL_CTX_use_PrivateKey SSL_CTX_USE_PRIVATEKEY
28313498266Sopenharmony_ci#define SSL_CTX_use_PrivateKey_file SSL_CTX_USE_PRIVATEKEY_FILE
28413498266Sopenharmony_ci#define SSL_CTX_use_cert_chain_file SSL_CTX_USE_CERT_CHAIN_FILE
28513498266Sopenharmony_ci#define SSL_CTX_use_certificate SSL_CTX_USE_CERTIFICATE
28613498266Sopenharmony_ci#define SSL_CTX_use_certificate_file SSL_CTX_USE_CERTIFICATE_FILE
28713498266Sopenharmony_ci#define SSL_SESSION_free SSL_SESSION_FREE
28813498266Sopenharmony_ci#define SSL_connect SSL_CONNECT
28913498266Sopenharmony_ci#define SSL_free SSL_FREE
29013498266Sopenharmony_ci#define SSL_get1_session SSL_GET1_SESSION
29113498266Sopenharmony_ci#define SSL_get_certificate SSL_GET_CERTIFICATE
29213498266Sopenharmony_ci#define SSL_get_current_cipher SSL_GET_CURRENT_CIPHER
29313498266Sopenharmony_ci#define SSL_get_error SSL_GET_ERROR
29413498266Sopenharmony_ci#define SSL_get_peer_cert_chain SSL_GET_PEER_CERT_CHAIN
29513498266Sopenharmony_ci#define SSL_get_peer_certificate SSL_GET_PEER_CERTIFICATE
29613498266Sopenharmony_ci#define SSL_get_privatekey SSL_GET_PRIVATEKEY
29713498266Sopenharmony_ci#define SSL_get_session SSL_GET_SESSION
29813498266Sopenharmony_ci#define SSL_get_shutdown SSL_GET_SHUTDOWN
29913498266Sopenharmony_ci#define SSL_get_verify_result SSL_GET_VERIFY_RESULT
30013498266Sopenharmony_ci#define SSL_library_init SSL_LIBRARY_INIT
30113498266Sopenharmony_ci#define SSL_load_error_strings SSL_LOAD_ERROR_STRINGS
30213498266Sopenharmony_ci#define SSL_new SSL_NEW
30313498266Sopenharmony_ci#define SSL_peek SSL_PEEK
30413498266Sopenharmony_ci#define SSL_pending SSL_PENDING
30513498266Sopenharmony_ci#define SSL_read SSL_READ
30613498266Sopenharmony_ci#define SSL_set_connect_state SSL_SET_CONNECT_STATE
30713498266Sopenharmony_ci#define SSL_set_fd SSL_SET_FD
30813498266Sopenharmony_ci#define SSL_set_session SSL_SET_SESSION
30913498266Sopenharmony_ci#define SSL_shutdown SSL_SHUTDOWN
31013498266Sopenharmony_ci#define SSL_version SSL_VERSION
31113498266Sopenharmony_ci#define SSL_write SSL_WRITE
31213498266Sopenharmony_ci#define SSLeay SSLEAY
31313498266Sopenharmony_ci#define SSLv23_client_method SSLV23_CLIENT_METHOD
31413498266Sopenharmony_ci#define SSLv3_client_method SSLV3_CLIENT_METHOD
31513498266Sopenharmony_ci#define TLSv1_client_method TLSV1_CLIENT_METHOD
31613498266Sopenharmony_ci#define UI_create_method UI_CREATE_METHOD
31713498266Sopenharmony_ci#define UI_destroy_method UI_DESTROY_METHOD
31813498266Sopenharmony_ci#define UI_get0_user_data UI_GET0_USER_DATA
31913498266Sopenharmony_ci#define UI_get_input_flags UI_GET_INPUT_FLAGS
32013498266Sopenharmony_ci#define UI_get_string_type UI_GET_STRING_TYPE
32113498266Sopenharmony_ci#define UI_create_method UI_CREATE_METHOD
32213498266Sopenharmony_ci#define UI_destroy_method UI_DESTROY_METHOD
32313498266Sopenharmony_ci#define UI_method_get_closer UI_METHOD_GET_CLOSER
32413498266Sopenharmony_ci#define UI_method_get_opener UI_METHOD_GET_OPENER
32513498266Sopenharmony_ci#define UI_method_get_reader UI_METHOD_GET_READER
32613498266Sopenharmony_ci#define UI_method_get_writer UI_METHOD_GET_WRITER
32713498266Sopenharmony_ci#define UI_method_set_closer UI_METHOD_SET_CLOSER
32813498266Sopenharmony_ci#define UI_method_set_opener UI_METHOD_SET_OPENER
32913498266Sopenharmony_ci#define UI_method_set_reader UI_METHOD_SET_READER
33013498266Sopenharmony_ci#define UI_method_set_writer UI_METHOD_SET_WRITER
33113498266Sopenharmony_ci#define UI_OpenSSL UI_OPENSSL
33213498266Sopenharmony_ci#define UI_set_result UI_SET_RESULT
33313498266Sopenharmony_ci#define X509V3_EXT_print X509V3_EXT_PRINT
33413498266Sopenharmony_ci#define X509_EXTENSION_get_critical X509_EXTENSION_GET_CRITICAL
33513498266Sopenharmony_ci#define X509_EXTENSION_get_data X509_EXTENSION_GET_DATA
33613498266Sopenharmony_ci#define X509_EXTENSION_get_object X509_EXTENSION_GET_OBJECT
33713498266Sopenharmony_ci#define X509_LOOKUP_file X509_LOOKUP_FILE
33813498266Sopenharmony_ci#define X509_NAME_ENTRY_get_data X509_NAME_ENTRY_GET_DATA
33913498266Sopenharmony_ci#define X509_NAME_get_entry X509_NAME_GET_ENTRY
34013498266Sopenharmony_ci#define X509_NAME_get_index_by_NID X509_NAME_GET_INDEX_BY_NID
34113498266Sopenharmony_ci#define X509_NAME_print_ex X509_NAME_PRINT_EX
34213498266Sopenharmony_ci#define X509_STORE_CTX_get_current_cert X509_STORE_CTX_GET_CURRENT_CERT
34313498266Sopenharmony_ci#define X509_STORE_add_lookup X509_STORE_ADD_LOOKUP
34413498266Sopenharmony_ci#define X509_STORE_set_flags X509_STORE_SET_FLAGS
34513498266Sopenharmony_ci#define X509_check_issued X509_CHECK_ISSUED
34613498266Sopenharmony_ci#define X509_free X509_FREE
34713498266Sopenharmony_ci#define X509_get_ext_d2i X509_GET_EXT_D2I
34813498266Sopenharmony_ci#define X509_get_issuer_name X509_GET_ISSUER_NAME
34913498266Sopenharmony_ci#define X509_get_pubkey X509_GET_PUBKEY
35013498266Sopenharmony_ci#define X509_get_serialNumber X509_GET_SERIALNUMBER
35113498266Sopenharmony_ci#define X509_get_subject_name X509_GET_SUBJECT_NAME
35213498266Sopenharmony_ci#define X509_load_crl_file X509_LOAD_CRL_FILE
35313498266Sopenharmony_ci#define X509_verify_cert_error_string X509_VERIFY_CERT_ERROR_STRING
35413498266Sopenharmony_ci#define d2i_PKCS12_fp D2I_PKCS12_FP
35513498266Sopenharmony_ci#define i2t_ASN1_OBJECT I2T_ASN1_OBJECT
35613498266Sopenharmony_ci#define sk_num SK_NUM
35713498266Sopenharmony_ci#define sk_pop SK_POP
35813498266Sopenharmony_ci#define sk_pop_free SK_POP_FREE
35913498266Sopenharmony_ci#define sk_value SK_VALUE
36013498266Sopenharmony_ci#ifdef __VAX
36113498266Sopenharmony_ci#define OPENSSL_NO_SHA256
36213498266Sopenharmony_ci#endif
36313498266Sopenharmony_ci#define SHA256_Final SHA256_FINAL
36413498266Sopenharmony_ci#define SHA256_Init SHA256_INIT
36513498266Sopenharmony_ci#define SHA256_Update SHA256_UPDATE
36613498266Sopenharmony_ci
36713498266Sopenharmony_ci#define USE_UPPERCASE_GSSAPI 1
36813498266Sopenharmony_ci#define gss_seal GSS_SEAL
36913498266Sopenharmony_ci#define gss_unseal GSS_UNSEAL
37013498266Sopenharmony_ci
37113498266Sopenharmony_ci#define USE_UPPERCASE_KRBAPI 1
37213498266Sopenharmony_ci
37313498266Sopenharmony_ci/* AI_NUMERICHOST needed for IP V6 support in Curl */
37413498266Sopenharmony_ci#ifdef HAVE_NETDB_H
37513498266Sopenharmony_ci#include <netdb.h>
37613498266Sopenharmony_ci#ifndef AI_NUMERICHOST
37713498266Sopenharmony_ci#ifdef ENABLE_IPV6
37813498266Sopenharmony_ci#undef ENABLE_IPV6
37913498266Sopenharmony_ci#endif
38013498266Sopenharmony_ci#endif
38113498266Sopenharmony_ci#endif
38213498266Sopenharmony_ci
38313498266Sopenharmony_ci/* VAX symbols are always in uppercase */
38413498266Sopenharmony_ci#ifdef __VAX
38513498266Sopenharmony_ci#define inflate INFLATE
38613498266Sopenharmony_ci#define inflateEnd INFLATEEND
38713498266Sopenharmony_ci#define inflateInit2_ INFLATEINIT2_
38813498266Sopenharmony_ci#define inflateInit_ INFLATEINIT_
38913498266Sopenharmony_ci#define zlibVersion ZLIBVERSION
39013498266Sopenharmony_ci#endif
39113498266Sopenharmony_ci
39213498266Sopenharmony_ci/* Older VAX OpenSSL port defines these as Macros */
39313498266Sopenharmony_ci/* Need to include the headers first and then redefine */
39413498266Sopenharmony_ci/* that way a newer port will also work if some one has one */
39513498266Sopenharmony_ci#ifdef __VAX
39613498266Sopenharmony_ci
39713498266Sopenharmony_ci#   if (OPENSSL_VERSION_NUMBER < 0x00907001L)
39813498266Sopenharmony_ci#       define des_set_odd_parity DES_SET_ODD_PARITY
39913498266Sopenharmony_ci#       define des_set_key DES_SET_KEY
40013498266Sopenharmony_ci#       define des_ecb_encrypt DES_ECB_ENCRYPT
40113498266Sopenharmony_ci
40213498266Sopenharmony_ci#   endif
40313498266Sopenharmony_ci#   include <openssl/evp.h>
40413498266Sopenharmony_ci#   ifndef OpenSSL_add_all_algorithms
40513498266Sopenharmony_ci#       define OpenSSL_add_all_algorithms OPENSSL_ADD_ALL_ALGORITHMS
40613498266Sopenharmony_ci        void OPENSSL_ADD_ALL_ALGORITHMS(void);
40713498266Sopenharmony_ci#   endif
40813498266Sopenharmony_ci
40913498266Sopenharmony_ci    /* Curl defines these to lower case and VAX needs them in upper case */
41013498266Sopenharmony_ci    /* So we need static routines */
41113498266Sopenharmony_ci#   if (OPENSSL_VERSION_NUMBER < 0x00907001L)
41213498266Sopenharmony_ci
41313498266Sopenharmony_ci#       undef des_set_odd_parity
41413498266Sopenharmony_ci#       undef DES_set_odd_parity
41513498266Sopenharmony_ci#       undef des_set_key
41613498266Sopenharmony_ci#       undef DES_set_key
41713498266Sopenharmony_ci#       undef des_ecb_encrypt
41813498266Sopenharmony_ci#       undef DES_ecb_encrypt
41913498266Sopenharmony_ci
42013498266Sopenharmony_ci        static void des_set_odd_parity(des_cblock *key) {
42113498266Sopenharmony_ci            DES_SET_ODD_PARITY(key);
42213498266Sopenharmony_ci        }
42313498266Sopenharmony_ci
42413498266Sopenharmony_ci        static int des_set_key(const_des_cblock *key,
42513498266Sopenharmony_ci                               des_key_schedule schedule) {
42613498266Sopenharmony_ci            return DES_SET_KEY(key, schedule);
42713498266Sopenharmony_ci        }
42813498266Sopenharmony_ci
42913498266Sopenharmony_ci        static void des_ecb_encrypt(const_des_cblock *input,
43013498266Sopenharmony_ci                                    des_cblock *output,
43113498266Sopenharmony_ci                                    des_key_schedule ks, int enc) {
43213498266Sopenharmony_ci            DES_ECB_ENCRYPT(input, output, ks, enc);
43313498266Sopenharmony_ci        }
43413498266Sopenharmony_ci#endif
43513498266Sopenharmony_ci/* Need this to stop a macro redefinition error */
43613498266Sopenharmony_ci#if OPENSSL_VERSION_NUMBER < 0x00907000L
43713498266Sopenharmony_ci#   ifdef X509_STORE_set_flags
43813498266Sopenharmony_ci#       undef X509_STORE_set_flags
43913498266Sopenharmony_ci#       define X509_STORE_set_flags(x,y) Curl_nop_stmt
44013498266Sopenharmony_ci#   endif
44113498266Sopenharmony_ci#endif
44213498266Sopenharmony_ci#endif
44313498266Sopenharmony_ci
44413498266Sopenharmony_ci#endif /* HEADER_CURL_SETUP_VMS_H */
445