-
Notifications
You must be signed in to change notification settings - Fork 96
ASN1 integer encoding #289
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
Merged
gilles-peskine-arm
merged 46 commits into
Mbed-TLS:development
from
bjwtaylor:ASN1-integer-encoding
Jul 1, 2025
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
418991d
Move mbedtls_asn1_write_mpi to bignum.h as it is now private
282822c
Add initial test for asn1 encode
b78910c
Added initial POC
f13eeed
Add additional test cases
e78276c
added in processor endian detection and conversion
d2633bb
Fix size check test and adjust to re-use buffer where possible
87fd8bb
tidy up of asn1 encode tests
67b7acb
remove data_t
30dd96f
Update tests and fix endian
28bd96c
Remove debug and add code to handle clause 8.3.2 of the X.690-0207 spec
4d25d3f
Remove debug lines
davidhorstmann-arm 2a31846
tidied up error handling
819b81d
Add function docs for asn1_write
c119952
Correct return value of p after an error
2cae6ad
Improve bignum writing in asn1_write
c1b7fab
Add code to handle leading zero's
a1a7b01
Improve naming of asn1_write test cases
5368b6e
fix style issues and tidy up
1a3e2cb
Remove sign parameter
davidhorstmann-arm 23ff8ee
Fix typo
davidhorstmann-arm 387122d
Remove imprecise warning
davidhorstmann-arm 72ff18c
Clarify integer start and length descriptions
davidhorstmann-arm 4fbeec3
Rewrite function description
davidhorstmann-arm 8492d85
Preexisting: Use the definite article in notes
davidhorstmann-arm e43ee4a
Rename input_buffer_size -> output_buffer_size
davidhorstmann-arm 0cf4f8e
Remove unnecessary error checks:
davidhorstmann-arm e7e4257
Adjust for leading zeroes before checking space
davidhorstmann-arm b4e1e82
Fix buffer overread in leading-zero count
davidhorstmann-arm fc3827c
Add basic positive testcase
davidhorstmann-arm cf0da9b
Allow NULL pointers for zero-length output buffers
davidhorstmann-arm 85ee411
Add remaining positive testcases
davidhorstmann-arm cdfd40f
Fix bug when dealing with the value zero
davidhorstmann-arm 1a26241
Do not attempt to memset() a zero-length buffer
davidhorstmann-arm 852428c
Add note about overlap
davidhorstmann-arm 21b91d2
Remove unnecessary testcases
davidhorstmann-arm 1036671
Remove NULL pointer checks
davidhorstmann-arm 2df32f5
Tidy up checks for successful encoding cases
davidhorstmann-arm 00a3949
Add extra testcases for interesting leading-zeroes
davidhorstmann-arm 724654c
Allocate a new buffer for test inputs
davidhorstmann-arm cd9f70a
Set the test step
davidhorstmann-arm ebbbb01
Remove useless cast
davidhorstmann-arm 0f6b5ba
Do not check for zero-length output buffers
davidhorstmann-arm 16e2a36
Re-add zero-length test
davidhorstmann-arm 49db86f
Remove guarantee about p on failure
davidhorstmann-arm 4e726ae
Fix buffer overread in tests
davidhorstmann-arm 6a525ed
Add ChangeLog entry for ASN.1 integer function
davidhorstmann-arm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Features | ||
| * Add a new function mbedtls_asn1_write_integer() that encodes an arbitrary | ||
| precision integer into ASN.1 DER format. This function replaces | ||
| mbedtls_asn1_write_mpi(), which has been made internal-only. | ||
| Removals | ||
| * Remove mbedtls_asn1_write_mpi() from the public API. This has been replaced | ||
| by mbedtls_asn1_write_integer(), which does not use the legacy mbedtls_mpi | ||
| type. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: