Hannes Tschofenig
/
aes-gcm-test-program
Example program to test AES-GCM functionality. Used for a workshop
SSL/include/polarssl/havege.h@0:796d0f61a05b, 2018-09-27 (annotated)
- Committer:
- HannesTschofenig
- Date:
- Thu Sep 27 06:34:22 2018 +0000
- Revision:
- 0:796d0f61a05b
Example AES-GCM test program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
HannesTschofenig | 0:796d0f61a05b | 1 | /** |
HannesTschofenig | 0:796d0f61a05b | 2 | * \file havege.h |
HannesTschofenig | 0:796d0f61a05b | 3 | * |
HannesTschofenig | 0:796d0f61a05b | 4 | * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion |
HannesTschofenig | 0:796d0f61a05b | 5 | * |
HannesTschofenig | 0:796d0f61a05b | 6 | * Copyright (C) 2006-2013, Brainspark B.V. |
HannesTschofenig | 0:796d0f61a05b | 7 | * |
HannesTschofenig | 0:796d0f61a05b | 8 | * This file is part of PolarSSL (http://www.polarssl.org) |
HannesTschofenig | 0:796d0f61a05b | 9 | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> |
HannesTschofenig | 0:796d0f61a05b | 10 | * |
HannesTschofenig | 0:796d0f61a05b | 11 | * All rights reserved. |
HannesTschofenig | 0:796d0f61a05b | 12 | * |
HannesTschofenig | 0:796d0f61a05b | 13 | * This program is free software; you can redistribute it and/or modify |
HannesTschofenig | 0:796d0f61a05b | 14 | * it under the terms of the GNU General Public License as published by |
HannesTschofenig | 0:796d0f61a05b | 15 | * the Free Software Foundation; either version 2 of the License, or |
HannesTschofenig | 0:796d0f61a05b | 16 | * (at your option) any later version. |
HannesTschofenig | 0:796d0f61a05b | 17 | * |
HannesTschofenig | 0:796d0f61a05b | 18 | * This program is distributed in the hope that it will be useful, |
HannesTschofenig | 0:796d0f61a05b | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
HannesTschofenig | 0:796d0f61a05b | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
HannesTschofenig | 0:796d0f61a05b | 21 | * GNU General Public License for more details. |
HannesTschofenig | 0:796d0f61a05b | 22 | * |
HannesTschofenig | 0:796d0f61a05b | 23 | * You should have received a copy of the GNU General Public License along |
HannesTschofenig | 0:796d0f61a05b | 24 | * with this program; if not, write to the Free Software Foundation, Inc., |
HannesTschofenig | 0:796d0f61a05b | 25 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
HannesTschofenig | 0:796d0f61a05b | 26 | */ |
HannesTschofenig | 0:796d0f61a05b | 27 | #ifndef POLARSSL_HAVEGE_H |
HannesTschofenig | 0:796d0f61a05b | 28 | #define POLARSSL_HAVEGE_H |
HannesTschofenig | 0:796d0f61a05b | 29 | |
HannesTschofenig | 0:796d0f61a05b | 30 | #include <string.h> |
HannesTschofenig | 0:796d0f61a05b | 31 | |
HannesTschofenig | 0:796d0f61a05b | 32 | #define COLLECT_SIZE 1024 |
HannesTschofenig | 0:796d0f61a05b | 33 | |
HannesTschofenig | 0:796d0f61a05b | 34 | #ifdef __cplusplus |
HannesTschofenig | 0:796d0f61a05b | 35 | extern "C" { |
HannesTschofenig | 0:796d0f61a05b | 36 | #endif |
HannesTschofenig | 0:796d0f61a05b | 37 | |
HannesTschofenig | 0:796d0f61a05b | 38 | /** |
HannesTschofenig | 0:796d0f61a05b | 39 | * \brief HAVEGE state structure |
HannesTschofenig | 0:796d0f61a05b | 40 | */ |
HannesTschofenig | 0:796d0f61a05b | 41 | typedef struct |
HannesTschofenig | 0:796d0f61a05b | 42 | { |
HannesTschofenig | 0:796d0f61a05b | 43 | int PT1, PT2, offset[2]; |
HannesTschofenig | 0:796d0f61a05b | 44 | int pool[COLLECT_SIZE]; |
HannesTschofenig | 0:796d0f61a05b | 45 | int WALK[8192]; |
HannesTschofenig | 0:796d0f61a05b | 46 | } |
HannesTschofenig | 0:796d0f61a05b | 47 | havege_state; |
HannesTschofenig | 0:796d0f61a05b | 48 | |
HannesTschofenig | 0:796d0f61a05b | 49 | /** |
HannesTschofenig | 0:796d0f61a05b | 50 | * \brief HAVEGE initialization |
HannesTschofenig | 0:796d0f61a05b | 51 | * |
HannesTschofenig | 0:796d0f61a05b | 52 | * \param hs HAVEGE state to be initialized |
HannesTschofenig | 0:796d0f61a05b | 53 | */ |
HannesTschofenig | 0:796d0f61a05b | 54 | void havege_init( havege_state *hs ); |
HannesTschofenig | 0:796d0f61a05b | 55 | |
HannesTschofenig | 0:796d0f61a05b | 56 | /** |
HannesTschofenig | 0:796d0f61a05b | 57 | * \brief HAVEGE rand function |
HannesTschofenig | 0:796d0f61a05b | 58 | * |
HannesTschofenig | 0:796d0f61a05b | 59 | * \param p_rng A HAVEGE state |
HannesTschofenig | 0:796d0f61a05b | 60 | * \param output Buffer to fill |
HannesTschofenig | 0:796d0f61a05b | 61 | * \param len Length of buffer |
HannesTschofenig | 0:796d0f61a05b | 62 | * |
HannesTschofenig | 0:796d0f61a05b | 63 | * \return 0 |
HannesTschofenig | 0:796d0f61a05b | 64 | */ |
HannesTschofenig | 0:796d0f61a05b | 65 | int havege_random( void *p_rng, unsigned char *output, size_t len ); |
HannesTschofenig | 0:796d0f61a05b | 66 | |
HannesTschofenig | 0:796d0f61a05b | 67 | #ifdef __cplusplus |
HannesTschofenig | 0:796d0f61a05b | 68 | } |
HannesTschofenig | 0:796d0f61a05b | 69 | #endif |
HannesTschofenig | 0:796d0f61a05b | 70 | |
HannesTschofenig | 0:796d0f61a05b | 71 | #endif /* havege.h */ |
HannesTschofenig | 0:796d0f61a05b | 72 | |
HannesTschofenig | 0:796d0f61a05b | 73 |