Giter Site home page Giter Site logo

Check Send/Sync about rust-mbedtls HOT 2 CLOSED

fortanix avatar fortanix commented on August 10, 2024
Check Send/Sync

from rust-mbedtls.

Comments (2)

jethrogb avatar jethrogb commented on August 10, 2024

I did some investigation:

Pk is Sync if:

  • It's an RSA key and mbedTLS threading is enabled.
  • It's an EC key of type ECKEY
    • In general: EC operations are not Sync, and in particular mbedtls_ecp_mul, mbedtls_ecp_muladd and by extension mbedtls_ecdsa_sign and mbedtls_ecdsa_verify.
    • The PK wrapper for keys of type ECKEY makes a stack-local copy of the necessary data (EC group) before invoking any of the above-mentioned functions
  • It's an EC key of type ECKEY_DH (because no operation can be called on such a key, only sign/verify/encrypt/decrypt are supported on Pk. DH operations are separate)

Pk is not Sync if:

  • It's an EC key of type ECDSA. There are no stack-local copies. It's very unlikely you'll have a Pk with an EC key type of ECDSA, because loading from DER/PEM always results in a ECKEY or ECKEY_DH (see mbedtls_oid_get_pk_alg).

Operations directly on the underlying key objects of a Pk of any EC type are probably not Sync.

All of Config's and Context's uses of a shared Pk are therefore probably Sync.

from rust-mbedtls.

jethrogb avatar jethrogb commented on August 10, 2024

Problem: SSL Context is only Sync if the RNG is Sync

from rust-mbedtls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.