[Vm-dev] SqueakSSL plugin issue

Levente Uzonyi leves at caesar.elte.hu
Tue Jul 27 11:12:38 UTC 2021


Hi All,

I ran into a case where primitiveEncrypt of the SqueakSSL plugin returns 
-1.
On the image side, SqueakSSL >> 
#primitiveSSL:encrypt:startingAt:count:into: is sent with srcBuf and
dstBuf being two 4096 long ByteArrays, start is 1 and length is 4096, so
the input has the same size as the output, and all the bytes are to be
encrypted.
I enabled logging, and the following two lines were produced:

sqEncryptSSL: Encrypting 4096 bytes
sqCopyBioSSL: 4125 bytes pending; buffer size 4096

Somehow, the 4096 bytes became 4125 bytes, which may be normal, but the
code clearly expects no more than 4096 bytes to be there[1].
The hardcoded -1 is fishy on its own, and perhaps BIO_read is able to
handle the situation and read only as many bytes that fit into the output
buffer.
If so, the guard is unnecessary, but I'm not familiar with the code at
all, so I don't know what's the correct thing to do.

I can work it around by providing smaller chunks or larger buffers but I
think it would be forth fixing this.
Any ideas?


Levente

[1] https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/d494240736f7c0309e3e819784feb1d53ed0985a/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.inc#L70


More information about the Vm-dev mailing list