Require less indentation
This commit is contained in:
parent
9ef45f8456
commit
9788147270
@ -66,13 +66,15 @@ static void store_block(void *output, const block *src) {
|
|||||||
|
|
||||||
/***************Memory allocators*****************/
|
/***************Memory allocators*****************/
|
||||||
int allocate_memory(block_region **region, uint32_t m_cost) {
|
int allocate_memory(block_region **region, uint32_t m_cost) {
|
||||||
if (region != NULL) {
|
|
||||||
block *memory;
|
block *memory;
|
||||||
size_t memory_size = sizeof(block) * m_cost;
|
size_t memory_size;
|
||||||
|
|
||||||
|
if (region == NULL) {
|
||||||
|
return ARGON2_MEMORY_ALLOCATION_ERROR;
|
||||||
|
}
|
||||||
|
memory_size = sizeof(block) * m_cost;
|
||||||
if (m_cost == 0 ||
|
if (m_cost == 0 ||
|
||||||
memory_size / m_cost !=
|
memory_size / m_cost != sizeof(block)) { /*1. Check for multiplication overflow*/
|
||||||
sizeof(block)) { /*1. Check for multiplication overflow*/
|
|
||||||
return ARGON2_MEMORY_ALLOCATION_ERROR;
|
return ARGON2_MEMORY_ALLOCATION_ERROR;
|
||||||
}
|
}
|
||||||
*region = (block_region *)malloc(sizeof(block_region)); /*2. Try to allocate region*/
|
*region = (block_region *)malloc(sizeof(block_region)); /*2. Try to allocate region*/
|
||||||
@ -87,9 +89,6 @@ int allocate_memory(block_region **region, uint32_t m_cost) {
|
|||||||
(*region)->memory = memory;
|
(*region)->memory = memory;
|
||||||
|
|
||||||
return ARGON2_OK;
|
return ARGON2_OK;
|
||||||
} else {
|
|
||||||
return ARGON2_MEMORY_ALLOCATION_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********Memory functions*/
|
/*********Memory functions*/
|
||||||
|
Loading…
Reference in New Issue
Block a user