File: foldback.c

package info (click to toggle)
ekeyd 1.1.3-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 628 kB
  • ctags: 859
  • sloc: ansic: 5,189; sh: 271; makefile: 199; perl: 148
file content (38 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* daemon/foldback.c
 *
 * Entropy key foldback output
 *
 * Copyright 2009 Simtec Electronics
 *
 * For licence terms refer to the COPYING file.
 */

#include <stdint.h>
#include <sys/types.h>
#include <stdlib.h>

#include "stream.h"
#include "foldback.h"
#include "lstate.h"

static ssize_t
foldback_write(int fd, const void *buf, size_t count)
{
    return lstate_foldback_entropy(buf, count);
}

/* exported interface, documented in foldback.h */
estream_state_t *
estream_foldback_open(void)
{
    estream_state_t *stream_state;

    stream_state = calloc(1, sizeof(estream_state_t));
    if (stream_state == NULL)
        return NULL;

    stream_state->estream_read = NULL;
    stream_state->estream_write = foldback_write;

    return stream_state;
}