Beispiel #1
0
Eet_Error
eet_decipher(const void   *data,
             unsigned int  size,
             const char   *key,
             unsigned int  length,
             void        **result,
             unsigned int *result_length)
{
   Eina_Binbuf *out;
   Eina_Binbuf *in;

   in = eina_binbuf_manage_new(data, size, EINA_TRUE);
   out = emile_binbuf_decipher(EMILE_AES256_CBC, in, key, length);

   if (result_length) *result_length = out ? eina_binbuf_length_get(out) : 0;
   if (result) *result = out ? eina_binbuf_string_steal(out) : NULL;

   eina_binbuf_free(out);
   eina_binbuf_free(in);
   return out ? EET_ERROR_NONE : EET_ERROR_DECRYPT_FAILED;
}
static Eina_Bool _efl_egueb_io_request_url_completion_cb(void *data, int type EINA_UNUSED, void *event)
{
	Efl_Egueb_IO_Request *thiz = data;
	Ecore_Con_Event_Url_Complete *ev = event;
	Enesim_Stream *s;

	if (ev->url_con != thiz->conn)
		return EINA_TRUE;

	/* TODO can we avoid this dup? */
	s = enesim_stream_buffer_new(eina_binbuf_string_steal(thiz->binbuf),
			eina_binbuf_length_get(thiz->binbuf), free);
	thiz->in_event = EINA_TRUE;
	if (thiz->descriptor->completion)
		thiz->descriptor->completion(thiz, s);
	thiz->in_event = EINA_FALSE;
	enesim_stream_unref(s);

	if (thiz->destroy)
		efl_egueb_io_request_free(thiz);

	return EINA_TRUE;
}