FreeBSD/lib/libcrypt/crypt-sha512.c
/* This entry point is equivalent to crypt(3). */
This entry point is equivalent to crypt(3).
This entry point is equivalent to crypt ( 3 ) .
char *
crypt_sha512(const char *key, const char *salt)
{
	static char *buffer;
	static int buflen;
	int needed;
	char *new_buffer;
	needed = (sizeof(sha512_salt_prefix) - 1
	      + sizeof(sha512_rounds_prefix) + 9 + 1
	      + strlen(salt) + 1 + 86 + 1);
	if (buflen < needed) {
		new_buffer = (char *)realloc(buffer, needed);
		if (new_buffer == NULL)
			return NULL;
		buffer = new_buffer;
		buflen = needed;
	}
	return crypt_sha512_r(key, salt, buffer, buflen);
}
char * crypt_sha512 ( const char * key , const char * salt ) { static char * buffer ; static int buflen ; int needed ; char * new_buffer ; needed = ( sizeof ( sha512_salt_prefix ) - 1 + sizeof ( sha512_rounds_prefix ) + 9 + 1 + strlen ( salt ) + 1 + 86 + 1 ) ; if ( buflen < needed ) { new_buffer = ( char * ) realloc ( buffer , needed ) ; if ( new_buffer == NULL ) return NULL ; buffer = new_buffer ; buflen = needed ; } return crypt_sha512_r ( key , salt , buffer , buflen ) ; }
This entry point is equivalent to crypt(3).
This entry point is equivalent to crypt ( 3 ) .
/* We don't want to have an arbitrary limit in the size of the
	 * password. We can compute an upper bound for the size of the
	 * result in advance and so we can prepare the buffer we pass to
	 * `crypt_sha512_r'. */