Android: Switch keystore to binder
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
parent
4e5a4d3e57
commit
1d415f1fcc
2 changed files with 17 additions and 19 deletions
|
@ -24,11 +24,6 @@
|
||||||
#include <openssl/engine.h>
|
#include <openssl/engine.h>
|
||||||
#endif /* OPENSSL_NO_ENGINE */
|
#endif /* OPENSSL_NO_ENGINE */
|
||||||
|
|
||||||
#ifdef ANDROID
|
|
||||||
#include <openssl/pem.h>
|
|
||||||
#include "keystore_get.h"
|
|
||||||
#endif /* ANDROID */
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include "tls.h"
|
#include "tls.h"
|
||||||
|
@ -60,6 +55,22 @@
|
||||||
#endif /* OPENSSL_NO_TLSEXT */
|
#endif /* OPENSSL_NO_TLSEXT */
|
||||||
#endif /* SSL_set_tlsext_status_type */
|
#endif /* SSL_set_tlsext_status_type */
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
#include <openssl/pem.h>
|
||||||
|
#include <keystore/keystore_get.h>
|
||||||
|
|
||||||
|
static BIO * BIO_from_keystore(const char *key)
|
||||||
|
{
|
||||||
|
BIO *bio = NULL;
|
||||||
|
uint8_t *value = NULL;
|
||||||
|
int length = keystore_get(key, strlen(key), &value);
|
||||||
|
if (length != -1 && (bio = BIO_new(BIO_s_mem())) != NULL)
|
||||||
|
BIO_write(bio, value, length);
|
||||||
|
free(value);
|
||||||
|
return bio;
|
||||||
|
}
|
||||||
|
#endif /* ANDROID */
|
||||||
|
|
||||||
static int tls_openssl_ref_count = 0;
|
static int tls_openssl_ref_count = 0;
|
||||||
|
|
||||||
struct tls_context {
|
struct tls_context {
|
||||||
|
@ -1496,19 +1507,6 @@ static int tls_load_ca_der(void *_ssl_ctx, const char *ca_cert)
|
||||||
#endif /* OPENSSL_NO_STDIO */
|
#endif /* OPENSSL_NO_STDIO */
|
||||||
|
|
||||||
|
|
||||||
#ifdef ANDROID
|
|
||||||
static BIO * BIO_from_keystore(const char *key)
|
|
||||||
{
|
|
||||||
BIO *bio = NULL;
|
|
||||||
char value[KEYSTORE_MESSAGE_SIZE];
|
|
||||||
int length = keystore_get(key, strlen(key), value);
|
|
||||||
if (length != -1 && (bio = BIO_new(BIO_s_mem())) != NULL)
|
|
||||||
BIO_write(bio, value, length);
|
|
||||||
return bio;
|
|
||||||
}
|
|
||||||
#endif /* ANDROID */
|
|
||||||
|
|
||||||
|
|
||||||
static int tls_connection_ca_cert(void *_ssl_ctx, struct tls_connection *conn,
|
static int tls_connection_ca_cert(void *_ssl_ctx, struct tls_connection *conn,
|
||||||
const char *ca_cert, const u8 *ca_cert_blob,
|
const char *ca_cert, const u8 *ca_cert_blob,
|
||||||
size_t ca_cert_blob_len, const char *ca_path)
|
size_t ca_cert_blob_len, const char *ca_path)
|
||||||
|
|
|
@ -1540,7 +1540,7 @@ include $(LOCAL_PATH)/eap_proxy_$(CONFIG_EAP_PROXY).mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_TLS), openssl)
|
ifeq ($(CONFIG_TLS), openssl)
|
||||||
LOCAL_SHARED_LIBRARIES += libcrypto libssl
|
LOCAL_SHARED_LIBRARIES += libcrypto libssl libkeystore_binder
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_DRIVER_NL80211
|
ifdef CONFIG_DRIVER_NL80211
|
||||||
LOCAL_STATIC_LIBRARIES += libnl_2
|
LOCAL_STATIC_LIBRARIES += libnl_2
|
||||||
|
|
Loading…
Reference in a new issue