diff options
author | Adam Langley <agl@google.com> | 2016-01-14 20:32:24 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2016-01-19 20:01:37 +0300 |
commit | 62882187c9724ea72860e8bf00144ce589b74818 (patch) | |
tree | 31156418793b365d2ea73d221e9d0f8971ee4cbd /crypto/evp | |
parent | b8ba65a73ac64c554d52a09ef4ee9d427ee764ae (diff) |
Update comments to better document in-place semantics.
(Comment-only change; no functional difference.)
Some code was broken by the |d2i_ECDSA_SIG| change in 87897a8c. It was
passing in a pointer to an existing |ECDSA_SIG| as the first argument
and then simply assuming that the structure would be updated in place.
The comments on the function suggested that this was reasonable.
This change updates the comments that use similar wording to either note
that the function will never update in-place, or else to note that
depending on that is a bad idea for the future.
I've also audited all the uses of these functions that I can find and,
in addition to the one case with |d2i_ECDSA_SIG|, there are several
users of |d2i_PrivateKey| that could become a problem in the future.
I'll try to fix them before it does become an issue.
Change-Id: I769f7b2e0b5308d09ea07dd447e02fc161795071
Reviewed-on: https://boringssl-review.googlesource.com/6902
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/evp_asn1.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/evp/evp_asn1.c b/crypto/evp/evp_asn1.c index c57f4113..da25b99a 100644 --- a/crypto/evp/evp_asn1.c +++ b/crypto/evp/evp_asn1.c @@ -84,6 +84,9 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **out, const uint8_t **inp, } const uint8_t *in = *inp; + /* If trying to remove |old_priv_decode|, note that some code depends on this + * function writing into |*out| and the |priv_decode| path doesn't support + * that. */ if (!ret->ameth->old_priv_decode || !ret->ameth->old_priv_decode(ret, &in, len)) { if (ret->ameth->priv_decode) { |