add JNI object storage in WOLFSSL struct

This commit is contained in:
Chris Conlon 2015-10-15 13:30:03 -06:00
parent bfc8240dc5
commit d3584979a0
3 changed files with 32 additions and 0 deletions

View File

@ -17044,5 +17044,29 @@ int wolfSSL_ED25519_verify(const unsigned char *msg, unsigned int msgSz,
}
#endif /* OPENSSL_EXTRA && HAVE_ED25519 */
#ifdef WOLFSSL_JNI
int wolfSSL_set_jobject(WOLFSSL* ssl, void* objPtr)
{
WOLFSSL_ENTER("wolfSSL_set_jobject");
if (ssl != NULL)
{
ssl->jObjectRef = objPtr;
return SSL_SUCCESS;
}
return SSL_FAILURE;
}
void* wolfSSL_get_jobject(WOLFSSL* ssl)
{
WOLFSSL_ENTER("wolfSSL_get_jobject");
if (ssl != NULL)
return ssl->jObjectRef;
return NULL;
}
#endif /* WOLFSSL_JNI */
#endif /* WOLFCRYPT_ONLY */

View File

@ -2480,6 +2480,9 @@ struct WOLFSSL {
SessionSecretCb sessionSecretCb;
void* sessionSecretCtx;
#endif /* HAVE_SECRET_CALLBACK */
#ifdef WOLFSSL_JNI
void* jObjectRef; /* reference to WolfSSLSession in JNI wrapper */
#endif /* WOLFSSL_JNI */
};

View File

@ -1680,6 +1680,11 @@ WOLFSSL_API void wolfSSL_CTX_set_servername_callback(WOLFSSL_CTX *,
WOLFSSL_API void wolfSSL_CTX_set_servername_arg(WOLFSSL_CTX *, void*);
#endif /* HAVE_STUNNEL */
#ifdef WOLFSSL_JNI
WOLFSSL_API int wolfSSL_set_jobject(WOLFSSL* ssl, void* objPtr);
WOLFSSL_API void* wolfSSL_get_jobject(WOLFSSL* ssl);
#endif /* WOLFSSL_JNI */
#ifdef __cplusplus
} /* extern "C" */
#endif