Renesas / SecureDweet
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-2016 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 
00024 
00025 #ifndef WOLF_CRYPT_BLAKE2_H
00026 #define WOLF_CRYPT_BLAKE2_H
00027 
00028 #include <wolfssl/wolfcrypt/settings.h>
00029 
00030 #ifdef HAVE_BLAKE2
00031 
00032 #include <wolfssl/wolfcrypt/blake2-int.h>
00033 
00034 /* call old functions if using fips for the sake of hmac @wc_fips */
00035 #ifdef HAVE_FIPS
00036     /* Since hmac can call blake functions provide original calls */
00037     #define wc_InitBlake2b   InitBlake2b
00038     #define wc_Blake2bUpdate Blake2bUpdate
00039     #define wc_Blake2bFinal  Blake2bFinal
00040 #endif
00041 
00042 #ifdef __cplusplus
00043     extern "C" {
00044 #endif
00045 
00046 /* in bytes, variable digest size up to 512 bits (64 bytes) */
00047 enum {
00048     BLAKE2B_ID  = 7,   /* hash type unique */
00049     BLAKE2B_256 = 32   /* 256 bit type, SSL default */
00050 };
00051 
00052 
00053 /* BLAKE2b digest */
00054 typedef struct Blake2b {
00055     blake2b_state S[1];         /* our state */
00056     word32        digestSz;     /* digest size used on init */
00057 } Blake2b;
00058 
00059 
00060 WOLFSSL_API int wc_InitBlake2b(Blake2b*, word32);
00061 WOLFSSL_API int wc_Blake2bUpdate(Blake2b*, const byte*, word32);
00062 WOLFSSL_API int wc_Blake2bFinal(Blake2b*, byte*, word32);
00063 
00064 
00065 
00066 #ifdef __cplusplus
00067     }
00068 #endif
00069 
00070 #endif  /* HAVE_BLAKE2 */
00071 #endif  /* WOLF_CRYPT_BLAKE2_H */
00072 
00073