~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/random/unix/sha2.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2003-2005 The Apache Software Foundation or its licensors, as
 
2
 * applicable.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
/*
 
17
 * FILE:        sha2.h
 
18
 * AUTHOR:      Aaron D. Gifford <me@aarongifford.com>
 
19
 * 
 
20
 * A licence was granted to the ASF by Aaron on 4 November 2003.
 
21
 */
 
22
 
 
23
#ifndef __SHA2_H__
 
24
#define __SHA2_H__
 
25
 
 
26
#ifdef __cplusplus
 
27
extern "C" {
 
28
#endif
 
29
 
 
30
#include "apr.h"
 
31
 
 
32
/*** SHA-256/384/512 Various Length Definitions ***********************/
 
33
#define SHA256_BLOCK_LENGTH             64
 
34
#define SHA256_DIGEST_LENGTH            32
 
35
#define SHA256_DIGEST_STRING_LENGTH     (SHA256_DIGEST_LENGTH * 2 + 1)
 
36
#define SHA384_BLOCK_LENGTH             128
 
37
#define SHA384_DIGEST_LENGTH            48
 
38
#define SHA384_DIGEST_STRING_LENGTH     (SHA384_DIGEST_LENGTH * 2 + 1)
 
39
#define SHA512_BLOCK_LENGTH             128
 
40
#define SHA512_DIGEST_LENGTH            64
 
41
#define SHA512_DIGEST_STRING_LENGTH     (SHA512_DIGEST_LENGTH * 2 + 1)
 
42
 
 
43
 
 
44
/*** SHA-256/384/512 Context Structures *******************************/
 
45
typedef struct _SHA256_CTX {
 
46
        apr_uint32_t    state[8];
 
47
        apr_uint64_t    bitcount;
 
48
        apr_byte_t      buffer[SHA256_BLOCK_LENGTH];
 
49
} SHA256_CTX;
 
50
typedef struct _SHA512_CTX {
 
51
        apr_uint64_t    state[8];
 
52
        apr_uint64_t    bitcount[2];
 
53
        apr_byte_t      buffer[SHA512_BLOCK_LENGTH];
 
54
} SHA512_CTX;
 
55
 
 
56
typedef SHA512_CTX SHA384_CTX;
 
57
 
 
58
 
 
59
/*** SHA-256/384/512 Function Prototypes ******************************/
 
60
void apr__SHA256_Init(SHA256_CTX *);
 
61
void apr__SHA256_Update(SHA256_CTX *, const apr_byte_t *, size_t);
 
62
void apr__SHA256_Final(apr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *);
 
63
char* apr__SHA256_End(SHA256_CTX *, char [SHA256_DIGEST_STRING_LENGTH]);
 
64
char* apr__SHA256_Data(const apr_byte_t *, size_t,
 
65
                  char [SHA256_DIGEST_STRING_LENGTH]);
 
66
 
 
67
void apr__SHA384_Init(SHA384_CTX *);
 
68
void apr__SHA384_Update(SHA384_CTX *, const apr_byte_t *, size_t);
 
69
void apr__SHA384_Final(apr_byte_t [SHA384_DIGEST_LENGTH], SHA384_CTX *);
 
70
char* apr__SHA384_End(SHA384_CTX *, char [SHA384_DIGEST_STRING_LENGTH]);
 
71
char* apr__SHA384_Data(const apr_byte_t *, size_t,
 
72
                  char [SHA384_DIGEST_STRING_LENGTH]);
 
73
 
 
74
void apr__SHA512_Init(SHA512_CTX *);
 
75
void apr__SHA512_Update(SHA512_CTX *, const apr_byte_t *, size_t);
 
76
void apr__SHA512_Final(apr_byte_t [SHA512_DIGEST_LENGTH], SHA512_CTX *);
 
77
char* apr__SHA512_End(SHA512_CTX *, char [SHA512_DIGEST_STRING_LENGTH]);
 
78
char* apr__SHA512_Data(const apr_byte_t *, size_t,
 
79
                  char [SHA512_DIGEST_STRING_LENGTH]);
 
80
 
 
81
#ifdef  __cplusplus
 
82
}
 
83
#endif /* __cplusplus */
 
84
 
 
85
#endif /* __SHA2_H__ */
 
86