Skip to content

Commit

Permalink
Working to stabalize the communication setup. #149
Browse files Browse the repository at this point in the history
  • Loading branch information
frehwagen committed Dec 3, 2023
1 parent c4cd4eb commit 97b8ab4
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 53 deletions.
2 changes: 1 addition & 1 deletion Appl/Breadbox/BbxBrow/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ GOCFLAGS += $(COMPILE_OPTIONS)
# -Os: favor size of execution speed
# JavaScript code uses #if rather than #ifdef
#XCCOMFLAGS = -d -dc -Z -Os -O $(COMPILE_OPTIONS:S|JAVASCRIPT_SUPPORT|JAVASCRIPT_SUPPORT=1|g)
XCCOMFLAGS = $(COMPILE_OPTIONS:S|JAVASCRIPT_SUPPORT|JAVASCRIPT_SUPPORT=1|g)
XCCOMFLAGS = -zu -zc $(COMPILE_OPTIONS:S|JAVASCRIPT_SUPPORT|JAVASCRIPT_SUPPORT=1|g)

# -N: Add stack probes to every routine (only for EC builds)
#ifndef NO_EC
Expand Down
3 changes: 3 additions & 0 deletions CInclude/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,7 @@ int _pascal _export SSL_shutdown(SSL *s);
SSL_METHOD * _pascal _export SSL_get_ssl_method(SSL *s);
int _pascal _export SSL_set_ssl_method(SSL *s, SSL_METHOD *meth);


int _pascal _export SSL_set_tlsext_host_name(SSL *ssl, char *name);

#endif /* _SSL_H_ */
1 change: 1 addition & 0 deletions Driver/Socket/HstTCPIP/tcpip.def
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ MSG_TCPIP_DHCP_RENEW_NOW_ASM message
; Don't directly send.

MSG_TCPIP_START_RECEIVE_ASM message
MSG_TCPIP_ASYNC_UNLOCK_ASM message


ifdef PASCAL_CONV
Expand Down
7 changes: 7 additions & 0 deletions Driver/Socket/HstTCPIP/tcpip.goc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@include <stdapp.goh>
#include <sem.h>

extern void
_pascal TcpipReceiveStart(word link);
Expand Down Expand Up @@ -69,6 +70,7 @@ extern void
@message void MSG_TCPIP_DHCP_RENEW_NOW();

@message void MSG_TCPIP_START_RECEIVE();
@message void MSG_TCPIP_ASYNC_UNLOCK(word sem = cx);

@endc;

Expand All @@ -81,3 +83,8 @@ extern void

TcpipReceiveStart(0);
}

@method TcpipProcessClass, MSG_TCPIP_ASYNC_UNLOCK {

ThreadVSem(sem);
}
87 changes: 64 additions & 23 deletions Driver/Socket/HstTCPIP/tcpipEntry.asm
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,13 @@ REVISION HISTORY:
TcpipReceiveInterrupt proc far

pushf
EC < call ECCheckStack >

push ax, bx, cx, dx, si, di, bp, ds, es
;call SysEnterInterrupt
call SysEnterInterrupt
cld ;clear direction flag
INT_ON

EC < call ECCheckStack >

; scheduled receiving data
mov ax, MSG_TCPIP_START_RECEIVE_ASM
Expand All @@ -487,7 +489,7 @@ EC < Assert thread bx >
call ObjMessage
pop bx

;call SysExitInterrupt
call SysExitInterrupt
pop ax, bx, cx, dx, si, di, bp, ds, es
popf
ret
Expand Down Expand Up @@ -1349,19 +1351,39 @@ REVISION HISTORY:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TcpipDataConnReqCB proc far

pushf
EC < call ECCheckStack >
push bx
mov ds:[si].GHNCCD_result, ax
;pushf
;push ax, bx, cx, dx, si, di, bp, ds, es
;call SysEnterInterrupt
;cld ;clear direction flag
;INT_OFF

EC < call ECCheckStack >
;push bx, di, cx
mov ds:[si].GHNCCD_result, ax
;mov cx, ds:[si].GHNCCD_semaphore
if 0
mov bx, ds:[si].GHNCCD_semaphore
call ThreadVSem
; scheduled receiving data
mov ax, MSG_TCPIP_ASYNC_UNLOCK_ASM
push bx
mov bx, handle dgroup
call MemDerefDS
mov bx, ds:[driverThread]
EC < Assert thread bx >

mov di, mask MF_FORCE_QUEUE
call ObjMessage
pop bx
endif
inc ds:[si].GHNCCD_semaphore2
pop bx
popf
inc ds:[si].GHNCCD_semaphore2
;pop bx, di, cx

;call SysExitInterrupt
;pop ax, bx, cx, dx, si, di, bp, ds, es
;popf
ret
ret
TcpipDataConnReqCB endp

Expand Down Expand Up @@ -1627,21 +1649,40 @@ REVISION HISTORY:

TcpipDisconReqCB proc far

pushf
;pushf
;push ax, bx, cx, dx, si, di, bp, ds, es
;call SysEnterInterrupt
;cld ;clear direction flag
;INT_OFF

EC < call ECCheckStack >
EC < call ECCheckStack >

push bx
mov ds:[si].GHNDCD_result, ax
;push bx, di, cx
mov ds:[si].GHNDCD_result, ax
;mov cx, ds:[si].GHNDCD_semaphore
if 0
mov bx, ds:[si].GHNDCD_semaphore
call ThreadVSem
; scheduled receiving data
mov ax, MSG_TCPIP_ASYNC_UNLOCK_ASM
push bx
mov bx, handle dgroup
call MemDerefDS
mov bx, ds:[driverThread]
EC < Assert thread bx >

mov di, mask MF_FORCE_QUEUE
call ObjMessage
pop bx
endif
inc ds:[si].GHNDCD_semaphore2
pop bx
popf
inc ds:[si].GHNDCD_semaphore2
;pop bx, di, cx
;call SysExitInterrupt
;pop ax, bx, cx, dx, si, di, bp, ds, es
;popf
ret
ret
TcpipDisconReqCB endp

Expand Down
2 changes: 1 addition & 1 deletion Include/Internal/host.def
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ HostFunctions etype word
HF_SSL_BASE enum HostFunctions, 1200
HF_SSL3_GET_CLIENT_METHOD enum HostFunctions, HF_SSL_BASE

HOST_INT equ 0xB0
HOST_INT equ 0xA0

1 change: 1 addition & 0 deletions Library/Breadbox/UrlDrv/Wmg3Http/WMG3HTTP.goc
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,7 @@ word HTTPGet(HTTPConnectionHandle conn)
void *sslP = p_conn->ssl;

SSL_set_fd(p_conn->ssl, p_conn->sock);
SSL_set_tlsext_host_name(p_conn->ssl, (char*) hostname.UTA_ip);

if (p_conn->useProxy) {
#if 1
Expand Down
2 changes: 1 addition & 1 deletion Library/SSL/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# -WDE Does dgroup fixup on _export'd routines
#
#CCOMFLAGS += -K -d -X -Fs- -dc -p -WDE -rd
CCOMFLAGS += -ecp -zu
CCOMFLAGS += -ecp -zu -zc
#-zc

#
Expand Down
2 changes: 2 additions & 0 deletions Library/SSL/ssl.gp
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ export SSLV23_CLIENT_METHOD
export SSLV3_CLIENT_METHOD
export SSL_SET_SSL_METHOD
export SSL_GET_SSL_METHOD
incminor
export SSL_SET_TLSEXT_HOST_NAME
4 changes: 2 additions & 2 deletions Library/SSL/ssl/sslManager.asm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SSLCALLHOST proc far callID:byte,
clr ah
add ax, HF_SSL_BASE
int 0xB0
int 0xA0

.leave
Expand Down Expand Up @@ -83,7 +83,7 @@ SSLCHECKHOST proc far

mov ax, 1
mov cx, 2
int 0xB0
int 0xA0

cmp ax, 0
jne error
Expand Down
40 changes: 15 additions & 25 deletions Library/SSL/ssl/ssl_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ static STACK *ssl_ctx_meth=NULL;
static int ssl_meth_num=0;
static int ssl_ctx_meth_num=0;

#ifdef COMPILE_OPTION_HOST_SERVICE
static MemHandle ssl_hostExchangeBuffer = NullHandle;

void* SSLHostExchangeBuffer();

#endif

SSL3_ENC_METHOD ssl3_undef_enc_method={
ssl_undefined_function,
ssl_undefined_function,
Expand Down Expand Up @@ -387,7 +380,7 @@ int fd;

return (int) SSLCallHost(
SSLHFN_SSL_SET_FD, (dword) s, (dword)
SSLHostExchangeBuffer(), (word) intHdl);
(dword) NULL, (word) intHdl);
}
#endif

Expand All @@ -407,23 +400,6 @@ int fd;
return(ret);
}

#ifdef COMPILE_OPTION_HOST_SERVICE

void* SSLHostExchangeBuffer()
{
void* retValue;
PUSHDS;
if (ssl_hostExchangeBuffer == NullHandle)
{
ssl_hostExchangeBuffer = MemAlloc(8192, HF_FIXED, 0);
}
retValue = MemDeref(ssl_hostExchangeBuffer);
POPDS;
return retValue;
}

#endif

#ifndef GEOS_CLIENT

int SSL_set_wfd(s, fd)
Expand Down Expand Up @@ -1640,6 +1616,20 @@ SSL_METHOD *meth;
return(ret);
}

int _pascal _export SSL_set_tlsext_host_name(SSL *ssl, char *name)
{
int ret=1;

#ifdef COMPILE_OPTION_HOST_SERVICE
if(SSLCheckHost())
{
return (SSL_METHOD *) SSLCallHost(
SSLHFN_SSL_SET_TLSEXT_HOST_NAME, (dword) ssl, (dword) name, strlen(name));
}
#endif
return(ret);
}

#ifndef GEOS_CLIENT

int SSL_get_error(s,i)
Expand Down
1 change: 1 addition & 0 deletions Library/SSL/ssl_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typedef ByteEnum SSLHostFunctionNumber;
#define SSLHFN_SSLV3_CLIENT_METHOD 12
#define SSLHFN_SSL_GET_SSL_METHOD 13
#define SSLHFN_SET_CALLBACK 14
#define SSLHFN_SSL_SET_TLSEXT_HOST_NAME 15


extern Boolean _far _pascal SSLCheckHost();
Expand Down

0 comments on commit 97b8ab4

Please sign in to comment.