CyaSSL is an SSL library for devices like mbed.

Dependents:   cyassl-client Sync

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sha512.h Source File

sha512.h

00001 /* sha512.h
00002  *
00003  * Copyright (C) 2006-2010 Sawtooth Consulting Ltd.
00004  *
00005  * This file is part of CyaSSL.
00006  *
00007  * CyaSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * CyaSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00020  */
00021 
00022 
00023 #ifdef CYASSL_SHA512
00024 
00025 #ifndef CTAO_CRYPT_SHA512_H
00026 #define CTAO_CRYPT_SHA512_H
00027 
00028 #include "types.h"
00029 
00030 #ifdef __cplusplus
00031     extern "C" {
00032 #endif
00033 
00034 
00035 
00036 /* in bytes */
00037 enum {
00038     SHA512              =   4,   /* hash type unique */
00039     SHA512_BLOCK_SIZE   = 128,
00040     SHA512_DIGEST_SIZE  =  64,
00041     SHA512_PAD_SIZE     = 112 
00042 };
00043 
00044 
00045 /* Sha512 digest */
00046 typedef struct Sha512 {
00047     word32  buffLen;   /* in bytes          */
00048     word32  loLen;     /* length in bytes   */
00049     word32  hiLen;     /* length in bytes   */
00050     word64  digest[SHA512_DIGEST_SIZE / sizeof(word64)];
00051     word64  buffer[SHA512_BLOCK_SIZE  / sizeof(word64)];
00052 } Sha512;
00053 
00054 
00055 void InitSha512(Sha512*);
00056 void Sha512Update(Sha512*, const byte*, word32);
00057 void Sha512Final(Sha512*, byte*);
00058 
00059 
00060 #ifdef __cplusplus
00061     } /* extern "C" */
00062 #endif
00063 
00064 #endif /* CTAO_CRYPT_SHA512_H */
00065 #endif /* CYASSL_SHA512 */