Xuyi Wang / wolfcrypt

Dependents:   OS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers blake2.h Source File

blake2.h

00001 /* blake2.h
00002  *
00003  * Copyright (C) 2006-2017 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL 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  * wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 /*!
00023     \file wolfssl/wolfcrypt/blake2.h
00024 */
00025 
00026 #ifndef WOLF_CRYPT_BLAKE2_H
00027 #define WOLF_CRYPT_BLAKE2_H
00028 
00029 #include <wolfcrypt/settings.h>
00030 
00031 #ifdef HAVE_BLAKE2
00032 
00033 #include <wolfcrypt/blake2-int.h>
00034 
00035 /* call old functions if using fips for the sake of hmac @wc_fips */
00036 #ifdef HAVE_FIPS
00037     /* Since hmac can call blake functions provide original calls */
00038     #define wc_InitBlake2b   InitBlake2b
00039     #define wc_Blake2bUpdate Blake2bUpdate
00040     #define wc_Blake2bFinal  Blake2bFinal
00041 #endif
00042 
00043 #ifdef __cplusplus
00044     extern "C" {
00045 #endif
00046 
00047 /* in bytes, variable digest size up to 512 bits (64 bytes) */
00048 enum {
00049     BLAKE2B_ID  = WC_HASH_TYPE_BLAKE2B,
00050     BLAKE2B_256 = 32   /* 256 bit type, SSL default */
00051 };
00052 
00053 
00054 /* BLAKE2b digest */
00055 typedef struct Blake2b {
00056     blake2b_state S[1];         /* our state */
00057     word32        digestSz;     /* digest size used on init */
00058 } Blake2b;
00059 
00060 
00061 WOLFSSL_API int wc_InitBlake2b(Blake2b*, word32);
00062 WOLFSSL_API int wc_Blake2bUpdate(Blake2b*, const byte*, word32);
00063 WOLFSSL_API int wc_Blake2bFinal(Blake2b*, byte*, word32);
00064 
00065 
00066 
00067 #ifdef __cplusplus
00068     }
00069 #endif
00070 
00071 #endif  /* HAVE_BLAKE2 */
00072 #endif  /* WOLF_CRYPT_BLAKE2_H */
00073 
00074