Commit ae8d3c19 authored by David Woodhouse's avatar David Woodhouse

Add openconnect_has_tss2_blob_support()

Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent a8d550ec
......@@ -232,6 +232,7 @@ public final class LibTest {
System.out.println("OpenConnect version: " + lib.getVersion());
System.out.println(" PKCS=" + lib.hasPKCS11Support() +
", TSS=" + lib.hasTSSBlobSupport() +
", TSS2=" + lib.hasTSS2BlobSupport() +
", STOKEN=" + lib.hasStokenSupport() +
", OATH=" + lib.hasOATHSupport() +
", YUBIOATH=" + lib.hasYubiOATHSupport());
......
......@@ -176,6 +176,7 @@ public abstract class LibOpenConnect {
public static native String getVersion();
public static native boolean hasPKCS11Support();
public static native boolean hasTSSBlobSupport();
public static native boolean hasTSS2BlobSupport();
public static native boolean hasStokenSupport();
public static native boolean hasOATHSupport();
public static native boolean hasYubiOATHSupport();
......
......@@ -925,6 +925,12 @@ JNIEXPORT jboolean JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_hasT
return openconnect_has_tss_blob_support();
}
JNIEXPORT jboolean JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_hasTSS2BlobSupport(
JNIEnv *jenv, jclass jcls)
{
return openconnect_has_tss2_blob_support();
}
JNIEXPORT jboolean JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_hasStokenSupport(
JNIEnv *jenv, jclass jcls)
{
......
......@@ -98,6 +98,7 @@ OPENCONNECT_5_5 {
openconnect_get_protocol;
openconnect_get_supported_protocols;
openconnect_free_supported_protocols;
openconnect_has_tss2_blob_support;
} OPENCONNECT_5_4;
OPENCONNECT_PRIVATE {
......
......@@ -730,6 +730,24 @@ int openconnect_has_tss_blob_support(void)
return 0;
}
int openconnect_has_tss2_blob_support(void)
{
#if defined(OPENCONNECT_OPENSSL) && defined(HAVE_ENGINE)
ENGINE *e;
ENGINE_load_builtin_engines();
e = ENGINE_by_id("tpm2");
if (e) {
ENGINE_free(e);
return 1;
}
#elif defined(OPENCONNECT_GNUTLS) && defined(HAVE_TSS2)
return 1;
#endif
return 0;
}
int openconnect_has_stoken_support(void)
{
#ifdef HAVE_LIBSTOKEN
......
......@@ -592,6 +592,10 @@ static void print_build_opts(void)
printf("%sTPM", sep);
sep = comma;
}
if (openconnect_has_tss2_blob_support()) {
printf("%sTPMv2", sep);
sep = comma;
}
#if defined(OPENCONNECT_OPENSSL) && defined(HAVE_ENGINE)
else {
printf("%sTPM (%s)", sep, _("OpenSSL ENGINE not present"));
......
......@@ -37,6 +37,7 @@ extern "C" {
/*
* API version 5.5:
* - Add openconnect_has_tss2_blob_support()
* - Add openconnect_get_supported_protocols()
* - Add openconnect_free_supported_protocols()
* - Add openconnect_get_protocol()
......@@ -654,9 +655,9 @@ void openconnect_set_stats_handler(struct openconnect_info *vpninfo,
int openconnect_has_pkcs11_support(void);
/* The OpenSSL TPM ENGINE stores keys in a PEM file labelled with the string
-----BEGIN TSS KEY BLOB-----. GnuTLS may learn to support this format too,
in the near future. */
-----BEGIN TSS KEY BLOB-----. */
int openconnect_has_tss_blob_support(void);
int openconnect_has_tss2_blob_support(void);
/* Software token capabilities. */
int openconnect_has_stoken_support(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment