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

Fixing inconsistent crypto consts #190

Conversation

JosePisco
Copy link
Contributor

Declared crypto consts were describing sizes in both bits and bytes resulting in inconsistent comparisons and harder to read code.

@JosePisco JosePisco linked an issue Feb 21, 2024 that may be closed by this pull request
@JosePisco JosePisco changed the base branch from develop to 186-accurate-cryptographicusagemask-for-kmip-creation-of-rsa-keys February 21, 2024 09:47
@JosePisco JosePisco requested review from ThibsG and Manuthor February 21, 2024 10:13
Copy link
Contributor

@Manuthor Manuthor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this!

@@ -10,13 +10,16 @@ use crate::error::KmipError;
#[cfg(feature = "fips")]
use crate::kmip_bail;

/// Minimum random salt size in bytes to use when deriving keys.
const FIPS_MIN_SALT_SIZE: usize = 16;
Copy link
Contributor

@Manuthor Manuthor Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size in bytes and size in bits are a bit confusing. Does it make sense to uniformize them in the same unity ? Could we adopt a naming variable convention to make it clear that those constants are in bytes or in bits. Also, I see XXX_KLEN, XXX_HLEN, XXX_SIZE, XXX_SIZE_BITS and XXX_LENGTH. Should we use a unique suffix to those variables (_SIZE for example?)

@Manuthor Manuthor merged commit 4a2b9ca into 186-accurate-cryptographicusagemask-for-kmip-creation-of-rsa-keys Mar 1, 2024
23 checks passed
@Manuthor Manuthor deleted the 188-fixing-inconsistent-crypto-consts branch March 1, 2024 15:44
Manuthor pushed a commit that referenced this pull request Mar 1, 2024
…189)

* feat: dynamic cryptographic usage mask set and check

* feat: code enhancement

* feat: style + load provider in fips tests

* feat: load fips provider on rsa tests

* fix: inconsistent crypto consts (#190)

* feat: harmonising crypto consts in bits

* feat: style + load provider in fips tests

* feat: load fips provider on rsa tests

* fix: better const naming for passwd derivation
Manuthor pushed a commit that referenced this pull request Mar 1, 2024
…ic curves and RSA (#187 and #189)

* Move crypto subcrate into kmip and dispatch other elements

* Remove unused feature curve25519

* Set openssl as wanted feature for kmip deps in pyo3

* Update patched iana-time-zone to a non yanked version

* feat: better crypto const organization

* feat: better zeroization

* feat: finalize zeroization

* revert type in kmip operation back to vec<u8>

* fix build

* revert commit reverting zeroizing + modification attempt at serializer

* Temporarily ignore rustsec from pqc-kyber

* feat: code enhancement deserialize

* feat: dynamic cryptographic algorithm and usage for creation. Tests fail

* feat: dynami mask and cryptographic algorithm for ecc key creation

* fix: loose comparison

* feat: tests + refacto dynamic mask and algo for ecc key creation

* fix: fix compile from bad merge

* fix lint

* feat: distinguish private and public key masks

* fix: remove redundant refrence

* feat: code enhancement

* fix: unused variable in non-fips mode

* feat: style + load provider in fips tests

* fix: remove P-192 from fips mask construction

* feat: accurate CryptographicUsageMask for KMIP creation of RSA keys (#189)

* feat: dynamic cryptographic usage mask set and check

* feat: code enhancement

* feat: style + load provider in fips tests

* feat: load fips provider on rsa tests

* fix: inconsistent crypto consts (#190)

* feat: harmonising crypto consts in bits

* feat: style + load provider in fips tests

* feat: load fips provider on rsa tests

* fix: better const naming for passwd derivation

---------

Co-authored-by: ThibsG <thibsg@pm.me>
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

Successfully merging this pull request may close these issues.

Fixing inconsistent crypto consts
3 participants