aboutsummaryrefslogblamecommitdiffstats
path: root/libar2_hash_buf_size.c
blob: 109969fdd192eede3eecf085fcc49b1ba8c01528 (plain) (tree)
1
2
3
4
5
6
7






                                                             






                                                         
 
/* See LICENSE file for copyright and license details. */
#include "common.h"


size_t
libar2_hash_buf_size(struct libar2_argon2_parameters *params)
{
	if (params->hashlen <= 64)
		return params->hashlen;
	if (params->hashlen > SIZE_MAX / 128 * 64 - 31) {
		errno = EOVERFLOW;
		return 0;
	}
	return (params->hashlen + 31) / 64 * 128;
}