;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; RDOS operating system ; Copyright (C) 1988-2000, Leif Ekblad ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. The only exception to this rule ; is for commercial usage in embedded systems. For information on ; usage in commercial embedded systems, contact embedded@rdos.net ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; ; The author of this program may be contacted at leif@rdos.net ; ; sslbase.ASM ; SSL RDOS interface ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; INCLUDE ..\os\protseg.def INCLUDE ..\os\system.def INCLUDE ..\driver.def INCLUDE ..\user.def INCLUDE ..\os.def INCLUDE ..\user.inc INCLUDE ..\os.inc include ..\handle.inc include ..\wait.inc IFDEF __WASM__ .686p .xmm2 ELSE .386p ENDIF secure_handle_seg STRUC secure_handle_base handle_header <> secure_handle_sel DW ? secure_handle_seg ENDS _TEXT SEGMENT byte public 'CODE' assume cs:_TEXT extrn CreateConnection:near ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Name: CreateSecureConnection ; ; Purpose: Create a secure connection ; ; Returns: NC ok ; BX connection handle ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; create_secure_connection_name DB 'Create Secure Connection',0 create_secure_connection Proc far push ds push eax push ecx push edx ; call CreateConnection ; mov ax,SECURE_HANDLE mov cx,SIZE secure_handle_seg AllocateHandle mov [ebx].secure_handle_sel,dx mov [ebx].hh_sign,SECURE_HANDLE mov bx,[ebx].hh_handle clc ; pop edx pop ecx pop eax pop ds ret create_secure_connection Endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; NAME: Delete_secure_connection ; ; DESCRIPTION: Delete secure connection (called from handle module) ; ; PARAMETERS: BX SECURE CONNECTION HANDLE ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; delete_secure_connection Proc far ret delete_secure_connection Endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; NAME: AllocateTls ; ; DESCRIPTION: Allocate TLS ; ; RETURNS: EAX Entry ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; public AllocateTls_ AllocateTls_ Proc near push ds push es push ecx ; mov ax,flat_data_sel mov ds,ax ; GetThread mov es,eax mov ecx,es:p_tls_bitmap atRetry: bsf eax, dword ptr [ecx] jnz atOk ; add ecx,4 bsf eax, dword ptr [ecx] jnz atOk ; or eax,-1 jmp atDone atOk: btr dword ptr [ecx], eax jnc atRetry ; inc eax btr dword ptr [ecx], eax jc atDecode ; dec eax bts dword ptr [ecx], eax inc ecx jmp atRetry atDecode: sub ecx,es:p_tls_bitmap shl ecx,3 dec eax add eax,ecx atDone: pop ecx pop es pop ds ret AllocateTls_ Endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; NAME: FreeTls ; ; DESCRIPTION: Free TLS ; ; PARAMETERS: ECX Entry ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; public FreeTls_ FreeTls_ Proc near push ds push es push eax ; mov ax,flat_data_sel mov ds,ax ; GetThread mov es,eax mov eax,es:p_tls_bitmap ; cmp ecx, 64 jae ftDone ; bts dword ptr [eax],ecx inc ecx bts dword ptr [eax],ecx ftDone: pop eax pop es pop ds ret FreeTls_ Endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; NAME: GetTls ; ; DESCRIPTION: Get TLS data ; ; PARAMETERS: ECX Entry ; ; RETURNS: EDX:EAX Data ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; public GetTls_ GetTls_ Proc near push ds ; GetThread mov ds,eax mov edx,ds:p_tls_array ; mov ax,flat_data_sel mov ds,ax ; xor eax,eax cmp ecx,64 jnc gtDone ; mov eax,[edx + ecx * 4] mov edx,[edx + ecx * 4 + 4] gtDone: pop ds ret GetTls_ Endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; NAME: SetTls ; ; DESCRIPTION: Set TLS data ; ; PARAMETERS: ECX Entry ; EDX:EAX Data ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; public SetTls_ SetTls_ Proc near push ds push edx push edi ; push eax ; GetThread mov ds,eax mov edi,ds:p_tls_array mov ax,flat_data_sel mov ds,ax ; pop eax ; cmp ecx,64 jnc stDone ; mov [edi + ecx * 4], eax mov [edi + ecx * 4 + 4], edx stDone: pop edi pop edx pop ds ret SetTls_ Endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; NAME: init ; ; DESCRIPTION: Init driver ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; public InitSecure_ InitSecure_ Proc near mov ax,cs mov ds,ax mov es,ax ; mov edi,OFFSET delete_secure_connection mov ax,SECURE_HANDLE RegisterHandle ; mov esi,OFFSET create_secure_connection mov edi,OFFSET create_secure_connection_name xor dx,dx mov ax,create_secure_connection_nr RegisterBimodalUserGate ; ret InitSecure_ ENDP _TEXT ENDS END