patch for packet size at ssl:send of new_ssl implementation

YAMASHINA Hio hio@REDACTED
Tue Feb 9 07:22:03 CET 2010


Hi all.

Even if there is {packet,PacketType} option enabled,
no size bytes are prepened by ssl:send with {ssl_imp,new}.
If using with {ssl_imp,old}, it is prepended correctly.

git fetch git://github.com/hio/otp.git packet_option_for_new_ssl_send

Reproduction code and samlpe ssl certification are attached.

Ceritication was created with::
> openssl genrsa -out server_key.pem
> seq 1 7 | sed -e s/.// | openssl req -new -x509 \
    -key server_key.pem -out server_cert.pem && echo

Cient process sends some words with some {packet,N} option.
Server process receives {packet,raw}, thus it can see prepended size
bytes.

Current implementation outputs::

client: send: (packet=0) "test"
server: recv: (packet=?) "test"
client: send: (packet=2) "AAAA"
server: recv: (packet=?) "AAAA"
client: send: (packet=1) "BBBB"
server: recv: (packet=?) "BBBB"
client: send: (packet=4) "CCCC"
server: recv: (packet=?) "CCCC"
client: send: (packet=0) "DDDD"
server: recv: (packet=?) "DDDD"

Server process receives just client send ones.

After patched::

client: send: (packet=0) "test"
server: recv: (packet=?) "test"
client: send: (packet=2) "AAAA"
server: recv: (packet=2) "\x00\x04AAAA"
client: send: (packet=1) "BBBB"
server: recv: (packet=1) "\x04BBBB"
client: send: (packet=4) "CCCC"
server: recv: (packet=4) "\x00\x00\x00\x04CCCC"
client: send: (packet=0) "DDDD"
server: recv: (packet=?) "DDDD"

Size bytes are prepended currectly.


Regards.

-- 
YAMASHINA Hio <hio@REDACTED>, <hio@REDACTED>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: server_key.pem
Type: application/octet-stream
Size: 497 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20100209/f0dfaba2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_ssl.erl
Type: application/octet-stream
Size: 3700 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20100209/f0dfaba2/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: server_cert.pem
Type: application/octet-stream
Size: 814 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20100209/f0dfaba2/attachment-0002.obj>


More information about the erlang-patches mailing list