|
@@ -32,6 +32,10 @@ typedef int SOCKET;
|
|
|
#include "mbedtls/x509_crt.h"
|
|
|
#include "mbedtls/ssl.h"
|
|
|
|
|
|
+#ifdef HL_CONSOLE
|
|
|
+mbedtls_x509_crt *hl_init_cert_chain();
|
|
|
+#endif
|
|
|
+
|
|
|
// Duplicate from socket.c
|
|
|
typedef struct _hl_socket {
|
|
|
SOCKET sock;
|
|
@@ -294,6 +298,9 @@ DEFINE_PRIM(_VOID, conf_set_cert, TCONF TCERT TPKEY);
|
|
|
DEFINE_PRIM(_VOID, conf_set_servername_callback, TCONF _FUN(_OBJ(TCERT TPKEY), _BYTES));
|
|
|
|
|
|
HL_PRIM hl_ssl_cert *HL_NAME(cert_load_file)(vbyte *file) {
|
|
|
+#ifdef HL_CONSOLE
|
|
|
+ return NULL;
|
|
|
+#else
|
|
|
int r;
|
|
|
hl_ssl_cert *cert;
|
|
|
mbedtls_x509_crt *x = (mbedtls_x509_crt*)malloc(sizeof(mbedtls_x509_crt));
|
|
@@ -308,9 +315,13 @@ HL_PRIM hl_ssl_cert *HL_NAME(cert_load_file)(vbyte *file) {
|
|
|
cert->c = x;
|
|
|
cert->finalize = cert_finalize;
|
|
|
return cert;
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
HL_PRIM hl_ssl_cert *HL_NAME(cert_load_path)(vbyte *path) {
|
|
|
+#ifdef HL_CONSOLE
|
|
|
+ return NULL;
|
|
|
+#else
|
|
|
int r;
|
|
|
hl_ssl_cert *cert;
|
|
|
mbedtls_x509_crt *x = (mbedtls_x509_crt*)malloc(sizeof(mbedtls_x509_crt));
|
|
@@ -325,6 +336,7 @@ HL_PRIM hl_ssl_cert *HL_NAME(cert_load_path)(vbyte *path) {
|
|
|
cert->c = x;
|
|
|
cert->finalize = cert_finalize;
|
|
|
return cert;
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
HL_PRIM hl_ssl_cert *HL_NAME(cert_load_defaults)() {
|
|
@@ -379,6 +391,8 @@ HL_PRIM hl_ssl_cert *HL_NAME(cert_load_defaults)() {
|
|
|
}
|
|
|
}
|
|
|
CFRelease(keychain);
|
|
|
+#elif defined(HL_CONSOLE)
|
|
|
+ chain = hl_init_cert_chain();
|
|
|
#endif
|
|
|
if (chain != NULL) {
|
|
|
v = (hl_ssl_cert*)hl_gc_alloc_finalizer(sizeof(hl_ssl_cert));
|