123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
- /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
- /* sha256.h
- *
- * Copyright (C) 2006-2014 wolfSSL Inc.
- *
- * This file is part of CyaSSL.
- *
- * CyaSSL is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * CyaSSL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
- #ifndef CTAO_CRYPT_SHA256_H
- #define CTAO_CRYPT_SHA256_H
- #include "crypto/integer.h"
- /* in bytes */
- enum {
- SHA256_BLOCK_SIZE = 64,
- SHA256_DIGEST_SIZE = 32,
- SHA256_PAD_SIZE = 56
- };
- /* SHA256 digest */
- typedef struct SHA256 {
- word32 buffLen; /* in bytes */
- word32 loLen; /* length in bytes */
- word32 hiLen; /* length in bytes */
- word32 digest[SHA256_DIGEST_SIZE / sizeof(word32)];
- word32 buffer[SHA256_BLOCK_SIZE / sizeof(word32)];
- } SHA256;
- int SHA256Init(SHA256 *);
- int SHA256Update(SHA256 *, const byte *, word32);
- int SHA256Final(SHA256 *, byte *);
- int SHA256Hash(const byte *, word32, byte *);
- #endif /* CTAO_CRYPT_SHA256_H */
|