Skip to content
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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ dist:
exit 1 ; }
@mkdir -p "$(NAME)-$(VERSION)"
@cp -pr $(DIST_FILES) "$(NAME)-$(VERSION)"
@rm -f "$(NAME)-$(VERSION)"/$(NATIVE_SRC_DIR)/*.o \
"$(NAME)-$(VERSION)"/$(NATIVE_SRC_DIR)/*.d
tar -zcf "$(NAME)-$(VERSION).tar.gz" "$(NAME)-$(VERSION)"
@rm -rf "$(NAME)-$(VERSION)"

Expand Down
34 changes: 32 additions & 2 deletions native/com_wolfssl_WolfSSLContext.c
Original file line number Diff line number Diff line change
Expand Up @@ -3223,7 +3223,12 @@ int NativeDecryptVerifyCb(WOLFSSL* ssl, unsigned char* decOut,
}
return -1;
}
*padSz = (unsigned int)tmpVal;
/* Reject negative and too large padSz values */
if ((tmpVal < 0) || (tmpVal > (jlong)decSz)) {
retval = -1;
} else {
*padSz = (unsigned int)tmpVal;
}
}

/* delete local refs, detach JNIEnv from thread */
Expand Down Expand Up @@ -3533,7 +3538,12 @@ int NativeVerifyDecryptCb(WOLFSSL* ssl, unsigned char* decOut,
}
return -1;
}
*padSz = (unsigned int)tmpVal;
/* Reject negative and too large padSz values */
if ((tmpVal < 0) || (tmpVal > (jlong)decSz)) {
retval = -1;
} else {
*padSz = (unsigned int)tmpVal;
}
}

/* delete local refs, detach JNIEnv from thread */
Expand Down Expand Up @@ -5537,6 +5547,11 @@ int NativeRsaVerifyCb(WOLFSSL* ssl, unsigned char* sig, unsigned int sigSz,
return -1;
}

if ((retval > 0) && ((unsigned int)retval > sigSz)) {
/* wolfSSL uses positive return as the output length */
retval = -1;
}

/* point out* to the beginning of our decrypted buffer */
if (retval > 0)
*out = sig;
Expand Down Expand Up @@ -5833,6 +5848,11 @@ int NativeRsaSignCheckCb(WOLFSSL* ssl, unsigned char* sig, unsigned int sigSz,
return -1;
}

if ((retval > 0) && ((unsigned int)retval > sigSz)) {
/* wolfSSL uses positive return as the output length */
retval = -1;
}

/* point out* to the beginning of decrypted buffer */
if (retval > 0) {
*out = sig;
Expand Down Expand Up @@ -6070,6 +6090,11 @@ int NativeRsaPssSignCheckCb(WOLFSSL* ssl, unsigned char* sig,
return -1;
}

if ((retval > 0) && ((unsigned int)retval > sigSz)) {
/* wolfSSL uses positive return as the output length */
retval = -1;
}

/* point out* to the beginning of decrypted buffer */
if (retval > 0) {
*out = sig;
Expand Down Expand Up @@ -6648,6 +6673,11 @@ int NativeRsaDecCb(WOLFSSL* ssl, unsigned char* in, unsigned int inSz,
retval = -1;
}

if ((retval > 0) && ((unsigned int)retval > inSz)) {
/* wolfSSL uses positive return as the output length */
retval = -1;
}

/* point out* to the beginning of our decrypted buffer */
if (retval > 0)
*out = in;
Expand Down
2 changes: 1 addition & 1 deletion native/com_wolfssl_WolfSSLSession.c
Original file line number Diff line number Diff line change
Expand Up @@ -7066,7 +7066,7 @@ int NativeSSLIORecvCb(WOLFSSL *ssl, char *buf, int sz, void *ctx)
return WOLFSSL_CBIO_ERR_GENERAL;
}

/* call Java send callback, ignore ctx since Java handles it */
/* call Java receive callback, ignore ctx since Java handles it */
retval = (*jenv)->CallIntMethod(jenv, (jobject)(*g_cachedSSLObj),
g_sslIORecvMethodId, (jobject)(*g_cachedSSLObj), inData, (jint)sz);

Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLByteBufferIORecvCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public interface WolfSSLByteBufferIORecvCallback {
* be read from the transport layer. The callback should read data and
* place the data into the buffer provided. The number of bytes read should
* be returned. The callback should return an error code on error.
* <p>
* The <b>buf</b> ByteBuffer wraps native memory that is only valid
* until this method returns. Do not use it, or any duplicate or
* slice of it, after returning.
*
* @param ssl the current SSL session object from which the callback was
* initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLByteBufferIOSendCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public interface WolfSSLByteBufferIOSendCallback {
* The callback should send data from the provided ByteBuffer (buf) across
* the transport layer. The number of bytes sent should be returned, or
* a negative error code on error.
* <p>
* The <b>buf</b> ByteBuffer wraps native memory that is only valid
* until this method returns. Do not use it, or any duplicate or
* slice of it, after returning.
*
* @param ssl the current SSL session object from which the callback was
* initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLDecryptVerifyCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public interface WolfSSLDecryptVerifyCallback {
* Atomic record layer decrypt/verify callback method.
* This method acts as the decrypt/verify callback to be used with
* the wolfSSL atomic record layer processing.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLEccSharedSecretCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLEccSharedSecretCallback {
/**
* ECC shared secret callback method.
* This method acts as ECC shared secret callback.
* <p>
* The <b>out</b> buffer, and <b>pubKeyDer</b> on the client side, wrap
* native memory that is only valid until this method returns. Do not
* use them, or any duplicate or slice of them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLEccSignCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLEccSignCallback {
/**
* ECC signing callback method.
* This method acts as ECC signing callback.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLEccVerifyCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLEccVerifyCallback {
/**
* ECC verification callback method.
* This method acts as ECC verification callback.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLMacEncryptCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public interface WolfSSLMacEncryptCallback {
* Atomic record layer MAC Encrypt callback method.
* This method acts as the Atomic User Record Processing Mac/Encrypt
* callback to be used with the wolfSSL atomic record layer processing.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLRsaDecCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLRsaDecCallback {
/**
* RSA private decrypt callback method.
* This method acts as RSA private decrypt callback.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLRsaEncCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLRsaEncCallback {
/**
* RSA public encrypt callback method.
* This method acts as RSA public enrypt callback.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLRsaPssSignCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLRsaPssSignCallback {
/**
* RSA-PSS signing callback method.
* This method acts as RSA-PSS signing callback.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the callback was
* initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLRsaPssVerifyCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLRsaPssVerifyCallback {
/**
* RSA-PSS verification callback method.
* This method acts as RSA-PSS verification callback.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the callback
* was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLRsaSignCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLRsaSignCallback {
/**
* RSA signing callback method.
* This method acts as RSA signing callback.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLRsaVerifyCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public interface WolfSSLRsaVerifyCallback {
/**
* RSA verification callback method.
* This method acts as RSA verification callback.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
4 changes: 4 additions & 0 deletions src/java/com/wolfssl/WolfSSLVerifyDecryptCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public interface WolfSSLVerifyDecryptCallback {
* Atomic record layer verify/decrypt callback method.
* This method acts as the verify/decrypt callback to be used with
* the wolfSSL atomic record layer processing.
* <p>
* ByteBuffer arguments wrap native memory that is only valid until
* this method returns. Do not use them, or any duplicate or slice of
* them, after returning.
*
* @param ssl the current SSL session object from which the
* callback was initiated.
Expand Down
Loading
Loading