blob: 3a87c31787c06fc623d6845560741bddaa4559eb [file] [log] [blame]
Ethan Yonker1e4a1992014-11-06 09:05:01 -06001/*
2 * Copyright 2011 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 */
Dees Troybb4c0cb2013-11-02 20:25:14 +000026
Ethan Yonker1e4a1992014-11-06 09:05:01 -060027#ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_
28#define SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_
Dees Troybb4c0cb2013-11-02 20:25:14 +000029
30#include <stdint.h>
31#include "hash-internal.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif // __cplusplus
36
37typedef HASH_CTX SHA256_CTX;
38
39void SHA256_init(SHA256_CTX* ctx);
40void SHA256_update(SHA256_CTX* ctx, const void* data, int len);
41const uint8_t* SHA256_final(SHA256_CTX* ctx);
42
43// Convenience method. Returns digest address.
44const uint8_t* SHA256_hash(const void* data, int len, uint8_t* digest);
45
46#define SHA256_DIGEST_SIZE 32
47
48#ifdef __cplusplus
49}
50#endif // __cplusplus
51
Ethan Yonker1e4a1992014-11-06 09:05:01 -060052#endif // SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_