Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

SSL3_GET_RECORD:decryption failed or bad record mac #1929

Open
lesn1kk opened this issue Jul 4, 2017 · 3 comments
Open

SSL3_GET_RECORD:decryption failed or bad record mac #1929

lesn1kk opened this issue Jul 4, 2017 · 3 comments
Labels

Comments

@lesn1kk
Copy link
Member

lesn1kk commented Jul 4, 2017

Recently while fixing test Can shift data securely I noticed that sometimes it fails with following stack:

Connecting to the localhost:50178
[ThaliCore] TCPListener.socket(_:didAcceptNewSocket:)
[ThaliCore] BrowserRelay.createVirtualSocket(with:)
[ThaliCore] Session.startOutputStream(with:) peer:4A31505D-C170-4E1A-8DA7-87C9FC57A7ED:0
[ThaliCore] Session.session(_:didReceive:withName:fromPeer:) peer:4A31505D-C170-4E1A-8DA7-87C9FC57A7ED:0
[ThaliCore] VirtualSocket.init(inputStream:outputStream:) vsID:45, VS count:13
[ThaliCore] BrowserRelay.didOpenVirtualSocketStreamsHandler
Connected to the localhost:50178
2017-07-04 05:54:33 - DEBUG testThaliMobileNative: 'Client sends data (20 bytes):'
2017-07-04 05:54:33 - DEBUG testThaliMobileNative: 'Client data flushed'
Client socket error: 6145814528:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac:../deps/openssl/openssl/ssl/s3_pkt.c:518:
 @native:jxcore_js_object:3:12
[email protected]:210:8
[email protected]:418:8
$0.prototype.read@_stream_readable.js:308:1
[email protected]:336:1
$d@_stream_writable.js:240:1
[ThaliCore] Session.session(_:peer:didChange:) peer:4A31505D-C170-4E1A-8DA7-87C9FC57A7ED:0 state: connected -> notConnected
[ThaliCore] Browser: session notConnected Peer(uuid: "4A31505D-C170-4E1A-8DA7-87C9FC57A7ED", generation: 0)
[ThaliCore] BrowserRelay.closeRelay() disconnecting:false
[ThaliCore] TCPListener.stopListeningForConnectionsAndDisconnectClients() port:50178
[ThaliCore] VirtualSocket.closeStreams() vsID:45
[ThaliCore] BrowserRelay.didCloseVirtualSocketStreamsHandler
[ThaliCore] Session.disconnect() peer:4A31505D-C170-4E1A-8DA7-87C9FC57A7ED:0
[ThaliCore] TCPListener.socketDidDisconnect(_:withError:) listening socket error:nil
[ThaliCore] Browser: session notConnected removed relay for Peer(uuid: "4A31505D-C170-4E1A-8DA7-87C9FC57A7ED", generation: 0)
not ok 124 Error: 6145814528:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac:../deps/openssl/openssl/ssl/s3_pkt.c:518: 
  ---
    operator: fail
  ...

It looks like there was some issue with OpenSSL. Tested on two iOS devices.

@jareksl
Copy link
Member

jareksl commented Jul 21, 2017

The OpenSSL error:
DEBUG thaliReplicationPeerAction: Got error on replication - 500 6147371008:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac:../deps/openssl/openssl/ssl/s3_pkt.c:518
is happening while decrypting a received https packet and given https doesn't support re-sending packets. This error needs to be handled at application level.

@lesn1kk
Copy link
Member Author

lesn1kk commented Jul 25, 2017

Today I faced this issue when running thali on TeamONE P2P application. It turned out, that when this error occurs, we are not able to replicate at all, even when trying multiple times. I got this error in every attempt of replication. After app restart, it worked ok again. So this is definitely an issue, it can block us from working at all.
It is also possible that this is caused by some data corruption or temporary radio failures.

@lesn1kk
Copy link
Member Author

lesn1kk commented Sep 18, 2017

I manage to reproduce the issue using ThaliTestApp from mlesnic_master_additional_attachments when adding 1mb attachments.
Logs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants