|
| 1 | +/* |
| 2 | + +----------------------------------------------------------------------+ |
| 3 | + | sha2.h: APR sha256 include file | |
| 4 | + +----------------------------------------------------------------------+ |
| 5 | + | Licensed under the Apache License, Version 2.0 (the "License"); you | |
| 6 | + | may not use this file except in compliance with the License. You may | |
| 7 | + | obtain a copy of the License at | |
| 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 | |
| 13 | + | implied. See the License for the specific language governing | |
| 14 | + | permissions and limitations under the License. | |
| 15 | + +----------------------------------------------------------------------+ |
| 16 | + | Author: Aaron D. Gifford <[email protected]> | |
| 17 | + +----------------------------------------------------------------------+ |
| 18 | + | A licence was granted to the ASF by Aaron on 4 November 2003. | |
| 19 | + +----------------------------------------------------------------------+ |
| 20 | +*/ |
| 21 | + |
| 22 | +#ifndef __SHA2_H__ |
| 23 | +#define __SHA2_H__ |
| 24 | + |
| 25 | +#ifdef __cplusplus |
| 26 | +extern "C" { |
| 27 | +#endif |
| 28 | + |
| 29 | +#include "apr.h" |
| 30 | + |
| 31 | +/*** SHA-256 Various Length Definitions ***********************/ |
| 32 | +#define SHA256_BLOCK_LENGTH 64 |
| 33 | +#define SHA256_DIGEST_LENGTH 32 |
| 34 | +#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) |
| 35 | + |
| 36 | + |
| 37 | +/*** SHA-256/384/512 Context Structures *******************************/ |
| 38 | +typedef struct _SHA256_CTX { |
| 39 | + apr_uint32_t state[8]; |
| 40 | + apr_uint64_t bitcount; |
| 41 | + apr_byte_t buffer[SHA256_BLOCK_LENGTH]; |
| 42 | +} SHA256_CTX; |
| 43 | + |
| 44 | + |
| 45 | +/*** SHA-256/384/512 Function Prototypes ******************************/ |
| 46 | +void apr__SHA256_Init(SHA256_CTX *); |
| 47 | +void apr__SHA256_Update(SHA256_CTX *, const apr_byte_t *, size_t); |
| 48 | +void apr__SHA256_Final(apr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *); |
| 49 | +char* apr__SHA256_End(SHA256_CTX *, char [SHA256_DIGEST_STRING_LENGTH]); |
| 50 | +char* apr__SHA256_Data(const apr_byte_t *, size_t, |
| 51 | + char [SHA256_DIGEST_STRING_LENGTH]); |
| 52 | + |
| 53 | +#ifdef __cplusplus |
| 54 | +} |
| 55 | +#endif /* __cplusplus */ |
| 56 | + |
| 57 | +#endif /* __SHA2_H__ */ |
| 58 | + |
| 59 | +/* |
| 60 | + * Local variables: |
| 61 | + * tab-width: 4 |
| 62 | + * c-basic-offset: 4 |
| 63 | + * End: |
| 64 | + * vim600: noet sw=4 ts=4 fdm=marker |
| 65 | + * vim<600: noet sw=4 ts=4 |
| 66 | + */ |
0 commit comments