Minor modifications for alt support in des and ecp

1. Add 3des context to be allowed for alternative defintion
2. Move some ecp structs, to disallow alternative definition of them,
as other modules rely on them
This commit is contained in:
Ron Eldor 2018-04-16 17:40:04 +03:00
parent bf027e736a
commit 05d0e51bb1
2 changed files with 28 additions and 28 deletions

View File

@ -67,10 +67,6 @@ typedef struct
} }
mbedtls_des_context; mbedtls_des_context;
#else /* MBEDTLS_DES_ALT */
#include "des_alt.h"
#endif /* MBEDTLS_DES_ALT */
/** /**
* \brief Triple-DES context structure * \brief Triple-DES context structure
*/ */
@ -80,6 +76,10 @@ typedef struct
} }
mbedtls_des3_context; mbedtls_des3_context;
#else /* MBEDTLS_DES_ALT */
#include "des_alt.h"
#endif /* MBEDTLS_DES_ALT */
/** /**
* \brief Initialize DES context * \brief Initialize DES context
* *

View File

@ -43,15 +43,6 @@
extern "C" { extern "C" {
#endif #endif
#if !defined(MBEDTLS_ECP_ALT)
/*
* default mbed TLS elliptic curve arithmetic implementation
*
* (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an
* alternative implementation for the whole module and it will replace this
* one.)
*/
/** /**
* Domain parameters (curve, subgroup and generator) identifiers. * Domain parameters (curve, subgroup and generator) identifiers.
* *
@ -113,6 +104,15 @@ typedef struct
} }
mbedtls_ecp_point; mbedtls_ecp_point;
#if !defined(MBEDTLS_ECP_ALT)
/*
* default mbed TLS elliptic curve arithmetic implementation
*
* (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an
* alternative implementation for the whole module and it will replace this
* one.)
*/
/** /**
* \brief ECP group structure * \brief ECP group structure
* *
@ -157,21 +157,6 @@ typedef struct
} }
mbedtls_ecp_group; mbedtls_ecp_group;
/**
* \brief ECP key pair structure
*
* A generic key pair that could be used for ECDSA, fixed ECDH, etc.
*
* \note Members purposefully in the same order as struc mbedtls_ecdsa_context.
*/
typedef struct
{
mbedtls_ecp_group grp; /*!< Elliptic curve and base point */
mbedtls_mpi d; /*!< our secret value */
mbedtls_ecp_point Q; /*!< our public value */
}
mbedtls_ecp_keypair;
/** /**
* \name SECTION: Module settings * \name SECTION: Module settings
* *
@ -235,6 +220,21 @@ mbedtls_ecp_keypair;
#include "ecp_alt.h" #include "ecp_alt.h"
#endif /* MBEDTLS_ECP_ALT */ #endif /* MBEDTLS_ECP_ALT */
/**
* \brief ECP key pair structure
*
* A generic key pair that could be used for ECDSA, fixed ECDH, etc.
*
* \note Members purposefully in the same order as struc mbedtls_ecdsa_context.
*/
typedef struct
{
mbedtls_ecp_group grp; /*!< Elliptic curve and base point */
mbedtls_mpi d; /*!< our secret value */
mbedtls_ecp_point Q; /*!< our public value */
}
mbedtls_ecp_keypair;
/* /*
* Point formats, from RFC 4492's enum ECPointFormat * Point formats, from RFC 4492's enum ECPointFormat
*/ */