Пример #1
0
status_t
CryptContext::Init(encryption_algorithm algorithm, encryption_mode mode,
	const uint8* key, size_t keyLength)
{
	_Uninit();

	ThreadContext threadContext;

	fAlgorithm = create_algorithm(algorithm);
	if (fAlgorithm == NULL)
		return B_NO_MEMORY;

	status_t status = fAlgorithm->Init(threadContext);
	if (status != B_OK)
		return status;

	fMode = create_mode(mode);
	if (fMode == NULL)
		return B_NO_MEMORY;

	status = fMode->Init(threadContext, fAlgorithm);
	if (status != B_OK)
		return status;

	fThreadContexts = new(std::nothrow) ThreadContext*[sThreadCount];
	if (fThreadContexts == NULL)
		return B_NO_MEMORY;

	for (int32 i = 0; i < sThreadCount; i++) {
		fThreadContexts[i] = new ThreadContext(threadContext);
	}

	return SetKey(key, keyLength);
}
Пример #2
0
void WMAPI CNetworkThrd::Run()
{
	_MainLoop();
	_Uninit();
}