Skip to content

Commit

Permalink
Adding No-op functions required for NodeJS compatability (#1474)
Browse files Browse the repository at this point in the history
### Description of changes: 
Added OPENSSL_init and SSL_CTX_set_dh_auto as no-op functions to support
compilation with NodeJS. OPENSSL_init does nothing by design and
SSL_CTX_set_dh_auto because DH is not supported with SSL in AWS-LC.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
  • Loading branch information
smittals2 authored Mar 20, 2024
1 parent 13337f7 commit c187b23
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crypto/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,6 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) {
return 1;
}

void OPENSSL_init(void) {}

void OPENSSL_cleanup(void) {}
3 changes: 3 additions & 0 deletions include/openssl/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ OPENSSL_EXPORT void OPENSSL_load_builtin_modules(void);
OPENSSL_EXPORT int OPENSSL_init_crypto(uint64_t opts,
const OPENSSL_INIT_SETTINGS *settings);

// OPENSSL_init does nothing.
OPENSSL_EXPORT void OPENSSL_init(void);

// OPENSSL_cleanup does nothing.
OPENSSL_EXPORT void OPENSSL_cleanup(void);

Expand Down
3 changes: 3 additions & 0 deletions include/openssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5159,6 +5159,9 @@ OPENSSL_EXPORT void SSL_set_tmp_dh_callback(SSL *ssl,
DH *(*cb)(SSL *ssl, int is_export,
int keylength));

// SSL_CTX_set_dh_auto does nothing and returns 0 for error.
OPENSSL_EXPORT long SSL_CTX_set_dh_auto(SSL_CTX *ctx, int onoff);

// SSL_CTX_set1_sigalgs takes |num_values| ints and interprets them as pairs
// where the first is the nid of a hash function and the second is an
// |EVP_PKEY_*| value. It configures the signature algorithm preferences for
Expand Down
4 changes: 4 additions & 0 deletions ssl/ssl_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2760,6 +2760,10 @@ void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*cb)(SSL *ssl, int is_export,
int keylength)) {}

long SSL_CTX_set_dh_auto(SSL_CTX *ctx, int onoff) {
return 0;
}

static int use_psk_identity_hint(UniquePtr<char> *out,
const char *identity_hint) {
if (identity_hint != NULL && strlen(identity_hint) > PSK_MAX_IDENTITY_LEN) {
Expand Down

0 comments on commit c187b23

Please sign in to comment.