ECP: Increase MBEDTLS_ECP_GRP_OID_MAX_SIZE to 32

Provide documentation for the source of the change
This commit is contained in:
Unknown 2018-02-08 08:01:09 -05:00
parent 4d092dc42c
commit 4938419f17
3 changed files with 11 additions and 3 deletions

View file

@ -504,8 +504,14 @@ int mbedtls_ecp_tls_write_group( const mbedtls_ecp_group *grp, size_t *olen,
#if defined(MBEDTLS_ASN1_WRITE_C) && defined(MBEDTLS_OID_C)
/**
* \brief Maximum size of the output of mbedtls_ecp_ansi_write_group
*
* \note The maximum size of the OID of a supported group + 2 for
* tag and length. Maximum size 30 is based on the length of
* the OID for primeCurves 10-38 over GF(p) defined by the
* CDC Group, as they seem to have the longest OID out of
* curves in use.
*/
#define MBEDTLS_OID_EC_GRP_MAX_SIZE 12
#define MBEDTLS_ECP_GRP_OID_MAX_SIZE ( 30 + 2 )
/**
* \brief Write the ANSI X9.62/RFC5480 OID ECParameters of a group

View file

@ -282,6 +282,8 @@
/*
* ECParameters namedCurve identifiers, from RFC 5480, RFC 5639, and SEC2
* When adding new OID's, please update \c MBEDTLS_ECP_GRP_OID_MAX_SIZE
* in ecp.h
*/
/* secp192r1 OBJECT IDENTIFIER ::= {

View file

@ -417,8 +417,8 @@ exit:
void ecp_ansi_write_group( int id, char *hex )
{
mbedtls_ecp_group grp;
unsigned char good[MBEDTLS_OID_EC_GRP_MAX_SIZE];
unsigned char tested[MBEDTLS_OID_EC_GRP_MAX_SIZE];
unsigned char good[MBEDTLS_ECP_GRP_OID_MAX_SIZE];
unsigned char tested[MBEDTLS_ECP_GRP_OID_MAX_SIZE];
size_t good_len = unhexify( good, hex );
size_t received_len = 0;
int ret = 0;