Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

add assert for signature length check to stop API misuse. #187

Merged
merged 1 commit into from
Dec 25, 2023

Conversation

longlongyang
Copy link
Contributor

@longlongyang longlongyang commented Dec 25, 2023

Currently, function ecc_signature_bin_to_der use the short definite length DER encoding, the length of data in the V field must be <= 127 octets. While for the current set of supported curves, this should always be the case, this may change in the future. To prevent the API misuse, this PR add assert check for the signature length.

fn ecc_signature_bin_to_der(
signature: &[u8],
der_signature: &mut [u8],
curve_algo: SpdmBaseAsymAlgo,
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think we need to add curve_algo.
We just need to check sig.len() == NIST_P256_LEN or NIST_P384_LEN.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dont think we need to add curve_algo. We just need to check sig.len() == NIST_P256_LEN or NIST_P384_LEN.

updated.

@longlongyang longlongyang force-pushed the curvecheck branch 2 times, most recently from 1a78c6f to 9bccd70 Compare December 25, 2023 02:03
Signed-off-by: Yang, Longlong <longlong.yang@intel.com>
@longlongyang longlongyang changed the title add assert for curve check to stop API misuse. add assert for signature length check to stop API misuse. Dec 25, 2023
@jyao1 jyao1 merged commit e65c7f9 into intel:main Dec 25, 2023
47 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants