Fix sttring overrun issue
parent
646d2a19da
commit
700f1a41b5
|
@ -72,7 +72,7 @@ concurrency.promises byte-arrays ;
|
||||||
"resource:extra/openssl/test/server.pem" >>key-file
|
"resource:extra/openssl/test/server.pem" >>key-file
|
||||||
"resource:extra/openssl/test/root.pem" >>ca-file
|
"resource:extra/openssl/test/root.pem" >>ca-file
|
||||||
"resource:extra/openssl/test/dh1024.pem" >>dh-file
|
"resource:extra/openssl/test/dh1024.pem" >>dh-file
|
||||||
"password" >byte-array >>password
|
"password" >>password
|
||||||
[
|
[
|
||||||
"127.0.0.1" 0 <inet4> <secure> ascii <server> [
|
"127.0.0.1" 0 <inet4> <secure> ascii <server> [
|
||||||
dup addr>> addrspec>> port>> "port" get fulfill
|
dup addr>> addrspec>> port>> "port" get fulfill
|
||||||
|
|
|
@ -7,7 +7,7 @@ openssl secure-socket-backend [
|
||||||
"resource:extra/openssl/test/server.pem" >>key-file
|
"resource:extra/openssl/test/server.pem" >>key-file
|
||||||
"resource:extra/openssl/test/root.pem" >>ca-file
|
"resource:extra/openssl/test/root.pem" >>ca-file
|
||||||
"resource:extra/openssl/test/dh1024.pem" >>dh-file
|
"resource:extra/openssl/test/dh1024.pem" >>dh-file
|
||||||
"password" ascii string>alien >>password
|
"password" >>password
|
||||||
[ ] with-secure-context
|
[ ] with-secure-context
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ openssl secure-socket-backend [
|
||||||
<secure-config>
|
<secure-config>
|
||||||
"resource:extra/openssl/test/server.pem" >>key-file
|
"resource:extra/openssl/test/server.pem" >>key-file
|
||||||
"resource:extra/openssl/test/root.pem" >>ca-file
|
"resource:extra/openssl/test/root.pem" >>ca-file
|
||||||
"wrong password" ascii string>alien >>password
|
"wrong password" >>password
|
||||||
[ ] with-secure-context
|
[ ] with-secure-context
|
||||||
] must-fail
|
] must-fail
|
||||||
] with-variable
|
] with-variable
|
||||||
|
|
|
@ -5,7 +5,7 @@ math.order combinators init alien alien.c-types alien.strings libc
|
||||||
continuations destructors debugger inspector
|
continuations destructors debugger inspector
|
||||||
locals unicode.case
|
locals unicode.case
|
||||||
openssl.libcrypto openssl.libssl
|
openssl.libcrypto openssl.libssl
|
||||||
io.backend io.ports io.files io.encodings.ascii io.sockets.secure ;
|
io.backend io.ports io.files io.encodings.8-bit io.sockets.secure ;
|
||||||
IN: openssl
|
IN: openssl
|
||||||
|
|
||||||
! This code is based on http://www.rtfm.com/openssl-examples/
|
! This code is based on http://www.rtfm.com/openssl-examples/
|
||||||
|
@ -68,7 +68,7 @@ TUPLE: openssl-context < secure-context aliens ;
|
||||||
] alien-callback ;
|
] alien-callback ;
|
||||||
|
|
||||||
: default-pasword ( ctx -- alien )
|
: default-pasword ( ctx -- alien )
|
||||||
[ config>> password>> malloc-byte-array ] [ aliens>> ] bi
|
[ config>> password>> latin1 malloc-string ] [ aliens>> ] bi
|
||||||
[ push ] [ drop ] 2bi ;
|
[ push ] [ drop ] 2bi ;
|
||||||
|
|
||||||
: set-default-password ( ctx -- )
|
: set-default-password ( ctx -- )
|
||||||
|
@ -181,7 +181,7 @@ M: ssl-handle dispose*
|
||||||
X509_get_subject_name
|
X509_get_subject_name
|
||||||
NID_commonName 256 <byte-array>
|
NID_commonName 256 <byte-array>
|
||||||
[ 256 X509_NAME_get_text_by_NID ] keep
|
[ 256 X509_NAME_get_text_by_NID ] keep
|
||||||
swap -1 = [ drop f ] [ ascii alien>string ] if ;
|
swap -1 = [ drop f ] [ latin1 alien>string ] if ;
|
||||||
|
|
||||||
: check-common-name ( host ssl-handle -- )
|
: check-common-name ( host ssl-handle -- )
|
||||||
SSL_get_peer_certificate common-name 2dup [ >lower ] bi@ =
|
SSL_get_peer_certificate common-name 2dup [ >lower ] bi@ =
|
||||||
|
|
Loading…
Reference in New Issue