Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pk::len() aligns to bytes #242

Closed
zugzwang opened this issue Apr 5, 2023 · 2 comments
Closed

Pk::len() aligns to bytes #242

zugzwang opened this issue Apr 5, 2023 · 2 comments

Comments

@zugzwang
Copy link
Contributor

zugzwang commented Apr 5, 2023

The documentation for Pk::len() says "Key length in bits". However, it aligns to bytes:

fn main() {
    let mut entropy = mbedtls::rng::OsEntropy::new();
    let mut rng = mbedtls::rng::CtrDrbg::new(Arc::new(entropy), None).unwrap();
    let pk = Pk::generate_rsa(&mut rng, 1026, 3).unwrap();
    assert_eq!(pk.len(), pk.rsa_public_modulus().unwrap().bit_length().unwrap());
}

Fails to assert with left: 1032, right: 1026.

This comes from MbedTLS, we should update the documentation.

@jethrogb
Copy link
Member

jethrogb commented Apr 5, 2023

Known upstream bug Mbed-TLS/mbedtls#868

@zugzwang
Copy link
Contributor Author

zugzwang commented Apr 5, 2023

Thanks, I am closing this, as it will be taken care of upstream.

@zugzwang zugzwang closed this as completed Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants