*/
/** @file alsabg.c
* @brief Background-thread interface to ALSA
+ *
+ * This wraps ALSA with an interface which calls back to the client from a
+ * thread. It's not intended for completely general use, just what DisOrder
+ * needs.
+ *
+ * Only builds on Linux systems.
*/
#include "common.h"
ep(pthread_create(&alsa_bg_play_tid, 0, alsa_bg_play, 0));
}
+/** @brief Deinitialize background ALSA playback
+ *
+ * The opposite of alsa_bg_init().
+ */
void alsa_bg_close(void) {
void *r;
/** @brief Supply audio callback
* @param dst Where to write audio data
* @param nsamples Number of samples to write
+ * @return Number of samples written
*
* This function should write up to @p *nsamples samples of data at
* @p dst, and return the number of samples written, or -1 if some error
#include "arcfour.h"
+/** @brief Encrypt using Arcfour stream cipher
+ * @param context Context structure
+ * @param inbuf Input buffer
+ * @param outbuf Output buffer
+ * @param length Number of bytes in @p inbuf
+ *
+ * Copies from @p inbuf to @p outbuf, encrypting (or decrypting) using
+ * the stream controlled by @p context.
+ */
void
arcfour_stream (arcfour_context * context, const char *inbuf, char *outbuf,
size_t length)
context->idx_j = j;
}
+/** @brief Initialize an @ref arcfour_context
+ * @param context Context structure
+ * @param key Key data
+ * @param keylen Length of key
+ *
+ * Initializes @p context using @p key.
+ */
void
arcfour_setkey (arcfour_context * context, const char *key, size_t keylen)
{
#define ARCFOUR_SBOX_SIZE 256
+/** @brief Context structture for Arcfour stream cipher */
typedef struct
{
char sbox[ARCFOUR_SBOX_SIZE];
/** @brief Structure of algorithm lookup table */
struct algorithm {
+ /** @brief DisOrder algorithm name */
const char *name;
+
+ /** @brief gcrypt algorithm ID */
int id;
};
* @param nchallenge Size of challenge
* @param password Password
* @param algo Algorithm to use
+ * @return Hex string or NULL on error
*
* Computes H(challenge|password) and returns it as a newly allocated hex
* string, or returns NULL on error.