mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 02:24:16 +01:00
Add new modules to the refactoring
Add new alternative supported modules to the new arcitecture design
This commit is contained in:
parent
b2aacec417
commit
4e6d55d14d
@ -40,14 +40,15 @@
|
|||||||
#define MBEDTLS_ERR_CCM_AUTH_FAILED -0x000F /**< Authenticated decryption failed. */
|
#define MBEDTLS_ERR_CCM_AUTH_FAILED -0x000F /**< Authenticated decryption failed. */
|
||||||
#define MBEDTLS_ERR_CCM_HW_ACCEL_FAILED -0x0011 /**< CCM hardware accelerator failed. */
|
#define MBEDTLS_ERR_CCM_HW_ACCEL_FAILED -0x0011 /**< CCM hardware accelerator failed. */
|
||||||
|
|
||||||
#if !defined(MBEDTLS_CCM_ALT)
|
|
||||||
// Regular implementation
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CCM_ALT)
|
||||||
|
// Regular implementation
|
||||||
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The CCM context-type definition. The CCM context is passed
|
* \brief The CCM context-type definition. The CCM context is passed
|
||||||
* to the APIs called.
|
* to the APIs called.
|
||||||
@ -57,6 +58,10 @@ typedef struct {
|
|||||||
}
|
}
|
||||||
mbedtls_ccm_context;
|
mbedtls_ccm_context;
|
||||||
|
|
||||||
|
#else /* MBEDTLS_CCM_ALT */
|
||||||
|
#include "ccm_alt.h"
|
||||||
|
#endif /* MBEDTLS_CCM_ALT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function initializes the specified CCM context,
|
* \brief This function initializes the specified CCM context,
|
||||||
* to make references valid, and prepare the context
|
* to make references valid, and prepare the context
|
||||||
@ -148,17 +153,6 @@ int mbedtls_ccm_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
|
|||||||
const unsigned char *input, unsigned char *output,
|
const unsigned char *input, unsigned char *output,
|
||||||
const unsigned char *tag, size_t tag_len );
|
const unsigned char *tag, size_t tag_len );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* MBEDTLS_CCM_ALT */
|
|
||||||
#include "ccm_alt.h"
|
|
||||||
#endif /* MBEDTLS_CCM_ALT */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
|
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
|
||||||
/**
|
/**
|
||||||
|
@ -61,6 +61,10 @@ struct mbedtls_cmac_context_t
|
|||||||
size_t unprocessed_len;
|
size_t unprocessed_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else /* !MBEDTLS_CMAC_ALT */
|
||||||
|
#include "cmac_alt.h"
|
||||||
|
#endif /* !MBEDTLS_CMAC_ALT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function sets the CMAC key, and prepares to authenticate
|
* \brief This function sets the CMAC key, and prepares to authenticate
|
||||||
* the input data.
|
* the input data.
|
||||||
@ -180,18 +184,6 @@ int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_len,
|
|||||||
unsigned char output[16] );
|
unsigned char output[16] );
|
||||||
#endif /* MBEDTLS_AES_C */
|
#endif /* MBEDTLS_AES_C */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* !MBEDTLS_CMAC_ALT */
|
|
||||||
#include "cmac_alt.h"
|
|
||||||
#endif /* !MBEDTLS_CMAC_ALT */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
|
#if defined(MBEDTLS_SELF_TEST) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
|
||||||
/**
|
/**
|
||||||
* \brief The CMAC checkup routine.
|
* \brief The CMAC checkup routine.
|
||||||
|
@ -65,7 +65,6 @@
|
|||||||
#include MBEDTLS_CONFIG_FILE
|
#include MBEDTLS_CONFIG_FILE
|
||||||
#endif
|
#endif
|
||||||
#include "bignum.h"
|
#include "bignum.h"
|
||||||
#if !defined(MBEDTLS_DHM_ALT)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DHM Error codes
|
* DHM Error codes
|
||||||
@ -86,6 +85,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_DHM_ALT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The DHM context structure.
|
* \brief The DHM context structure.
|
||||||
*/
|
*/
|
||||||
@ -105,6 +106,10 @@ typedef struct
|
|||||||
}
|
}
|
||||||
mbedtls_dhm_context;
|
mbedtls_dhm_context;
|
||||||
|
|
||||||
|
#else /* MBEDTLS_DHM_ALT */
|
||||||
|
#include "dhm_alt.h"
|
||||||
|
#endif /* MBEDTLS_DHM_ALT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function initializes the DHM context.
|
* \brief This function initializes the DHM context.
|
||||||
*
|
*
|
||||||
@ -282,18 +287,6 @@ int mbedtls_dhm_parse_dhmfile( mbedtls_dhm_context *dhm, const char *path );
|
|||||||
#endif /* MBEDTLS_FS_IO */
|
#endif /* MBEDTLS_FS_IO */
|
||||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* MBEDTLS_DHM_ALT */
|
|
||||||
#include "dhm_alt.h"
|
|
||||||
#endif /* MBEDTLS_DHM_ALT */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The DMH checkup routine.
|
* \brief The DMH checkup routine.
|
||||||
*
|
*
|
||||||
|
@ -44,8 +44,6 @@
|
|||||||
#include "ecp.h"
|
#include "ecp.h"
|
||||||
#include "md.h"
|
#include "md.h"
|
||||||
|
|
||||||
#if !defined(MBEDTLS_ECJPAKE_ALT)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -58,6 +56,7 @@ typedef enum {
|
|||||||
MBEDTLS_ECJPAKE_SERVER, /**< Server */
|
MBEDTLS_ECJPAKE_SERVER, /**< Server */
|
||||||
} mbedtls_ecjpake_role;
|
} mbedtls_ecjpake_role;
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_ECJPAKE_ALT)
|
||||||
/**
|
/**
|
||||||
* EC J-PAKE context structure.
|
* EC J-PAKE context structure.
|
||||||
*
|
*
|
||||||
@ -88,6 +87,10 @@ typedef struct
|
|||||||
mbedtls_mpi s; /**< Pre-shared secret (passphrase) */
|
mbedtls_mpi s; /**< Pre-shared secret (passphrase) */
|
||||||
} mbedtls_ecjpake_context;
|
} mbedtls_ecjpake_context;
|
||||||
|
|
||||||
|
#else /* MBEDTLS_ECJPAKE_ALT */
|
||||||
|
#include "ecjpake_alt.h"
|
||||||
|
#endif /* MBEDTLS_ECJPAKE_ALT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Initialize a context
|
* \brief Initialize a context
|
||||||
* (just makes it ready for setup() or free()).
|
* (just makes it ready for setup() or free()).
|
||||||
@ -225,20 +228,10 @@ int mbedtls_ecjpake_derive_secret( mbedtls_ecjpake_context *ctx,
|
|||||||
*/
|
*/
|
||||||
void mbedtls_ecjpake_free( mbedtls_ecjpake_context *ctx );
|
void mbedtls_ecjpake_free( mbedtls_ecjpake_context *ctx );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* MBEDTLS_ECJPAKE_ALT */
|
|
||||||
#include "ecjpake_alt.h"
|
|
||||||
#endif /* MBEDTLS_ECJPAKE_ALT */
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST)
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Checkup routine
|
* \brief Checkup routine
|
||||||
*
|
*
|
||||||
@ -246,10 +239,11 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
int mbedtls_ecjpake_self_test( int verbose );
|
int mbedtls_ecjpake_self_test( int verbose );
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* MBEDTLS_SELF_TEST */
|
|
||||||
|
|
||||||
#endif /* ecjpake.h */
|
#endif /* ecjpake.h */
|
||||||
|
@ -42,12 +42,12 @@
|
|||||||
#define MBEDTLS_ERR_GCM_HW_ACCEL_FAILED -0x0013 /**< GCM hardware accelerator failed. */
|
#define MBEDTLS_ERR_GCM_HW_ACCEL_FAILED -0x0013 /**< GCM hardware accelerator failed. */
|
||||||
#define MBEDTLS_ERR_GCM_BAD_INPUT -0x0014 /**< Bad input parameters to function. */
|
#define MBEDTLS_ERR_GCM_BAD_INPUT -0x0014 /**< Bad input parameters to function. */
|
||||||
|
|
||||||
#if !defined(MBEDTLS_GCM_ALT)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_GCM_ALT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The GCM context structure.
|
* \brief The GCM context structure.
|
||||||
*/
|
*/
|
||||||
@ -66,6 +66,10 @@ typedef struct {
|
|||||||
}
|
}
|
||||||
mbedtls_gcm_context;
|
mbedtls_gcm_context;
|
||||||
|
|
||||||
|
#else /* !MBEDTLS_GCM_ALT */
|
||||||
|
#include "gcm_alt.h"
|
||||||
|
#endif /* !MBEDTLS_GCM_ALT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function initializes the specified GCM context,
|
* \brief This function initializes the specified GCM context,
|
||||||
* to make references valid, and prepares the context
|
* to make references valid, and prepares the context
|
||||||
@ -236,18 +240,6 @@ int mbedtls_gcm_finish( mbedtls_gcm_context *ctx,
|
|||||||
*/
|
*/
|
||||||
void mbedtls_gcm_free( mbedtls_gcm_context *ctx );
|
void mbedtls_gcm_free( mbedtls_gcm_context *ctx );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* !MBEDTLS_GCM_ALT */
|
|
||||||
#include "gcm_alt.h"
|
|
||||||
#endif /* !MBEDTLS_GCM_ALT */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The GCM checkup routine.
|
* \brief The GCM checkup routine.
|
||||||
*
|
*
|
||||||
|
@ -76,14 +76,14 @@
|
|||||||
* eg for alternative (PKCS#11) RSA implemenations in the PK layers.
|
* eg for alternative (PKCS#11) RSA implemenations in the PK layers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(MBEDTLS_RSA_ALT)
|
|
||||||
// Regular implementation
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_RSA_ALT)
|
||||||
|
// Regular implementation
|
||||||
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The RSA context structure.
|
* \brief The RSA context structure.
|
||||||
*
|
*
|
||||||
@ -128,6 +128,10 @@ typedef struct
|
|||||||
}
|
}
|
||||||
mbedtls_rsa_context;
|
mbedtls_rsa_context;
|
||||||
|
|
||||||
|
#else /* MBEDTLS_RSA_ALT */
|
||||||
|
#include "rsa_alt.h"
|
||||||
|
#endif /* MBEDTLS_RSA_ALT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function initializes an RSA context.
|
* \brief This function initializes an RSA context.
|
||||||
*
|
*
|
||||||
@ -1112,18 +1116,6 @@ int mbedtls_rsa_copy( mbedtls_rsa_context *dst, const mbedtls_rsa_context *src )
|
|||||||
*/
|
*/
|
||||||
void mbedtls_rsa_free( mbedtls_rsa_context *ctx );
|
void mbedtls_rsa_free( mbedtls_rsa_context *ctx );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* MBEDTLS_RSA_ALT */
|
|
||||||
#include "rsa_alt.h"
|
|
||||||
#endif /* MBEDTLS_RSA_ALT */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The RSA checkup routine.
|
* \brief The RSA checkup routine.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user