ASN1: Fix i2d_provided() return value
authorRichard Levitte <levitte@openssl.org>
Fri, 14 May 2021 05:23:51 +0000 (07:23 +0200)
committerBenjamin Kaduk <bkaduk@akamai.com>
Sat, 15 May 2021 20:16:31 +0000 (13:16 -0700)
commita8457b4c3d86a42209eabe90eddb605f59041f9e
tree9ce599e1c95035339e9e3b54b214269b362de492
parent522827160936319841f3f83fd246f92da96f5686
ASN1: Fix i2d_provided() return value

i2d_provided() - which is the internal provider data function for
i2d_KeyParams(), i2d_PrivateKey(), i2d_PublicKey() - didn't treat the
returned length from OSSL_ENCODER_to_data() quite as well as it should
have.  A simple added flag that records the state of |*pp| before
calling OSSL_ENCODER_to_data() fixes the problem.

Fixes #14655

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/15277)
crypto/asn1/i2d_evp.c