~ubuntu-branches/ubuntu/natty/ntp/natty

« back to all changes in this revision

Viewing changes to lib/isc/include/isc/hmacsha.h

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-11-30 11:14:31 UTC
  • mfrom: (4.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20101130111431-7r00o0ck9qzwmm9f
Tags: 1:4.2.6.p2+dfsg-1ubuntu1
* Merge from debian unstable, remaining changes are:
  + debian/ntp.conf, debian/ntpdate.default: Change default server to
    ntp.ubuntu.com.
  + debian/ntpdate.ifup: Stop ntp before running ntpdate when an interface
    comes up, then start again afterwards.
  + debian/ntp.init, debian/rules: Only stop when entering single user mode.
  + Add enforcing AppArmor profile (LP: #382905):
    - debian/control: add Conflicts/Replaces on apparmor-profiles <
      2.3.1+1403-0ubuntu10 (since we are now shipping usr.sbin.ntpd) and
      apparmor < 2.3.1+1403-0ubuntu10 (since we are now shipping tunables/ntpd)
    - debian/control: add Suggests on apparmor
    - debian/ntp.dirs: add apparmor directories
    - debian/ntp.preinst: force complain on certain upgrades
    - debian/ntp.postinst: reload apparmor profile
    - debian/ntp.postrm: remove the force-complain file
    - add debian/apparmor-profile*
    - debian/rules: install apparmor-profile and apparmor-profile.tunable
    - debian/README.Debian: add note on AppArmor
  + debian/{control,rules}: add and enable hardened build for PIE
    (Debian bug 542721).
  + debian/apparmor-profile: adjust location of drift files (LP: #456308)
  + debian/rules, debian/ntp.dirs, debian/source_ntp.py: Add apport hook.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005-2007  Internet Systems Consortium, Inc. ("ISC")
 
3
 *
 
4
 * Permission to use, copy, modify, and/or distribute this software for any
 
5
 * purpose with or without fee is hereby granted, provided that the above
 
6
 * copyright notice and this permission notice appear in all copies.
 
7
 *
 
8
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 
9
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 
10
 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 
11
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 
12
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 
13
 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
14
 * PERFORMANCE OF THIS SOFTWARE.
 
15
 */
 
16
 
 
17
/* $Id: hmacsha.h,v 1.7 2007/06/19 23:47:18 tbox Exp $ */
 
18
 
 
19
/*! \file isc/hmacsha.h
 
20
 * This is the header file for the HMAC-SHA1, HMAC-SHA224, HMAC-SHA256,
 
21
 * HMAC-SHA334 and HMAC-SHA512 hash algorithm described in RFC 2104.
 
22
 */
 
23
 
 
24
#ifndef ISC_HMACSHA_H
 
25
#define ISC_HMACSHA_H 1
 
26
 
 
27
#include <isc/lang.h>
 
28
#include <isc/sha1.h>
 
29
#include <isc/sha2.h>
 
30
#include <isc/types.h>
 
31
 
 
32
#define ISC_HMACSHA1_KEYLENGTH ISC_SHA1_BLOCK_LENGTH
 
33
#define ISC_HMACSHA224_KEYLENGTH ISC_SHA224_BLOCK_LENGTH
 
34
#define ISC_HMACSHA256_KEYLENGTH ISC_SHA256_BLOCK_LENGTH
 
35
#define ISC_HMACSHA384_KEYLENGTH ISC_SHA384_BLOCK_LENGTH
 
36
#define ISC_HMACSHA512_KEYLENGTH ISC_SHA512_BLOCK_LENGTH
 
37
 
 
38
typedef struct {
 
39
        isc_sha1_t sha1ctx;
 
40
        unsigned char key[ISC_HMACSHA1_KEYLENGTH];
 
41
} isc_hmacsha1_t;
 
42
 
 
43
typedef struct {
 
44
        isc_sha224_t sha224ctx;
 
45
        unsigned char key[ISC_HMACSHA224_KEYLENGTH];
 
46
} isc_hmacsha224_t;
 
47
 
 
48
typedef struct {
 
49
        isc_sha256_t sha256ctx;
 
50
        unsigned char key[ISC_HMACSHA256_KEYLENGTH];
 
51
} isc_hmacsha256_t;
 
52
 
 
53
typedef struct {
 
54
        isc_sha384_t sha384ctx;
 
55
        unsigned char key[ISC_HMACSHA384_KEYLENGTH];
 
56
} isc_hmacsha384_t;
 
57
 
 
58
typedef struct {
 
59
        isc_sha512_t sha512ctx;
 
60
        unsigned char key[ISC_HMACSHA512_KEYLENGTH];
 
61
} isc_hmacsha512_t;
 
62
 
 
63
ISC_LANG_BEGINDECLS
 
64
 
 
65
void
 
66
isc_hmacsha1_init(isc_hmacsha1_t *ctx, const unsigned char *key,
 
67
                  unsigned int len);
 
68
 
 
69
void
 
70
isc_hmacsha1_invalidate(isc_hmacsha1_t *ctx);
 
71
 
 
72
void
 
73
isc_hmacsha1_update(isc_hmacsha1_t *ctx, const unsigned char *buf,
 
74
                    unsigned int len);
 
75
 
 
76
void
 
77
isc_hmacsha1_sign(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len);
 
78
 
 
79
isc_boolean_t
 
80
isc_hmacsha1_verify(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len);
 
81
 
 
82
 
 
83
void
 
84
isc_hmacsha224_init(isc_hmacsha224_t *ctx, const unsigned char *key,
 
85
                    unsigned int len);
 
86
 
 
87
void
 
88
isc_hmacsha224_invalidate(isc_hmacsha224_t *ctx);
 
89
 
 
90
void
 
91
isc_hmacsha224_update(isc_hmacsha224_t *ctx, const unsigned char *buf,
 
92
                      unsigned int len);
 
93
 
 
94
void
 
95
isc_hmacsha224_sign(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len);
 
96
 
 
97
isc_boolean_t
 
98
isc_hmacsha224_verify(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len);
 
99
 
 
100
 
 
101
void
 
102
isc_hmacsha256_init(isc_hmacsha256_t *ctx, const unsigned char *key,
 
103
                    unsigned int len);
 
104
 
 
105
void
 
106
isc_hmacsha256_invalidate(isc_hmacsha256_t *ctx);
 
107
 
 
108
void
 
109
isc_hmacsha256_update(isc_hmacsha256_t *ctx, const unsigned char *buf,
 
110
                      unsigned int len);
 
111
 
 
112
void
 
113
isc_hmacsha256_sign(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len);
 
114
 
 
115
isc_boolean_t
 
116
isc_hmacsha256_verify(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len);
 
117
 
 
118
 
 
119
void
 
120
isc_hmacsha384_init(isc_hmacsha384_t *ctx, const unsigned char *key,
 
121
                    unsigned int len);
 
122
 
 
123
void
 
124
isc_hmacsha384_invalidate(isc_hmacsha384_t *ctx);
 
125
 
 
126
void
 
127
isc_hmacsha384_update(isc_hmacsha384_t *ctx, const unsigned char *buf,
 
128
                      unsigned int len);
 
129
 
 
130
void
 
131
isc_hmacsha384_sign(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len);
 
132
 
 
133
isc_boolean_t
 
134
isc_hmacsha384_verify(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len);
 
135
 
 
136
 
 
137
void
 
138
isc_hmacsha512_init(isc_hmacsha512_t *ctx, const unsigned char *key,
 
139
                    unsigned int len);
 
140
 
 
141
void
 
142
isc_hmacsha512_invalidate(isc_hmacsha512_t *ctx);
 
143
 
 
144
void
 
145
isc_hmacsha512_update(isc_hmacsha512_t *ctx, const unsigned char *buf,
 
146
                      unsigned int len);
 
147
 
 
148
void
 
149
isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len);
 
150
 
 
151
isc_boolean_t
 
152
isc_hmacsha512_verify(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len);
 
153
 
 
154
ISC_LANG_ENDDECLS
 
155
 
 
156
#endif /* ISC_HMACSHA_H */