libcrypto: wrap more parts of the BIO_ api and add unit tests
parent
ed34163e54
commit
5492b8e46b
|
@ -0,0 +1,24 @@
|
||||||
|
USING:
|
||||||
|
byte-arrays
|
||||||
|
kernel
|
||||||
|
openssl.libcrypto
|
||||||
|
sequences
|
||||||
|
splitting
|
||||||
|
strings
|
||||||
|
tools.test ;
|
||||||
|
IN: openssl.libcrypto.tests
|
||||||
|
|
||||||
|
[ t ] [ "factorcode.org:80" BIO_new_connect bio_st? ] unit-test
|
||||||
|
|
||||||
|
[ 1 ] [
|
||||||
|
"factorcode.org:80" BIO_new_connect BIO_C_DO_STATE_MACHINE 0 f BIO_ctrl
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
[ "HTTP/1.1 200 Document follows" ] [
|
||||||
|
"factorcode.org:80" BIO_new_connect
|
||||||
|
[ BIO_C_DO_STATE_MACHINE 0 f BIO_ctrl drop ]
|
||||||
|
[
|
||||||
|
[ "GET / HTTP/1.1\r\nHost: factorcode.org\r\n\r\n" BIO_puts drop ]
|
||||||
|
[ 1024 <byte-array> dup swapd 1023 BIO_read drop ] bi
|
||||||
|
] bi >string "\r\n" split first
|
||||||
|
] unit-test
|
|
@ -30,32 +30,23 @@ STRUCT: bio-method
|
||||||
{ destroy void* }
|
{ destroy void* }
|
||||||
{ callback-ctrl void* } ;
|
{ callback-ctrl void* } ;
|
||||||
|
|
||||||
STRUCT: bio
|
|
||||||
{ method void* }
|
|
||||||
{ callback void* }
|
|
||||||
{ cb-arg void* }
|
|
||||||
{ init int }
|
|
||||||
{ shutdown int }
|
|
||||||
{ flags int }
|
|
||||||
{ retry-reason int }
|
|
||||||
{ num int }
|
|
||||||
{ ptr void* }
|
|
||||||
{ next-bio void* }
|
|
||||||
{ prev-bio void* }
|
|
||||||
{ references int }
|
|
||||||
{ num-read ulong }
|
|
||||||
{ num-write ulong }
|
|
||||||
{ crypto-ex-data-stack void* }
|
|
||||||
{ crypto-ex-data-dummy int } ;
|
|
||||||
|
|
||||||
CONSTANT: BIO_NOCLOSE 0x00
|
CONSTANT: BIO_NOCLOSE 0x00
|
||||||
CONSTANT: BIO_CLOSE 0x01
|
CONSTANT: BIO_CLOSE 0x01
|
||||||
|
|
||||||
CONSTANT: RSA_3 0x3
|
CONSTANT: RSA_3 0x3
|
||||||
CONSTANT: RSA_F4 0x10001
|
CONSTANT: RSA_F4 0x10001
|
||||||
|
|
||||||
CONSTANT: BIO_C_SET_SSL 109
|
CONSTANT: BIO_C_SET_CONNECT 100
|
||||||
CONSTANT: BIO_C_GET_SSL 110
|
CONSTANT: BIO_C_DO_STATE_MACHINE 101
|
||||||
|
CONSTANT: BIO_C_SET_NBIO 102
|
||||||
|
CONSTANT: BIO_C_SET_PROXY_PARAM 103
|
||||||
|
CONSTANT: BIO_C_SET_FD 104
|
||||||
|
CONSTANT: BIO_C_GET_FD 105
|
||||||
|
CONSTANT: BIO_C_SET_FILE_PTR 106
|
||||||
|
CONSTANT: BIO_C_GET_FILE_PTR 107
|
||||||
|
CONSTANT: BIO_C_SET_FILENAME 108
|
||||||
|
CONSTANT: BIO_C_SET_SSL 109
|
||||||
|
CONSTANT: BIO_C_GET_SSL 110
|
||||||
|
|
||||||
LIBRARY: libcrypto
|
LIBRARY: libcrypto
|
||||||
|
|
||||||
|
@ -90,25 +81,27 @@ STRUCT: bio_st
|
||||||
{ init int }
|
{ init int }
|
||||||
{ shutdown int }
|
{ shutdown int }
|
||||||
{ flags int }
|
{ flags int }
|
||||||
{ retry_reason int }
|
{ retry-reason int }
|
||||||
{ num int }
|
{ num int }
|
||||||
{ ptr void* }
|
{ ptr void* }
|
||||||
{ next_bio bio_st* }
|
{ next-bio bio_st* }
|
||||||
{ prev_bio bio_st* }
|
{ prev-bio bio_st* }
|
||||||
{ references int }
|
{ references int }
|
||||||
{ num_read ulong }
|
{ num-read ulong }
|
||||||
{ num_write ulong }
|
{ num-write ulong }
|
||||||
{ ex_data CRYPTO_EX_DATA } ;
|
{ ex-data CRYPTO_EX_DATA } ;
|
||||||
TYPEDEF: bio_st BIO
|
TYPEDEF: bio_st BIO
|
||||||
|
|
||||||
FUNCTION: bio* BIO_new_file ( c-string filename, c-string mode ) ;
|
FUNCTION: BIO* BIO_new_file ( c-string filename, c-string mode ) ;
|
||||||
|
|
||||||
FUNCTION: int BIO_printf ( bio* bio, c-string format ) ;
|
FUNCTION: int BIO_printf ( BIO* bio, c-string format ) ;
|
||||||
|
|
||||||
FUNCTION: long BIO_ctrl ( void* bio, int cmd, long larg, void* parg ) ;
|
FUNCTION: long BIO_ctrl ( void* bio, int cmd, long larg, void* parg ) ;
|
||||||
|
|
||||||
FUNCTION: BIO* BIO_new_socket ( int fd, int close-flag ) ;
|
FUNCTION: BIO* BIO_new_socket ( int fd, int close-flag ) ;
|
||||||
|
|
||||||
|
FUNCTION: BIO* BIO_new_connect ( c-string name ) ;
|
||||||
|
|
||||||
FUNCTION: void* BIO_new ( void* method ) ;
|
FUNCTION: void* BIO_new ( void* method ) ;
|
||||||
|
|
||||||
FUNCTION: int BIO_set ( void* bio, void* method ) ;
|
FUNCTION: int BIO_set ( void* bio, void* method ) ;
|
||||||
|
@ -117,13 +110,13 @@ FUNCTION: int BIO_free ( void* bio ) ;
|
||||||
|
|
||||||
FUNCTION: void* BIO_push ( void* bio, void* append ) ;
|
FUNCTION: void* BIO_push ( void* bio, void* append ) ;
|
||||||
|
|
||||||
FUNCTION: int BIO_read ( void* b, void* buf, int len ) ;
|
FUNCTION: int BIO_read ( BIO* bio, void* buf, int len ) ;
|
||||||
|
|
||||||
FUNCTION: int BIO_gets ( void* b, c-string buf, int size ) ;
|
FUNCTION: int BIO_gets ( void* b, c-string buf, int size ) ;
|
||||||
|
|
||||||
FUNCTION: int BIO_write ( void* b, void* buf, int len ) ;
|
FUNCTION: int BIO_write ( void* b, void* buf, int len ) ;
|
||||||
|
|
||||||
FUNCTION: int BIO_puts ( void* bp, c-string buf ) ;
|
FUNCTION: int BIO_puts ( BIO* bio, c-string buf ) ;
|
||||||
|
|
||||||
FUNCTION: ulong ERR_get_error ( ) ;
|
FUNCTION: ulong ERR_get_error ( ) ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue