Example #1
0
// store KeyB into context
int InitKeyB(pUinKey ptr,LPCSTR key)
{
	Sent_NetLog("InitKeyB: %s", key);

	if (!ptr->cntx)
		ptr->cntx = cpp_create_context(isProtoSmallPackets(ptr->hContact)?CPP_MODE_BASE64:0);

	if (!cpp_keyp(ptr->cntx)) {
		char *tmp = db_get_sa(ptr->hContact,MODULENAME,"PSK");
		if (tmp) {
		    cpp_init_keyp(ptr->cntx,tmp);	// make pre-shared key from password
		    mir_free(tmp);
		}
	}

	cpp_init_keyb(ptr->cntx,key);
	ptr->features = cpp_get_features(ptr->cntx);

	return cpp_get_error(ptr->cntx);
}
Example #2
0
// store KeyB into context
int InitKeyB(pUinKey ptr,LPCSTR key) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
	Sent_NetLog("InitKeyB: %s", key);
#endif
	if(!ptr->cntx)
		ptr->cntx = cpp_create_context(isProtoSmallPackets(ptr->hContact)?CPP_MODE_BASE64:0);

	if(!cpp_keyp(ptr->cntx)) {
		char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK");
		if(tmp) {
		    cpp_init_keyp(ptr->cntx,tmp);	// make pre-shared key from password
		    mir_free(tmp);
		}
	}

	cpp_init_keyb(ptr->cntx,key);
	ptr->features = cpp_get_features(ptr->cntx);

	return cpp_get_error(ptr->cntx);
}