Add support for PKCS12_set_mac #2128
Draft
+216
−66
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.
Issues:
Addresses
CryptoAlg-2821
Description of changes:
Ruby has added a binding for an additional function called
PKCS12_set_mac
in it's master branch: ruby/ruby@c79b435 This was discovered prior to the PR for Ruby's CI integration with the master branch being merged: #2071OpenSSL's implementation of the function directly sets a designated mac field within the
PKCS12
structure. OurPKCS12
structure is folded into a string of bytes along with its length and there aren't any available fields for us to directly set. This means that AWS-LC's implementation ofPKCS12_set_mac
has to parse the proper contents fromPKCS12
and rerun the key and mac generation with the new parameters provided.Call-outs:
PKCS12_get_key_and_certs
, but the logic can't be shared. This is because we need to maintain pointers to certain parts of the CBS parsers inPKCS12_set_mac
, so that we can properly rewrite the contents later.PKCS12_create
andPKCS12_set_mac
to a single function calledpkcs12_gen_and_write_mac
.Testing:
New Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.