1 /******************************************************************************
2 * NTRU Cryptography Reference Source Code
3 * Copyright (c) 2009-2013, by Security Innovation, Inc. All rights reserved.
5 * ntru_crypto_hash_basics.c is a component of ntru-crypto.
7 * Copyright (C) 2009-2013 Security Innovation
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 *****************************************************************************/
25 /******************************************************************************
27 * File: ntru_crypto_hash_basics.h
29 * Contents: Common definitions for all hash algorithms.
31 *****************************************************************************/
33 #ifndef NTRU_CRYPTO_HASH_BASICS_H
34 #define NTRU_CRYPTO_HASH_BASICS_H
36 #include "ntru_crypto_platform.h"
44 NTRU_CRYPTO_HASH_ALGID_NONE
= 0,
45 NTRU_CRYPTO_HASH_ALGID_SHA1
,
46 NTRU_CRYPTO_HASH_ALGID_SHA256
,
47 } NTRU_CRYPTO_HASH_ALGID
;
54 #define NTRU_CRYPTO_HASH_OK ((uint32_t)0x00)
55 #define NTRU_CRYPTO_HASH_FAIL ((uint32_t)0x01)
56 #define NTRU_CRYPTO_HASH_BAD_PARAMETER ((uint32_t)0x02)
57 #define NTRU_CRYPTO_HASH_OVERFLOW ((uint32_t)0x03)
58 #define NTRU_CRYPTO_HASH_BAD_ALG ((uint32_t)0x20)
59 #define NTRU_CRYPTO_HASH_OUT_OF_MEMORY ((uint32_t)0x21)
61 // For backward-compatibility
62 typedef uint32_t NTRU_CRYPTO_HASH_ERROR
;
69 #define HASH_DATA_ONLY 0
70 #define HASH_INIT (1 << 0)
71 #define HASH_FINISH (1 << 1)
72 #define HASH_ZERO_PAD (1 << 2)
75 #endif /* NTRU_CRYPTO_HASH_BASICS_H */