Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate bioSetFd and make it a no op #865

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,15 @@ private SSL() { }
public static native long bioNewByteBuffer(long ssl, int nonApplicationBufferSize);

/**
* Sets the socket file descriptor of the rbio field inside the SSL struct (ssl->rbio->num)
* Sets the socket file descriptor
*
* @param ssl the SSL instance (SSL *)
* @param fd the file descriptor of the socket used for the given SSL connection
*
* @deprecated This is not supported official by OpenSSL or BoringSSL so its just a no op.
*/
public static native void bioSetFd(long ssl, int fd);
@Deprecated
public static native void bioSetFd(long ssl, int fd);

/**
* Set the memory location which that OpenSSL's internal BIO will use to write encrypted data to, or read encrypted
Expand Down
13 changes: 2 additions & 11 deletions openssl-dynamic/src/main/c/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,7 @@ static long bio_java_bytebuffer_ctrl(BIO* bio, int cmd, long num, void* ptr) {
case BIO_CTRL_FLUSH:
return 1;
case BIO_C_SET_FD:
#if defined(OPENSSL_IS_BORINGSSL) || defined(LIBRESSL_VERSION_NUMBER)
bio->num = *((int *)ptr);
#endif
// Make this a no op.
return 1;
default:
return 0;
Expand Down Expand Up @@ -400,14 +398,7 @@ static int ssl_ui_writer(UI *ui, UI_STRING *uis)
TCN_IMPLEMENT_CALL(void, SSL, bioSetFd)(TCN_STDARGS, jlong ssl, jint fd) {
SSL *ssl_ = J2P(ssl, SSL *);
TCN_CHECK_NULL(ssl_, ssl, /* void */);

BIO* bio = SSL_get_rbio(ssl_);

// We do not want the fd to be closed
int rc = BIO_set_fd(bio, fd, 0);
if (rc != 1) {
tcn_ThrowException(e, "Failed to set BIO fd");
}
// no op.
}

TCN_IMPLEMENT_CALL(jint, SSL, bioLengthByteBuffer)(TCN_STDARGS, jlong bioAddress) {
Expand Down
Loading