Alexandre Lision | 907ed2e | 2014-02-04 10:33:09 -0500 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 2013 Werner Dittmann |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library; if not, write to the Free Software |
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | |
| 18 | */ |
| 19 | |
| 20 | /** |
| 21 | * Methods to compute a Skein384 HMAC. |
| 22 | * |
| 23 | * @author Werner Dittmann <Werner.Dittmann@t-online.de> |
| 24 | */ |
| 25 | |
| 26 | #ifndef HMAC_SKEIN384_H |
| 27 | #define HMAC_SKEIN384_H |
| 28 | |
| 29 | /** |
| 30 | * @file skeinMac384.h |
| 31 | * @brief Function that provide Skein384 HMAC support |
| 32 | * |
| 33 | * @ingroup GNU_ZRTP |
| 34 | * @{ |
| 35 | */ |
| 36 | |
| 37 | #include <stdint.h> |
| 38 | |
| 39 | #ifndef SKEIN384_DIGEST_LENGTH |
| 40 | #define SKEIN384_DIGEST_LENGTH 48 |
| 41 | #endif |
| 42 | |
| 43 | #define SKEIN_SIZE Skein512 |
| 44 | |
| 45 | /** |
| 46 | * Compute Skein384 HMAC. |
| 47 | * |
| 48 | * This functions takes one data chunk and computes its Skein384 HMAC. |
| 49 | * |
| 50 | * @param key |
| 51 | * The MAC key. |
| 52 | * @param key_length |
| 53 | * Lneght of the MAC key in bytes |
| 54 | * @param data |
| 55 | * Points to the data chunk. |
| 56 | * @param data_length |
| 57 | * Length of the data in bytes |
| 58 | * @param mac |
| 59 | * Points to a buffer that receives the computed digest. This |
| 60 | * buffer must have a size of at least 48 bytes (SKEIN384_DIGEST_LENGTH). |
| 61 | * @param mac_length |
| 62 | * Point to an integer that receives the length of the computed HMAC. |
| 63 | */ |
| 64 | void macSkein384( uint8_t* key, uint32_t key_length, uint8_t* data, int32_t data_length, uint8_t* mac, uint32_t* mac_length ); |
| 65 | |
| 66 | /** |
| 67 | * Compute Skein384 HMAC over several data cunks. |
| 68 | * |
| 69 | * This functions takes several data chunk and computes the Skein384 HAMAC. |
| 70 | * |
| 71 | * @param key |
| 72 | * The MAC key. |
| 73 | * @param key_length |
| 74 | * Lneght of the MAC key in bytes |
| 75 | * @param data |
| 76 | * Points to an array of pointers that point to the data chunks. A NULL |
| 77 | * pointer in an array element terminates the data chunks. |
| 78 | * @param data_length |
| 79 | * Points to an array of integers that hold the length of each data chunk. |
| 80 | * @param mac |
| 81 | * Points to a buffer that receives the computed digest. This |
| 82 | * buffer must have a size of at least 48 bytes (SKEIN384_DIGEST_LENGTH). |
| 83 | * @param mac_length |
| 84 | * Point to an integer that receives the length of the computed HMAC. |
| 85 | */ |
| 86 | |
| 87 | void macSkein384( uint8_t* key, uint32_t key_length, uint8_t* data[], uint32_t data_length[], uint8_t* mac, uint32_t* mac_length ); |
| 88 | /** |
| 89 | * @} |
| 90 | */ |
| 91 | #endif |