FreeBSD/contrib/ntp/ntpd/ntp_crypto.c
/*
 * bigdig() - compute a BIGNUM MD5 hash of a BIGNUM number.
 *
 * Returns void (no errors)
 */
compute a BIGNUM MD5 hash of a BIGNUM number.
Returns void (no errors)
compute a BIGNUM MD5 hash of a BIGNUM number . Returns void ( no errors )
static void
bighash(
	BIGNUM	*bn,		
	BIGNUM	*bk		
	)
{
	EVP_MD_CTX *ctx;	
	u_char dgst[EVP_MAX_MD_SIZE]; 
	u_char	*ptr;		
	u_int	len;
	len = BN_num_bytes(bn);
	ptr = emalloc(len);
	BN_bn2bin(bn, ptr);
	ctx = EVP_MD_CTX_new();
	EVP_DigestInit(ctx, EVP_md5());
	EVP_DigestUpdate(ctx, ptr, len);
	EVP_DigestFinal(ctx, dgst, &len);
	EVP_MD_CTX_free(ctx);
	BN_bin2bn(dgst, len, bk);
	free(ptr);
}
static void bighash ( BIGNUM * bn , BIGNUM * bk ) { EVP_MD_CTX * ctx ; u_char dgst [ EVP_MAX_MD_SIZE ] ; u_char * ptr ; u_int len ; len = BN_num_bytes ( bn ) ; ptr = emalloc ( len ) ; BN_bn2bin ( bn , ptr ) ; ctx = EVP_MD_CTX_new ( ) ; EVP_DigestInit ( ctx , EVP_md5 ( ) ) ; EVP_DigestUpdate ( ctx , ptr , len ) ; EVP_DigestFinal ( ctx , dgst , & len ) ; EVP_MD_CTX_free ( ctx ) ; BN_bin2bn ( dgst , len , bk ) ; free ( ptr ) ; }
bigdig() - compute a BIGNUM MD5 hash of a BIGNUM number.
bigdig () - compute a BIGNUM MD5 hash of a BIGNUM number .
/* BIGNUM * from */ /* BIGNUM * to */ /* message digest context */ /* message digest */ /* a BIGNUM as binary string */