[EC][ASN1] Detect missing OID when serializing EC parameters and keys
authorNicola Tuveri <nic.tuv@gmail.com>
Sun, 28 Jun 2020 21:53:46 +0000 (00:53 +0300)
committerNicola Tuveri <nic.tuv@gmail.com>
Mon, 6 Jul 2020 16:15:36 +0000 (19:15 +0300)
commite0137ca92b4abf65acde15b255ae58d7e76af22f
treec12f559221429f52e08a5df2f6c167a1127aabcb
parent8c330e1939d6b7db93a963116354ef80ca0babb3
[EC][ASN1] Detect missing OID when serializing EC parameters and keys

The following built-in curves do not have an assigned OID:

- Oakley-EC2N-3
- Oakley-EC2N-4

In general we shouldn't assume that an OID is always available.

This commit detects such cases, raises an error and returns appropriate
return values so that the condition can be detected and correctly
handled by the callers, when serializing EC parameters or EC keys with
the default `ec_param_enc:named_curve`.

Fixes #12306

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12313)
crypto/ec/ec_ameth.c
crypto/ec/ec_asn1.c
crypto/ec/ec_err.c
crypto/err/openssl.txt
crypto/pem/pem_lib.c
include/openssl/ecerr.h
providers/common/include/prov/providercommonerr.h
providers/common/provider_err.c
providers/implementations/serializers/serializer_ec.c