Menu

#20 add support for cryptlib 3.4.3.1

Request
open
nobody
cryptlib (1)
5
2017-09-25
2017-09-25
No

I just upgraded cryptlib from v3.4.2 to v3.4.3.1 and found some issues using it with Synapse (r207 just updated from svn):

  • Fails to compile: CRYPT_CERTINFO_FINGERPRINT does not exists anymore. Replaced it with CRYPT_CERTINFO_FINGERPRINT_SHA1:

function TSSLCryptLib.GetPeerFingerprint: string;
var
cert: CRYPT_CERTIFICATE;
begin
Result := '';
if FcryptSession = CRYPT_SESSION(CRYPT_SESSION_NONE) then
Exit;
cryptGetAttribute(FCryptSession, CRYPT_SESSINFO_RESPONSE, cert);
Result := GetString(cert, CRYPT_CERTINFO_FINGERPRINT_SHA1);
cryptDestroyCert(cert);
end;

  • TTCPBlockSocket.RecvPacket got very slooooow. Is solved it setting momentarily the read timeout to zero before the call to CryptPopData in TSSLCryptLib.PopAll, so it does only retrieve already received data:

function TSSLCryptLib.PopAll: string;
const
BufferMaxSize = 32768;
var
Outbuffer: string;
WriteLen, T: integer;
begin
Result := '';
repeat
setlength(outbuffer, BufferMaxSize);
Writelen := 0;
if not SSLCheck(cryptGetAttribute(FCryptSession, CRYPT_OPTION_NET_READTIMEOUT, T)) then
Break;
try
if not SSLCheck(cryptSetAttribute(FCryptSession, CRYPT_OPTION_NET_READTIMEOUT, 0)) then
Break;
SSLCheck(CryptPopData(FCryptSession, @OutBuffer[1], BufferMaxSize, Writelen));
if FLastError <> 0 then
Break;
finally
// Can't break out of a finally, but CRYPT_OPTION_NET_READTIMEOUT never fails...
if not SSLCheck(cryptSetAttribute(FCryptSession, CRYPT_OPTION_NET_READTIMEOUT, T)) then
; //Break;
end;
if WriteLen > 0 then
begin
setlength(outbuffer, WriteLen);
Result := Result + outbuffer;
end;
until WriteLen = 0;
end;

Best regards,
Mario

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.