blob: ef60aab82d4b5fd4a17e8d72049ffd8c4335e3d3 [file] [log] [blame]
Kenny Rootdb0850c2013-10-08 12:52:07 -07001/*
2 * Copyright 2005 The Android Open Source Project
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * * Neither the name of Google Inc. nor the names of its contributors may
12 * be used to endorse or promote products derived from this software
13 * without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18 * EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_SHA1_H_
27#define SYSTEM_CORE_INCLUDE_MINCRYPT_SHA1_H_
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080028
Doug Zongker8e5b63d2013-04-10 09:22:02 -070029#include <stdint.h>
30#include "hash-internal.h"
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080031
32#ifdef __cplusplus
33extern "C" {
Doug Zongker8e5b63d2013-04-10 09:22:02 -070034#endif // __cplusplus
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080035
Doug Zongker8e5b63d2013-04-10 09:22:02 -070036typedef HASH_CTX SHA_CTX;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080037
Doug Zongkera6de77d2009-08-17 15:38:31 -070038void SHA_init(SHA_CTX* ctx);
39void SHA_update(SHA_CTX* ctx, const void* data, int len);
40const uint8_t* SHA_final(SHA_CTX* ctx);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080041
Doug Zongker8e5b63d2013-04-10 09:22:02 -070042// Convenience method. Returns digest address.
43// NOTE: *digest needs to hold SHA_DIGEST_SIZE bytes.
44const uint8_t* SHA_hash(const void* data, int len, uint8_t* digest);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080045
46#define SHA_DIGEST_SIZE 20
47
48#ifdef __cplusplus
49}
Doug Zongker8e5b63d2013-04-10 09:22:02 -070050#endif // __cplusplus
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080051
Kenny Rootdb0850c2013-10-08 12:52:07 -070052#endif // SYSTEM_CORE_INCLUDE_MINCRYPT_SHA1_H_