mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-11-03 20:33:16 +03:00 
			
		
		
		
	Add MBEDTLS_ECP_MAX_MPI define
Add MBEDTLS_ECP_MAX_MPI define to determine the maximum number of bytes for the biggest Elliptic curve in bignum representation. Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
This commit is contained in:
		@@ -8184,7 +8184,7 @@ psa_status_t psa_generate_key_iop_complete(
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
#if defined(MBEDTLS_ECP_RESTARTABLE)
 | 
					#if defined(MBEDTLS_ECP_RESTARTABLE)
 | 
				
			||||||
    psa_status_t status;
 | 
					    psa_status_t status;
 | 
				
			||||||
    uint8_t key_data[MBEDTLS_ECP_MAX_BYTES] = { 0 };
 | 
					    uint8_t key_data[MBEDTLS_ECP_MAX_MPI] = { 0 };
 | 
				
			||||||
    size_t key_len = 0;
 | 
					    size_t key_len = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (operation->id == 0 || operation->error_occurred) {
 | 
					    if (operation->id == 0 || operation->error_occurred) {
 | 
				
			||||||
@@ -8210,7 +8210,7 @@ exit:
 | 
				
			|||||||
        psa_generate_key_iop_abort_internal(operation);
 | 
					        psa_generate_key_iop_abort_internal(operation);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mbedtls_platform_zeroize(key_data, MBEDTLS_ECP_MAX_BYTES);
 | 
					    mbedtls_platform_zeroize(key_data, sizeof(key_data));
 | 
				
			||||||
    return status;
 | 
					    return status;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    (void) operation;
 | 
					    (void) operation;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -345,6 +345,8 @@ mbedtls_ecp_group;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define MBEDTLS_ECP_MAX_BYTES    ((MBEDTLS_ECP_MAX_BITS + 7) / 8)
 | 
					#define MBEDTLS_ECP_MAX_BYTES    ((MBEDTLS_ECP_MAX_BITS + 7) / 8)
 | 
				
			||||||
#define MBEDTLS_ECP_MAX_PT_LEN   (2 * MBEDTLS_ECP_MAX_BYTES + 1)
 | 
					#define MBEDTLS_ECP_MAX_PT_LEN   (2 * MBEDTLS_ECP_MAX_BYTES + 1)
 | 
				
			||||||
 | 
					#define MBEDTLS_ECP_MAX_MPI      ((MBEDTLS_ECP_MAX_BYTES + sizeof(mbedtls_mpi_uint)) & \
 | 
				
			||||||
 | 
					                                  ~(sizeof(mbedtls_mpi_uint)-1))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_ECP_RESTARTABLE)
 | 
					#if defined(MBEDTLS_ECP_RESTARTABLE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user