Example #1
0
static int mit_samba_get_nextkey(struct mit_samba_context *ctx,
				 hdb_entry_ex **_hentry)
{
	hdb_entry_ex *hentry;
	int ret;

	hentry = talloc(ctx, hdb_entry_ex);
	if (!hentry) {
		return ENOMEM;
	}

	ret = samba_kdc_nextkey(ctx->context, ctx->db_ctx, hentry);

	if (ret) {
		talloc_free(hentry);
	} else {
		talloc_steal(hentry->ctx, hentry);
		*_hentry = hentry;
	}
	return ret;
}
Example #2
0
static TR_AAA_SERVER *tr_cfg_parse_one_aaa_server (TR_CFG *trc, json_t *jaddr, TR_CFG_RC *rc) {
  TR_AAA_SERVER *aaa = NULL;

  if ((!trc) || (!jaddr) || (!json_is_string(jaddr))) {
    tr_debug("tr_cfg_parse_one_aaa_server: Bad parameters.");
    *rc = TR_CFG_BAD_PARAMS;
    return NULL;
  }

  if (NULL == (aaa = talloc(trc, TR_AAA_SERVER))) {
    tr_debug("tr_cfg_parse_one_aaa_server: Out of memory.");
    *rc = TR_CFG_NOMEM;
    return NULL;
  }

  memset(aaa, 0, sizeof(TR_AAA_SERVER));

  aaa->hostname = tr_new_name((char *)(json_string_value(jaddr)));

  return aaa;
}
Example #3
0
void nn_network_code::init(nn_network *network)
{
	values_cnt = 0;
	for (int l = 1; l < network->layers_cnt; ++l)
		values_cnt+= network->layers[l].neurons_cnt * (1 + network->layers[l - 1].neurons_cnt);

	talloc(values, values_cnt);
	unsigned b = 0;
	for (int l = 1; l < network->layers_cnt; ++l)
		for (int n = 0; n < network->layers[l].neurons_cnt; ++n)
		{
			values[b++] = network->layers[l].neurons[n].treshold;
			for (int w = 0; w < network->layers[l-1].neurons_cnt; ++w)
				values[b++] = network->layers[l].neurons[n].in_neurons_weights[w];
		}
	if (b != values_cnt)
	{
		std::cerr << "ERROR: NNLIB: Internal error (" << __FILE__ << "@" << __LINE__ << ")\n";
		exit(EXIT_FAILURE);
	}
}
Example #4
0
/*
 * Called with a function call with arguments as argument.
 * This is done early in buildtree() and only done once.
 * Returns p.
 */
NODE *
funcode(NODE *p)
{
	NODE *r, *l;

	/* Fix function call arguments. On x86, just add funarg */
	for (r = p->n_right; r->n_op == CM; r = r->n_left) {
		if (r->n_right->n_op != STARG)
			r->n_right = block(FUNARG, r->n_right, NIL,
			    r->n_right->n_type, r->n_right->n_df,
			    r->n_right->n_ap);
	}
	if (r->n_op != STARG) {
		l = talloc();
		*l = *r;
		r->n_op = FUNARG;
		r->n_left = l;
		r->n_type = l->n_type;
	}
	return p;
}
Example #5
0
static bool test_is_server_listening(struct dcerpc_pipe *p, 
				     TALLOC_CTX *mem_ctx)
{
	NTSTATUS status;
	struct mgmt_is_server_listening r;
	r.out.status = talloc(mem_ctx, uint32_t);

	status = dcerpc_mgmt_is_server_listening(p, mem_ctx, &r);
	if (!NT_STATUS_IS_OK(status)) {
		printf("is_server_listening failed - %s\n", nt_errstr(status));
		return false;
	}

	if (*r.out.status != 0 || r.out.result == 0) {
		printf("\tserver is NOT listening\n");
	} else {
		printf("\tserver is listening\n");
	}

	return true;
}
Example #6
0
struct tnode* addtree(struct tnode* p, char* w)
	{
	int cond;

	if(p==NULL)
	{
		p=talloc();
		p->word = strdup(w);
		p->count = 1;
		p->linenum[p->count] = line;
		p->left = p->right = NULL;
	}
	else if((cond=strcmp(w, p->word))==0)
		p->linenum[p->count++] = line;
	else if(cond<0)
		p->left = addtree(p->left, w);
	else
		p->right = addtree(p->right, w);

	return p;
}
Example #7
0
void CopyRange_velocities(
	struct Velocities **tovelocity,
	struct Velocities *fromvelocity,
	Place *p1,
	Place *p2
){
	struct Velocities *velocity;

	if(fromvelocity==NULL) return;

	if(PlaceGreaterOrEqual(&fromvelocity->l.p,p2)) return;

	velocity=talloc(sizeof(struct Velocities));
        memcpy(velocity, fromvelocity, sizeof(struct Velocities));

	PlaceSub(&velocity->l.p,p1);

	ListAddElement3(tovelocity,&velocity->l);

	CopyRange_velocities(tovelocity,NextVelocity(fromvelocity),p1,p2);
}
Example #8
0
cbuf* cbuf_copy(const cbuf* b)
{
    cbuf* s = talloc(talloc_parent(b), cbuf);
    if (s == NULL) {
        return NULL;
    }

    s->buf = (char *)talloc_memdup(s, b->buf, b->size); /* only up to pos? */

    /* XXX shallow did not work, because realloc */
    /* fails with multiple references */
    /* s->buf = talloc_reference(s, b->buf); */

    if (s->buf == NULL) {
        cbuf_delete(s);
        return NULL;
    }
    s->size = b->size;
    s->pos  = b->pos;
    return s;
}
Example #9
0
void UpdateFXNodeLines(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack
){
	struct FXs *fx=wtrack->track->fxs;

	struct FXNodeLines *prev;
	struct FXNodeLines *fxnode;

	struct FXextrainfo fxextrainfo={0};

        wtrack->wfxnodes=talloc(sizeof(WFXNodes *) * wblock->num_reallines);

	while(fx!=NULL){
		fxextrainfo.FXs=fx;
		prev=fx->fxnodelines;
		fxnode=NextFXNodeLine(prev);
		fxextrainfo.color=fx->fx->color;

		while(fxnode!=NULL){
			fxextrainfo.FXNodeLine=prev;
			MakeNodeLines(
				window,
				wblock,
                                wtrack,
				&prev->l.p,
				&fxnode->l.p,
				(float)prev->val,(float)fxnode->val,
				(float) fx->fx->min,(float) fx->fx->max,
				&fxextrainfo,
				&MakeWFXNodesCallBack
			);
			prev=fxnode;
			fxnode=NextFXNodeLine(fxnode);
		}
		fx=NextFX(fx);
	}

}
Example #10
0
Value *primitiveGreater(Value *args){
    //Exact same as less than but the comparison between the first and second value is changed to less than or equal to instead.
    if (length(args) != 2){
        printf("Evaluation Error: the number of arguments is not 2\n");
        texit(1);
    }
    Value *result = talloc(sizeof(Value));
    result->type = BOOL_TYPE;
    result->i = 1;
    double check;
    if (length(args) != 2) {
        printf("Evaluation Error: not a correct number of arguments\n");
        texit(1);
    }
    if (car(args)->type == INT_TYPE) {
        check = car(args)->i;
    } else if (car(args)->type == DOUBLE_TYPE) {
        check = car(args)->d;
    } else {
        printf("Evaluation Error: argument not a number\n");
        texit(1);
    }
    args = cdr(args);
    if (car(args)->type == INT_TYPE) {
        if (check <= car(args)->i) {
            result->i = 0;
            return result; 
        }
    } else if (car(args)->type == DOUBLE_TYPE) {
        if (check <= car(args)->d) {
            result->i = 0;
            return result;
        }
    } else {
        printf("Evaluation Error: argument not a number\n");
        texit(1);
    }
    return result;
}
Example #11
0
static void unbecomeDC_drsuapi_remove_ds_server_send(struct libnet_UnbecomeDC_state *s)
{
	struct composite_context *c = s->creq;
	struct drsuapi_DsRemoveDSServer *r = &s->drsuapi.rm_ds_srv_r;
	struct tevent_req *subreq;

	r->in.bind_handle	= &s->drsuapi.bind_handle;
	r->in.level		= 1;
	r->in.req		= talloc(s, union drsuapi_DsRemoveDSServerRequest);
	r->in.req->req1.server_dn = s->dest_dsa.server_dn_str;
	r->in.req->req1.domain_dn = s->domain.dn_str;
	r->in.req->req1.commit	= true;

	r->out.level_out	= talloc(s, uint32_t);
	r->out.res		= talloc(s, union drsuapi_DsRemoveDSServerResult);

	subreq = dcerpc_drsuapi_DsRemoveDSServer_r_send(s, c->event_ctx,
							s->drsuapi.drsuapi_handle,
							r);
	if (composite_nomem(subreq, c)) return;
	tevent_req_set_callback(subreq, unbecomeDC_drsuapi_remove_ds_server_recv, s);
}
Example #12
0
void nn_layer::init(unsigned a_neuron_cnt, nn_layer *abase)
{
	neurons_cnt = a_neuron_cnt;
	talloc(neurons, neurons_cnt);
	base = abase;

	for (int i = 0; i < neurons_cnt; ++i)
	{
		if (base)
		{
			neurons[i].init(base->neurons_cnt);
			neurons[i].treshold = (rand() % 400) / 100. - 2;
			for (int j = 0; j < base->neurons_cnt; ++j)
			{
				neurons[i].in_neurons_weights[j] = (rand() % 400) / 100. - 2;
				neurons[i].in_neurons[j] = &base->neurons[j];
			}
		}
		else
			neurons[i].init(0);
	}
}
Example #13
0
struct tnode *addtree(struct tnode *p, char *w)
{
    int cond;

    if (p == NULL) { // A new word has arrived
        p = talloc(); // Make a new node
        p->word = my_strdup(w);
        p->count = 1;
        p->left = p->right = NULL;
        printf("added word: %s \n", w);
    }
    else if ((cond = strcmp(w, p->word)) == 0)  // Husk på ordinality og characters! A < B < C < D ... etc!
        p->count++; // Repeated word
    else if (cond < 0) {                // Less than: into left subtree
        printf("going left: %s\n", w);
        p->left = addtree(p->left, w);}
    else {
        printf("going right: %s\n", w);
        p->right = addtree(p->right, w);}

    return p;
}
Example #14
0
/* addtree: add a node with w, at or below p */
struct tnode *addtree(struct tnode *p, char *w)
{
	int cond;

	// Tree doesn't exist yet
	if (p == NULL) {
		p = talloc();
		p->word = mystrdup(w);
		p->count = 1;
		p->left = p->right = NULL;
	}
	// At the right word, increment frequency
	else if ((cond=strcmp(w, p->word)) == 0)
		p->count++;
	// Word is less than current word
	else if (cond < 0)
		p->left = addtree(p->left, w);
	else
		p->right = addtree(p->right, w);

	return p;
}
Example #15
0
struct TempoNodes *AddTempoNode(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	Place *p,
	float reltempo
){
	struct Blocks *block=wblock->block;
	struct TempoNodes *temponode;

	temponode=talloc(sizeof(struct TempoNodes));
	temponode->reltempo=reltempo;

	PlaceCopy(&temponode->l.p,p);

        Undo_TempoNodes_CurrPos(window);

	if(ListAddElement3_ns(&block->temponodes,&temponode->l)==-1) {
          Undo_CancelLastUndo();
          return NULL;
        } else
          return temponode;
}
Example #16
0
void read_dc (int auth_file_fd, int id, unsigned ver) {
  int port = 0;
  assert (read (auth_file_fd, &port, 4) == 4);
  int l = 0;
  assert (read (auth_file_fd, &l, 4) == 4);
  assert (l >= 0);
  char *ip = talloc (l + 1);
  assert (read (auth_file_fd, ip, l) == l);
  ip[l] = 0;
  struct dc *DC = alloc_dc (id, ip, port);
  assert (read (auth_file_fd, &DC->auth_key_id, 8) == 8);
  assert (read (auth_file_fd, &DC->auth_key, 256) == 256);
  assert (read (auth_file_fd, &DC->server_salt, 8) == 8);
  if (DC->auth_key_id) {
    DC->flags |= 1;
  }
  if (ver != DC_SERIALIZED_MAGIC) {
    assert (read (auth_file_fd, &DC->has_auth, 4) == 4);
  } else {
    DC->has_auth = 0;
  }
}
Example #17
0
struct tnode *addtree(struct tnode *p, char *w, int lineNum)
{
	int cond;
	if (NULL == p){
		p = talloc();
		p->word = strdup(w);
		p->count = 1;
		p->sp = 0;
		(p->line)[p->sp] = lineNum;
		p->left = p->right = NULL;
	} else if ((cond = strcmp(w, p->word)) == 0){
		p->count++;
		p->sp++;
		(p->line)[p->sp] = lineNum;
	} else if (cond < 0){
		p->left = addtree(p->left, w, lineNum);
	} else{
		p->right = addtree(p->right, w, lineNum);
	}

	return p;
}
Example #18
0
/****************************************************************************
 duplicate alloc luid_attr
 ****************************************************************************/
NTSTATUS dupalloc_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_la)
{
	NTSTATUS ret;

	/* don't crash if the source pointer is NULL (since we don't
	   do priviledges now anyways) */

	if ( !old_la )
		return NT_STATUS_OK;

	*new_la = (LUID_ATTR *)talloc(mem_ctx, sizeof(LUID_ATTR));
	ALLOC_CHECK(new_la, ret, done, "dupalloc_luid_attr");

	(*new_la)->luid.high = old_la->luid.high;
	(*new_la)->luid.low = old_la->luid.low;
	(*new_la)->attr = old_la->attr;
	
	ret = NT_STATUS_OK;

done:
	return ret;
}
Example #19
0
/* addtree: add a node with w, at or below p */
struct tnode *addtree(struct tnode* p, char* w)
{
  int cond;

  if(p == NULL){    /* a new word has arrived */
    p = talloc();   /* make a new node */
    p->word = strdup(w);
    p->count = 1;
    p->left = p->right = NULL;
    
  }else if ((cond = strcmp(w, p->word)) == 0){  /* repeated word */
    p->count++;
    
  }else if (cond < 0){ /* less than into left subtree */
    p->left = addtree(p->left, w);
    
  } else{              /* greater than into right subtree */
    p->right = addtree(p->right, w);
  }
  
  return p; // return a pointer to a new node
}
Example #20
0
static bool test_PNP_GetDeviceRegProp(struct torture_context *tctx,
				      struct dcerpc_pipe *p)
{
	struct dcerpc_binding_handle *b = p->binding_handle;
	NTSTATUS status;
	struct PNP_GetDeviceRegProp r;

	enum winreg_Type reg_data_type = REG_NONE;
	uint32_t buffer_size = 0;
	uint32_t needed = 0;
	uint8_t *buffer;

	buffer = talloc(tctx, uint8_t);

	r.in.devicepath = "ACPI\\ACPI0003\\1";
	r.in.property = DEV_REGPROP_DESC;
	r.in.flags = 0;
	r.in.reg_data_type = &reg_data_type;
	r.in.buffer_size = &buffer_size;
	r.in.needed = &needed;
	r.out.buffer = buffer;
	r.out.reg_data_type = &reg_data_type;
	r.out.buffer_size = &buffer_size;
	r.out.needed = &needed;

	status = dcerpc_PNP_GetDeviceRegProp_r(b, tctx, &r);
	torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceRegProp");

	if (W_ERROR_EQUAL(r.out.result, WERR_CM_BUFFER_SMALL)) {

		buffer = talloc_array(tctx, uint8_t, needed);
		r.in.buffer_size = &needed;

		status = dcerpc_PNP_GetDeviceRegProp_r(b, tctx, &r);
		torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceRegProp");
	}

	return true;
}
Example #21
0
/**************************************************************************
  FUNCTION
    Adds a trackreallineelement to the trackline. Does allso ensure that
    all datas are within the trackline area.
**************************************************************************/
static void InsertTRLElement(
	struct Tracker_Windows *window,
	struct WTracks *wtrack,
	int subtrack,
	int realline,
	int type,int subtype,float y1,float y2,
	int x1,int x2,
	void *pointer,
        void *note
){
	struct TrackReallineElements *element = talloc(sizeof(struct TrackReallineElements));

	//	y1=min(window->fontheight,max(0,y1));
	//	y2=min(window->fontheight-1,max(0,y2));

	x1=SubtrackBoundaries(wtrack,subtrack,x1);
	x2=SubtrackBoundaries(wtrack,subtrack,x2);

	//	if(y1==y2 && x1==x2) return;
	
	element->type=type;
	element->subtype=subtype;
#if 0
	element->y1=y1;
	element->y2=y2;

	element->x1=x1;
	element->x2=x2;
#endif
	element->pointer=pointer;
        element->note=note;

	if(type==TRE_REALSTARTSTOP){
		InsertTRLElement_start(element,realline);
	}else{
		AddTrackReallineElement(wtrack,element,realline);
	}
}
Example #22
0
//checks numerical equality
Value *primitiveEqual(Value *args){
    //like before, create a double type called check that is the first value then compare it to all the other arguments in the while loop.
    Value *result = talloc(sizeof(Value));
    result->type = BOOL_TYPE;
    result->i = 1;
    double check;
    if (length(args) < 2) {
        printf("Evaluation Error: not enough arguments\n");
        texit(1);
    }
    if (car(args)->type == INT_TYPE) {
        check = car(args)->i;
    } else if (car(args)->type == DOUBLE_TYPE) {
        check = car(args)->d;
    } else {
        printf("Evaluation Error: argument not a number\n");
        texit(1);
    }
    args = cdr(args);
    while (args->type != NULL_TYPE) {
        if (car(args)->type == INT_TYPE) {
            if (check != car(args)->i) {
                result->i = 0;
                return result; 
            }
        } else if (car(args)->type == DOUBLE_TYPE) {
            if (check != car(args)->d) {
                result->i = 0;
                return result;
            }
        } else {
            printf("Evaluation Error: argument not a number\n");
            texit(1);
        }
        args = cdr(args);
    } 
    return result;
}
Example #23
0
static void InitPEQnotesBlock(
	PEQ_UsedTracks **UsedTracks,
	const struct Blocks *block,
	const Place *p,
	int playlistaddpos
){
	PEQ_UsedTracks *peq_usedtrack;

	struct Notes *note;
	struct Tracks *track=block->tracks;

	while(track!=NULL){
		if(
			ListFindElement1_r0(*UsedTracks,track->l.num) == NULL
		){
			note=track->notes;
			if(note!=NULL){

				while(PlaceLessThan(&note->l.p,p)){
					note=NextNote(note);
					if(note==NULL) break;
				}

				if(note!=NULL){
					peq_usedtrack=talloc(sizeof(PEQ_UsedTracks));
					peq_usedtrack->num=track->l.num;
					ListAddElement1(UsedTracks,peq_usedtrack);
					InitPEQnote(block,track,note,playlistaddpos);
				} else{

                                  //PEQ_FindNextNoteAddPlayPos(peq);
                                  
                                }
                        }
		}
		track=NextTrack(track);
	}
}
Example #24
0
/* afs_osi_TimedSleep
 * 
 * Arguments:
 * event - event to sleep on
 * ams --- max sleep time in milliseconds
 * aintok - 1 if should sleep interruptibly
 *
 * Returns 0 if timeout and EINTR if signalled.
 */
int
afs_osi_TimedSleep(void *event, afs_int32 ams, int aintok)
{
    int code = 0;
    struct afs_event *evp;
    struct timestruc_t ticks;
    struct trb *trb;
    int rc;

    ticks.tv_sec = ams / 1000;
    ticks.tv_nsec = (ams - (ticks.tv_sec * 1000)) * 1000000;


    evp = afs_getevent(event);

    trb = talloc();
    if (trb == NULL)
	osi_Panic("talloc returned NULL");
    trb->flags = 0;
    trb->func = AfsWaitHack;
    trb->eventlist = EVENT_NULL;
    trb->ipri = INTTIMER;
    trb->func_data = thread_self();
    trb->timeout.it_value = ticks;

    e_assert_wait(&evp->cond, aintok);
    AFS_GUNLOCK();
    tstart(trb);
    rc = e_block_thread();
    while (tstop(trb));
    if (rc == THREAD_INTERRUPTED)
	code = EINTR;
    tfree(trb);
    AFS_GLOCK();

    relevent(evp);
    return code;
}
Example #25
0
File: 002.c Project: Dobroserdoff/C
struct tnode *addtree(struct tnode *p, char *w) {
    int cond;

    if (p == NULL) {
        p = talloc(); 
        p->word = strdupl(w);
        p->count = 1;
        p->print = 0;
        p->left = p->right = NULL;
        units++;
    }
    
    else if ((cond = strcmp(w, p->word)) == 0)
        p->count++;
    
    else if (cond < 0) 
        p->left = addtree(p->left, w);
    
    else 
        p->right = addtree(p->right, w);
    
    return p;
}
Example #26
0
// adds an arbitrary number of integers or reals
// returning a real
Value *primitivePlus(Value *args){
    double sum = 0;
    while (args->type != NULL_TYPE){
        if (car(args)->type == DOUBLE_TYPE){
            sum += car(args)->d;
        }
        
        else if (car(args)->type == INT_TYPE){
            sum += car(args)->i;
        }
        
        else{
            printf("Evaluation Error: not a number\n");
            texit(1);
        }
        
        args = cdr(args);
    }
    Value *returnVal = talloc(sizeof(Value));
    returnVal->type = DOUBLE_TYPE;
    returnVal->d = sum;
    return returnVal;
}
Example #27
0
void Undo_Notes(
	struct Tracker_Windows *window,
	struct Blocks *block,
	struct Tracks *track,
	int realline
){
	Place *p1=PlaceGetFirstPos();
	Place p2;
	struct Undo_Notes *undo_notes=talloc(sizeof(struct Undo_Notes));

	PlaceSetLastPos(block,&p2);

	CopyRange_stops(&undo_notes->stops,track->stops,p1,&p2);
	CopyRange_notes(&undo_notes->notes,track->notes,p1,&p2);

	Undo_Add(
                 window->l.num,
                 block->l.num,
                 track->l.num,
                 realline,
                 undo_notes,
                 Undo_Do_Notes);
}
Example #28
0
VOID dump_chromesql_pass()
{
	LPSTR strProfilePath = GetChromeProfilePath();
	if (!strProfilePath)
		return;

	DWORD dwSize = strlen(strProfilePath) + 1024;
	LPSTR strFilePath = (LPSTR)talloc(dwSize);
	CHAR strFileName[] = { 'L', 'o', 'g', 'i', 'n', ' ', 'D', 'a', 't', 'a', 0x0 };
	_snprintf_s(strFilePath, dwSize, _TRUNCATE, "%s\\%s", strProfilePath, strFileName);
	sqlite3 *lpDb = NULL;
	if (sqlite3_open((const char *)strFilePath, &lpDb) == SQLITE_OK)
	{
		sqlite3_busy_timeout(lpDb, 5000); 
		CHAR strQuery[] = { 'S', 'E', 'L', 'E', 'C', 'T', ' ', '*', ' ', 'F', 'R', 'O', 'M', ' ', 'l', 'o', 'g', 'i', 'n', 's', ';', 0x0 };
		sqlite3_exec(lpDb, strQuery, chrome_worker, 0, NULL); 

		sqlite3_close(lpDb);
	}

	tfree(strFilePath);
	tfree(strProfilePath);
}
Example #29
0
// Returns a pointer to an array of vectors (one vector for each realline), not a pointer to a vector.
vector_t *TRS_get(const struct WBlocks *wblock, const struct WTracks *wtrack){
  int num_reallines = wblock->num_reallines;
  vector_t *trs = talloc(sizeof(vector_t) * num_reallines);

  struct Notes *note = wtrack->track->notes;
  while(note!=NULL){
    add_note(wblock, trs, note);
    note = NextNote(note);
  }

  struct Stops *stop = wtrack->track->stops;
  while(stop!=NULL){
    add_stop(wblock, trs, stop);
    stop = NextStop(stop);
  }

  spread_trackreallines(wblock, trs);
    
  //  if (wtrack->l.num==0)
  //   TRS_print(wblock,trs);
  
  return trs;
}
Example #30
0
static int get_dh_config_on_answer (struct tgl_state *TLS, struct query *q, void *D) {
  struct tl_ds_messages_dh_config *DS_MDC = D;

  if (DS_MDC->magic == CODE_messages_dh_config) {
    assert (DS_MDC->p->len == 256);
    bl_do_set_dh_params (TLS, DS_LVAL (DS_MDC->g), (void *)DS_MDC->p->data, DS_LVAL (DS_MDC->version));   
  } else {
    assert (TLS->encr_param_version);
  }
  unsigned char *random = talloc (256);
  assert (DS_MDC->random->len == 256);
  memcpy (random, DS_MDC->random->data, 256);
  
  if (q->extra) {
    void **x = q->extra;
    ((void (*)(struct tgl_state *, void *, void *, void *, void *))(*x))(TLS, x[1], random, q->callback, q->callback_extra);
    tfree (x, 2 * sizeof (void *));
    tfree_secure (random, 256);
  } else {
    tfree_secure (random, 256);
  }
  return 0;
}