LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
hmac_sha1.h
Go to the documentation of this file.
1/*
2 * hmac_sha1.h
3 *
4 * Version 1.0.0
5 *
6 * Written by Aaron D. Gifford <me@aarongifford.com>
7 *
8 * Copyright 1998, 2000 Aaron D. Gifford. All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the copyright holder nor the names of contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35#ifndef HEADER_HMAC_SHA1_H
36#define HEADER_HMAC_SHA1_H
37
38/*
39 * Include SHA-1 stuff - CHOOSE WHICH SOURCE to use for the SHA1 functions
40 *
41 * Use the below include if your system has a library with SHA1 and be sure
42 * to link to the library:
43 */
44
45/* #include <sha.h> */
46
47/*
48 * Or you can use Steve Reid's public domain SHA1 implementation:
49 */
50
51#include "sha.h"
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57#define HMAC_SHA1_DIGEST_LENGTH 20
58#define HMAC_SHA1_BLOCK_LENGTH 64
59
60/* The HMAC_SHA1 structure: */
61typedef struct _HMAC_SHA1_CTX {
66 unsigned int keylen;
67 unsigned int hashkey;
69
70#ifndef NOPROTO
72void HMAC_SHA1_UpdateKey(HMAC_SHA1_CTX *ctx, unsigned char *key, unsigned int keylen);
75void HMAC_SHA1_UpdateMessage(HMAC_SHA1_CTX *ctx, unsigned char *data, unsigned int datalen);
76void HMAC_SHA1_EndMessage(unsigned char *out, HMAC_SHA1_CTX *ctx);
78void HMAC_SHA1(void *secret, void *data, void *res, int len);
79#else
80void HMAC_SHA1_Init();
82void HMAC_SHA1_EndKey();
86void HMAC_SHA1_Done();
87#endif
88
89#ifdef __cplusplus
90}
91#endif
92
93#endif
struct _HMAC_SHA1_CTX HMAC_SHA1_CTX
#define HMAC_SHA1_BLOCK_LENGTH
Definition: hmac_sha1.h:58
void HMAC_SHA1_EndMessage(unsigned char *out, HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:170
void HMAC_SHA1(void *secret, void *data, void *res, int len)
Definition: hmac_sha1.c:190
void HMAC_SHA1_UpdateMessage(HMAC_SHA1_CTX *ctx, unsigned char *data, unsigned int datalen)
Definition: hmac_sha1.c:166
void HMAC_SHA1_Done(HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:181
void HMAC_SHA1_Init(HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:71
void HMAC_SHA1_StartMessage(HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:161
void HMAC_SHA1_UpdateKey(HMAC_SHA1_CTX *ctx, unsigned char *key, unsigned int keylen)
Definition: hmac_sha1.c:79
void HMAC_SHA1_EndKey(HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:133
unsigned int keylen
Definition: hmac_sha1.h:66
unsigned char key[HMAC_SHA1_BLOCK_LENGTH]
Definition: hmac_sha1.h:65
unsigned char ipad[HMAC_SHA1_BLOCK_LENGTH]
Definition: hmac_sha1.h:62
unsigned char opad[HMAC_SHA1_BLOCK_LENGTH]
Definition: hmac_sha1.h:63
unsigned int hashkey
Definition: hmac_sha1.h:67
SHA_CTX shactx
Definition: hmac_sha1.h:64
Definition: sha.h:53
union @15 data