~ubuntu-branches/debian/squeeze/libnice/squeeze

« back to all changes in this revision

Viewing changes to stun/sha1.h

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Bigonville
  • Date: 2009-01-04 17:45:34 UTC
  • Revision ID: james.westby@ubuntu.com-20090104174534-dh5u1pfonumqa99c
Tags: upstream-0.0.4
ImportĀ upstreamĀ versionĀ 0.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * SHA1 hash implementation and interface functions
 
3
 * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License version 2 as
 
7
 * published by the Free Software Foundation.
 
8
 *
 
9
 * Alternatively, this software may be distributed under the terms of BSD
 
10
 * license.
 
11
 *
 
12
 * See README and COPYING for more details.
 
13
 */
 
14
 
 
15
#ifndef SHA1_H
 
16
#define SHA1_H
 
17
 
 
18
#ifdef _WIN32
 
19
#include "win32_common.h"
 
20
#else
 
21
#include <stdint.h>
 
22
#endif
 
23
#include <stddef.h>
 
24
 
 
25
#define SHA1_MAC_LEN 20
 
26
 
 
27
 
 
28
struct SHA1Context {
 
29
        uint32_t state[5];
 
30
        uint32_t count[2];
 
31
        unsigned char buffer[64];
 
32
};
 
33
 
 
34
typedef struct SHA1Context SHA1_CTX;
 
35
 
 
36
void SHA1Init(SHA1_CTX *context);
 
37
void SHA1Update(SHA1_CTX *context, const void *data, uint32_t len);
 
38
void SHA1Final(unsigned char digest[20], SHA1_CTX *context);
 
39
 
 
40
void sha1_vector(size_t num_elem, const uint8_t *addr[], const size_t *len,
 
41
    uint8_t *mac);
 
42
void hmac_sha1_vector(const uint8_t *key, size_t key_len, size_t num_elem,
 
43
    const uint8_t *addr[], const size_t *len, uint8_t *mac);
 
44
void hmac_sha1(const uint8_t *key, size_t key_len,
 
45
    const uint8_t *data, size_t data_len, uint8_t *mac);
 
46
void sha1_prf(const uint8_t *key, size_t key_len, const char *label,
 
47
    const uint8_t *data, size_t data_len, uint8_t *buf, size_t buf_len);
 
48
 
 
49
#endif /* SHA1_H */