Ejemplo n.º 1
0
void timer_callback(registers_t* regs) {
	UNUSED(regs);

	current_tick++;
}
Ejemplo n.º 2
0
/*
 * Called at startup for each dlopen zone in named.conf
 */
static isc_result_t
dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
		  void *driverarg, void **dbdata)
{
	dlopen_data_t *cd;
	isc_mem_t *mctx = NULL;
	isc_result_t result = ISC_R_FAILURE;
	int dlopen_flags = 0;

	UNUSED(driverarg);

	if (argc < 2) {
		dlopen_log(ISC_LOG_ERROR,
			   "dlz_dlopen driver for '%s' needs a path to "
			   "the shared library", dlzname);
		return (ISC_R_FAILURE);
	}

	isc_mem_create(0, 0, &mctx);

	cd = isc_mem_get(mctx, sizeof(*cd));
	if (cd == NULL) {
		isc_mem_destroy(&mctx);
		return (ISC_R_NOMEMORY);
	}
	memset(cd, 0, sizeof(*cd));

	cd->mctx = mctx;

	cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]);
	if (cd->dl_path == NULL) {
		goto failed;
	}

	cd->dlzname = isc_mem_strdup(cd->mctx, dlzname);
	if (cd->dlzname == NULL) {
		goto failed;
	}

	/* Initialize the lock */
	isc_mutex_init(&cd->lock);

	/* Open the library */
	dlopen_flags = RTLD_NOW|RTLD_GLOBAL;

#ifdef RTLD_DEEPBIND
	/*
	 * If RTLD_DEEPBIND is available then use it. This can avoid
	 * issues with a module using a different version of a system
	 * library than one that bind9 uses. For example, bind9 may link
	 * to MIT kerberos, but the module may use Heimdal. If we don't
	 * use RTLD_DEEPBIND then we could end up with Heimdal functions
	 * calling MIT functions, which leads to bizarre results (usually
	 * a segfault).
	 */
	dlopen_flags |= RTLD_DEEPBIND;
#endif

	cd->dl_handle = dlopen(cd->dl_path, dlopen_flags);
	if (cd->dl_handle == NULL) {
		dlopen_log(ISC_LOG_ERROR,
			   "dlz_dlopen failed to open library '%s' - %s",
			   cd->dl_path, dlerror());
		goto failed;
	}

	/* Find the symbols */
	cd->dlz_version = (dlz_dlopen_version_t *)
		dl_load_symbol(cd, "dlz_version", ISC_TRUE);
	cd->dlz_create = (dlz_dlopen_create_t *)
		dl_load_symbol(cd, "dlz_create", ISC_TRUE);
	cd->dlz_lookup = (dlz_dlopen_lookup_t *)
		dl_load_symbol(cd, "dlz_lookup", ISC_TRUE);
	cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *)
		dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE);

	if (cd->dlz_create == NULL ||
	    cd->dlz_lookup == NULL ||
	    cd->dlz_findzonedb == NULL)
	{
		/* We're missing a required symbol */
		goto failed;
	}

	cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *)
		dl_load_symbol(cd, "dlz_allowzonexfr", ISC_FALSE);
	cd->dlz_allnodes = (dlz_dlopen_allnodes_t *)
		dl_load_symbol(cd, "dlz_allnodes",
			       ISC_TF(cd->dlz_allowzonexfr != NULL));
	cd->dlz_authority = (dlz_dlopen_authority_t *)
		dl_load_symbol(cd, "dlz_authority", ISC_FALSE);
	cd->dlz_newversion = (dlz_dlopen_newversion_t *)
		dl_load_symbol(cd, "dlz_newversion", ISC_FALSE);
	cd->dlz_closeversion = (dlz_dlopen_closeversion_t *)
		dl_load_symbol(cd, "dlz_closeversion",
			       ISC_TF(cd->dlz_newversion != NULL));
	cd->dlz_configure = (dlz_dlopen_configure_t *)
		dl_load_symbol(cd, "dlz_configure", ISC_FALSE);
	cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *)
		dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE);
	cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *)
		dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE);
	cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *)
		dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE);
	cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *)
		dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE);
	cd->dlz_destroy = (dlz_dlopen_destroy_t *)
		dl_load_symbol(cd, "dlz_destroy", ISC_FALSE);

	/* Check the version of the API is the same */
	cd->version = cd->dlz_version(&cd->flags);
	if (cd->version != DLZ_DLOPEN_VERSION) {
		dlopen_log(ISC_LOG_ERROR,
			   "dlz_dlopen: incorrect version %d "
			   "should be %d in '%s'",
			   cd->version, DLZ_DLOPEN_VERSION, cd->dl_path);
		goto failed;
	}

	/*
	 * Call the library's create function. Note that this is an
	 * extended version of dlz create, with the addition of
	 * named function pointers for helper functions that the
	 * driver will need. This avoids the need for the backend to
	 * link the BIND9 libraries
	 */
	MAYBE_LOCK(cd);
	result = cd->dlz_create(dlzname, argc-1, argv+1,
				&cd->dbdata,
				"log", dlopen_log,
				"putrr", dns_sdlz_putrr,
				"putnamedrr", dns_sdlz_putnamedrr,
				"writeable_zone", dns_dlz_writeablezone,
				NULL);
	MAYBE_UNLOCK(cd);
	if (result != ISC_R_SUCCESS)
		goto failed;

	*dbdata = cd;

	return (ISC_R_SUCCESS);

failed:
	dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
	if (cd->dl_path)
		isc_mem_free(mctx, cd->dl_path);
	if (cd->dlzname)
		isc_mem_free(mctx, cd->dlzname);
	if (dlopen_flags)
		(void) isc_mutex_destroy(&cd->lock);
#ifdef HAVE_DLCLOSE
	if (cd->dl_handle)
		dlclose(cd->dl_handle);
#endif
	isc_mem_put(mctx, cd, sizeof(*cd));
	isc_mem_destroy(&mctx);
	return (result);
}
Ejemplo n.º 3
0
/**
 * \fn void HMI_SetContrast(UINT8 contrast)
 * \brief Sets the contrast of the display
 * \param contrast contrast a value between 0 and 63
 */
void HMI_SetContrast(UINT8 contrast)
{
  UNUSED(LCD_SetContrast(contrast));
}
Ejemplo n.º 4
0
void ui_usb_vbus_change(bool b_vbus_present)
{
    UNUSED(b_vbus_present);
}
Ejemplo n.º 5
0
void ui_uhi_msc_change(uhc_device_t * dev, bool b_plug)
{
    UNUSED(dev);
    ui_msc_plug = b_plug;
}
Ejemplo n.º 6
0
Bool ArgCheckCount(Arg arg) {
  UNUSED(arg); /* TODO: Add and call CountCheck */
  return TRUE;
}
Ejemplo n.º 7
0
ATF_TC_BODY(symtab_grow, tc) {
	isc_result_t result;
	isc_symtab_t *st = NULL;
	isc_symvalue_t value;
	isc_symexists_t policy = isc_symexists_reject;
	int i;

	UNUSED(tc);

	result = isc_test_begin(NULL, ISC_TRUE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = isc_symtab_create(mctx, 3, undefine, NULL, ISC_FALSE, &st);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
	ATF_REQUIRE(st != NULL);

	/* Nothing should be in the table yet */

	/*
	 * Put 1024 entries in the table (this should necessate
	 * regrowing the hash table several times
	 */
	for (i = 0; i < 1024; i++) {
		char str[16], *key;

		snprintf(str, sizeof(str), "%04x", i);
		key = isc_mem_strdup(mctx, str);
		ATF_REQUIRE(key != NULL);
		value.as_pointer = isc_mem_strdup(mctx, str);
		ATF_REQUIRE(value.as_pointer != NULL);
		result = isc_symtab_define(st, key, 1, value, policy);
		ATF_CHECK_EQ(result, ISC_R_SUCCESS);
		if (result != ISC_R_SUCCESS)
			undefine(key, 1, value, NULL);
	}

	/*
	 * Try to put them in again; this should fail
	 */
	for (i = 0; i < 1024; i++) {
		char str[16], *key;

		snprintf(str, sizeof(str), "%04x", i);
		key = isc_mem_strdup(mctx, str);
		ATF_REQUIRE(key != NULL);
		value.as_pointer = isc_mem_strdup(mctx, str);
		ATF_REQUIRE(value.as_pointer != NULL);
		result = isc_symtab_define(st, key, 1, value, policy);
		ATF_CHECK_EQ(result, ISC_R_EXISTS);
		undefine(key, 1, value, NULL);
	}

	/*
	 * Retrieve them; this should succeed
	 */
	for (i = 0; i < 1024; i++) {
		char str[16];

		snprintf(str, sizeof(str), "%04x", i);
		result = isc_symtab_lookup(st, str, 0, &value);
		ATF_CHECK_EQ(result, ISC_R_SUCCESS);
		ATF_CHECK_STREQ(str, (char *)value.as_pointer);
	}

	/*
	 * Undefine them
	 */
	for (i = 0; i < 1024; i++) {
		char str[16];

		snprintf(str, sizeof(str), "%04x", i);
		result = isc_symtab_undefine(st, str, 1);
		ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	}

	/*
	 * Retrieve them again; this should fail
	 */
	for (i = 0; i < 1024; i++) {
		char str[16];

		snprintf(str, sizeof(str), "%04x", i);
		result = isc_symtab_lookup(st, str, 0, &value);
		ATF_CHECK_EQ(result, ISC_R_NOTFOUND);
	}

	isc_symtab_destroy(&st);
	isc_test_end();
}
Ejemplo n.º 8
0
/*! \brief This routine is required by IAR DLIB library since EWAVR V6.10
 * the implementation is empty to be compatible with old IAR version.
 */
long __lseek(int handle, long val, int val2)
{
	UNUSED(handle);
	UNUSED(val2);
	return val;
}
Ejemplo n.º 9
0
static isc_result_t
flush(dns_zone_t *zone, void *uap) {
	UNUSED(uap);
	return (dns_zone_flush(zone));
}
Ejemplo n.º 10
0
/*! \brief This routine is required by IAR DLIB library since EWAVR V6.10
 * the implementation is empty to be compatible with old IAR version.
 */
int __close(int handle)
{
	UNUSED(handle);
	return 0;
}
Ejemplo n.º 11
0
/*! \brief This routine is required by IAR DLIB library since EWAVR V6.10
 * the implementation is empty to be compatible with old IAR version.
 */
int remove(const char* val)
{
	UNUSED(val);
	return 0;
}
Ejemplo n.º 12
0
int main(int argc, char **argv) {
	UNUSED(argv);

//	dox_hooks_install();

	struct rlimit memlim;

	memlim.rlim_cur = 4 * GB;
	memlim.rlim_max = memlim.rlim_cur;
	setrlimit(RLIMIT_AS, &memlim);

	ppk_print_init();

	dox_texts_init(&texts);

	dox_store_t *store = dox_store_new("/home/dirk/tmp/dox");
	assert (store != NULL);

	dox_store_scan(store, iter_callback, NULL);

	if (texts.count == 0)
		goto unstore;

//	dox_mindex_t *mindex = dox_mindex_new_flags(DOX_MINDEX_DELTA);
	dox_mindex_t *mindex = dox_mindex_new_flags(DOX_MINDEX_ABSOLUTE);
//	dox_mindex_t *mindex = dox_mindex_new_flags(DOX_MINDEX_ABSOLUTE | DOX_MINDEX_DELTA);
//	dox_mindex_t *mindex = dox_mindex_new_flags(0);
	assert (mindex != NULL);

	uint32_t total_bit_widths = 0;

	int64_t time0 = ppk_time_get_ns();

	for (int i = 0; i < texts.count; i++) {
		const dox_text_t *text = texts.items + i;

		total_bit_widths += dox_text_bit_width(text);

		int ret = dox_mindex_add(mindex, text);

		if (ret != 0) {
			printf("Mindex now full\n\n");
			break;
		}
	}

	int64_t time1 = ppk_time_get_ns();

	printf("Indexed %lu MiB in %ld ms (%ld us per text)\n\n",
		(total_size * sizeof(dox_word_t)) / PPK_MiB,
		(long) ((time1 - time0) / PPK_MILLION),
		(long) ((time1 - time0) / (PPK_THOUSAND * texts.count)));

	printf("Average of %d bits per word\n",
		(int) (total_bit_widths / texts.count));


	dox_mindex_make_skip(mindex);

	dox_mindex_print_memory(mindex);



	dox_copies_t copies;
	dox_copies_init(&copies);
	unsigned long total_copies = 0;

	time0 = ppk_time_get_ns();

	for (int i = 0; i < texts.count; i++) {
		copies.count = 0;
		dox_mindex_get(mindex, &copies, texts.items + i, DOX_INDEX_SMART);

		total_copies += copies.count;
		if (total_copies < (unsigned long) copies.count)
			printf("\nCopy count wrapped after text %d\n", i);

		uint32_t done = i + 1;
		if ((texts.count - done) % 100 == 0) {
			time1 = ppk_time_get_ns();
			int64_t timed = time1 - time0;
			int64_t pertext = timed / (done * PPK_MILLION);

			printf("\r%d/%d (%d%%), %lu ms per text",
					done, texts.count, ppk_percent(done, texts.count),
					(unsigned long) pertext);
			fflush(stdout);
		}
	}

	printf("\n");

	time1 = ppk_time_get_ns();

	printf("\nSearched %d texts in %lu ms, %lu copies\n",
			texts.count,
			(unsigned long) ((time1 - time0) / PPK_MILLION),
			total_copies);

	printf(" (%lu ms per text, %lu us per word, %lu us per copy)\n",
			(unsigned long) ((time1 - time0) / (PPK_MILLION * texts.count)),
			(unsigned long) ((time1 - time0) / (PPK_THOUSAND * total_size)),
			(unsigned long) ((time1 - time0) / (PPK_THOUSAND * total_copies)));

	dox_copies_free(&copies);



	dox_mindex_free(mindex);

unstore:
	dox_texts_free(&texts);
	dox_store_free(store);

	ppk_print_free();

	dox_hooks_dump();

	return 0;
}
Ejemplo n.º 13
0
int
mock_chdir( char *path ) {
  UNUSED( path );
  return ( int ) mock();
}
Ejemplo n.º 14
0
void
mock_warn( const char *format, ... ) {
  UNUSED( format );
}
Ejemplo n.º 15
0
Bool ArgCheckSize(Arg arg) {
  UNUSED(arg); /* TODO: Add and call SizeCheck */
  return TRUE;
}
Ejemplo n.º 16
0
static void dothecall (lua_State *L, void *ud) {
  UNUSED(ud);
  luaD_callnoyield(L, L->top - 2, 0);
}
Ejemplo n.º 17
0
Bool ArgCheckAddr(Arg arg) {
  UNUSED(arg); /* TODO: Add and call AddrCheck */
  return TRUE;
}
Ejemplo n.º 18
0
static void error_pipe_cb(liEventBase *watcher, int events) {
    liErrorPipe *epipe = LI_CONTAINER_OF(li_event_io_from(watcher), liErrorPipe, fd_watcher);
    UNUSED(events);

    read_pipe(epipe->srv, epipe, FALSE);
}
Ejemplo n.º 19
0
Bool ArgCheckdouble(Arg arg) {
  /* It would be nice if we could check doubles with C89, but
     it doesn't have isfinite() etc. which are in C99. */
  UNUSED(arg);
  return TRUE;
}
Ejemplo n.º 20
0
static complex float nosens(unsigned int c, double mpos[3], void* data, krn_t fun)
{
	UNUSED(c);
	return fun(data, mpos);
}
Ejemplo n.º 21
0
void ui_usb_mode_change(bool b_host_mode)
{
    UNUSED(b_host_mode);
    ui_init();
}
Ejemplo n.º 22
0
static void
output(void *closure, const char *text, int textlen) {
	UNUSED(closure);
	(void) isc_util_fwrite(text, 1, textlen, stdout);
}
Ejemplo n.º 23
0
void ui_uhi_hid_mouse_change(uhc_device_t * dev, bool b_plug)
{
    UNUSED(dev);
    ui_hid_mouse_plug = b_plug;
}
Ejemplo n.º 24
0
void ArgTrivVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs)
{
  UNUSED(varargs);
  args[0].key = MPS_KEY_ARGS_END;
  AVER(ArgListCheck(args));
}
Ejemplo n.º 25
0
//*****************************************************************************//
PRIVATE void VirComReadCallback(uint8 *Buffer, uint32 SizeBytes)
{
	// REVISIT: for testing only
	UNUSED(Buffer);
	UNUSED(SizeBytes);
	LOG_Printf("Going back too bootloader mode\n");

	HW_FLASH_ErasePages(DEVICE_START_ADDR, 2);
	HW_INT_SystemReset();

//    uint32 nextFreeIndex;
//    uint32 packetId, byteCount, pi;
//
//    // TODO: this should probably have a timeout
//    OS_TAKE_MUTEX(packetMgrInputBuffer.Mutex);
//
//    pi = packetMgrInputBuffer.NextPacketIndex;
//
//    if( packetMgrInputBuffer.BytesUsed + SizeBytes <= PACKET_MGR_INPUT_BUFFER_SIZE )
//    {
//        if( sscanf((char*)Buffer, PACKET_START_TAG, (unsigned int*)&packetId) == 1 )
//        {
//            if( packetMgrInputBuffer.PacketsAvailable < PACKET_MGR_INPUT_MAX_PACKETS )
//            {
//                packetMgrInputBuffer.PacketInfo[pi].StartIndex = packetMgrInputBuffer.FirstFreeIndex;
//                packetMgrInputBuffer.PacketInfo[pi].Id = packetId;
//            }
//            else
//            {
//                LOG_Printf("Warning: PacketMgr Input Buffer Full\n");
//            }
//        }
//        else if( strncmp((char*)Buffer, PACKET_END_TAG, PACKET_END_TAG_LEN) == 0 )
//        {
//            if( packetMgrInputBuffer.PacketInfo[pi].StartIndex != PACKET_NULL_INDEX )
//            {
//                packetMgrInputBuffer.PacketInfo[pi].EndIndex = packetMgrInputBuffer.FirstFreeIndex;
//                packetMgrInputBuffer.PacketsAvailable++;
//                packetMgrInputBuffer.NextPacketIndex = (packetMgrInputBuffer.NextPacketIndex+1)%PACKET_MGR_INPUT_MAX_PACKETS;
//            }
//            else
//            {
//                LOG_Printf("Warning: Received end packet tag without start tag\n");
//            }
//        }
//        else
//        {
//            nextFreeIndex = (packetMgrInputBuffer.FirstFreeIndex + SizeBytes) % PACKET_MGR_INPUT_BUFFER_SIZE;
//
//
//            if( packetMgrInputBuffer.FirstFreeIndex + SizeBytes <= PACKET_MGR_INPUT_BUFFER_SIZE )
//            {
//                CopyMemory(&packetMgrInputBuffer.Buffer[packetMgrInputBuffer.FirstFreeIndex], Buffer, SizeBytes);
//            }
//            else
//            {
//                byteCount =  PACKET_MGR_INPUT_BUFFER_SIZE - packetMgrInputBuffer.FirstFreeIndex;
//
//                CopyMemory(&packetMgrInputBuffer.Buffer[packetMgrInputBuffer.FirstFreeIndex], Buffer, byteCount);
//                CopyMemory(packetMgrInputBuffer.Buffer, &Buffer[byteCount], nextFreeIndex);
//            }
//
//            packetMgrInputBuffer.FirstFreeIndex = nextFreeIndex;
//            packetMgrInputBuffer.BytesUsed += SizeBytes;
//        }
//    }
//    else
//    {
//        LOG_Printf("Warning: PacketMgr Input Buffer Full\n");
//    }
//
//    OS_GIVE_MUTEX(packetMgrInputBuffer.Mutex);
}
Ejemplo n.º 26
0
Bool ArgCheckCant(Arg arg) {
  UNUSED(arg);
  return TRUE;
}
Ejemplo n.º 27
0
/**
 * \fn void HMI_SetBacklight(BOOL backlight)
 * \brief Sets the display backlight on or off
 * \param backlight whether the backlight is on or off 
 */
void HMI_SetBacklight(BOOL backlight) 
{
  UNUSED(LCD_Backlight(backlight));
}
Ejemplo n.º 28
0
static Bool ArgCheckShouldnt(Arg arg) {
  UNUSED(arg);
  NOTREACHED;
  return FALSE;
}
Ejemplo n.º 29
0
/**
 * \fn BOOL HMIPopupProcessRoutine(void)
 * \brief Default HMI popup process routine
 * \return TRUE if popup related process has been done or FALSE when bypassed
 */
BOOL HMIPopupProcessRoutine(void)
{
  static BOOL pressedKey2 = bFALSE;

  /* TODO: connect variables to ModConHMIBacklight and ModConHMIContrast */
  
  BOOL showBacklight = bFALSE, showContrast = bFALSE;
  
  if (HMI_KEY5)
  {
    if (HMI_KEY2 && !pressedKey2)
    {      
      HMIContext.backlight = !HMIContext.backlight;
      
      showBacklight = bTRUE;
    }
    else if (HMI_KEY3)
    {
      if (HMIContext.contrast > 0)
      {        
        --HMIContext.contrast;
      }
      showContrast = bTRUE;
    }
    else if (HMI_KEY4)
    {
      if (HMIContext.contrast < 63)
      {
        ++HMIContext.contrast;
      }
      showContrast = bTRUE;
    }
  }

  pressedKey2 = HMI_KEY2;
      
  if (showBacklight)
  {
    if (HMIContext.backlight)
    {      
      CopyBytes(&HMI_BACKLIGHT_POPUP.text[2][6], (UINT8*)" ON", 3);      
    }
    else
    {
      CopyBytes(&HMI_BACKLIGHT_POPUP.text[2][6], (UINT8*)"OFF", 3);      
    }
    LCD_Backlight(HMIContext.backlight);
    HMI_ShowPopup(&HMI_BACKLIGHT_POPUP);
    
    if (HMIContext.backlightChangedCallback)
    {
      HMIContext.backlightChangedCallback(HMIContext.backlight);
    }
    
    return bTRUE;
  }
  else if (showContrast)
  {
    HMI_CONTRAST_POPUP.text[2][6] = HMIContext.contrast / 10 + '0';
    HMI_CONTRAST_POPUP.text[2][7] = HMIContext.contrast % 10 + '0';    
    UNUSED(LCD_SetContrast(HMIContext.contrast));
    HMI_ShowPopup(&HMI_CONTRAST_POPUP);
    
    if (HMIContext.contrastChangedCallback)
    {
      HMIContext.contrastChangedCallback(HMIContext.contrast);
    }
    
    return bTRUE;
  }
    
  return bFALSE;
}
Ejemplo n.º 30
0
static isc_result_t openssldh_generate (dst_key_t * key, int generator, void (*callback) (int))
{
    DH *dh = NULL;

#if OPENSSL_VERSION_NUMBER > 0x00908000L
    BN_GENCB cb;

    union
    {
        void *dptr;
        void (*fptr) (int);
    } u;
#else

    UNUSED (callback);
#endif

    if (generator == 0)
    {
        if (key->key_size == 768 || key->key_size == 1024 || key->key_size == 1536)
        {
            dh = DH_new ();
            if (dh == NULL)
                return (dst__openssl_toresult (ISC_R_NOMEMORY));
            if (key->key_size == 768)
                dh->p = &bn768;
            else if (key->key_size == 1024)
                dh->p = &bn1024;
            else
                dh->p = &bn1536;
            dh->g = &bn2;
        }
        else
            generator = 2;
    }

    if (generator != 0)
    {
#if OPENSSL_VERSION_NUMBER > 0x00908000L
        dh = DH_new ();
        if (dh == NULL)
            return (dst__openssl_toresult (DST_R_OPENSSLFAILURE));

        if (callback == NULL)
        {
            BN_GENCB_set_old (&cb, NULL, NULL);
        }
        else
        {
            u.fptr = callback;
            BN_GENCB_set (&cb, &progress_cb, u.dptr);
        }

        if (!DH_generate_parameters_ex (dh, key->key_size, generator, &cb))
        {
            DH_free (dh);
            return (dst__openssl_toresult (DST_R_OPENSSLFAILURE));
        }
#else
        dh = DH_generate_parameters (key->key_size, generator, NULL, NULL);
#endif
    }

    if (dh == NULL)
        return (dst__openssl_toresult (DST_R_OPENSSLFAILURE));

    if (DH_generate_key (dh) == 0)
    {
        DH_free (dh);
        return (dst__openssl_toresult (DST_R_OPENSSLFAILURE));
    }
    dh->flags &= ~DH_FLAG_CACHE_MONT_P;

    key->keydata.dh = dh;

    return (ISC_R_SUCCESS);
}