Manu53
Manu53

Reputation: 101

2 connections on a same server with different ports mbedtls

I am working on an Embedded project with Lwip and mbedTLS stacks.

I a have a thread that manage a connection to a server on the port 21. This connection is encrypted with mbedTLS and everything works well.

Now I need to create another connection on the same server on a different port. This connection would be managed by a different thread.

Can I secured this second connection with the same ssl_context that I used to secure the first connection ? If yes, how should I do it ?

Thank you,

Emmanuel.

Upvotes: 0

Views: 464

Answers (1)

Ron Eldor
Ron Eldor

Reputation: 230

ssl_context is used for a single TLS session, and if you are using two connections, you are by definition establishing two TLS sessions, and as such, should be using two ssl_contexts. Since you should be using two different contexts, each context should have a different port set, when you call mbedtls_ssl_set_bio()

Upvotes: 0

Related Questions