Return to fips_prf.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libstrongswan / plugins / fips_prf |
1.1 misho 1: /* 2: * Copyright (C) 2006-2008 Martin Willi 3: * HSR Hochschule fuer Technik Rapperswil 4: * 5: * This program is free software; you can redistribute it and/or modify it 6: * under the terms of the GNU General Public License as published by the 7: * Free Software Foundation; either version 2 of the License, or (at your 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. 9: * 10: * This program is distributed in the hope that it will be useful, but 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13: * for more details. 14: */ 15: 16: /** 17: * @defgroup fips_prf fips_prf 18: * @{ @ingroup fips_prf_p 19: */ 20: 21: #ifndef FIPS_PRF_H_ 22: #define FIPS_PRF_H_ 23: 24: typedef struct fips_prf_t fips_prf_t; 25: 26: #include <library.h> 27: #include <crypto/prfs/prf.h> 28: #include <crypto/hashers/hasher.h> 29: 30: /** 31: * Implementation of prf_t using the FIPS 186-2-change1 standard. 32: * 33: * FIPS defines a "General Purpose Random Number Generator" (Revised 34: * Algorithm for Computing m values of x (Appendix 3.1 of FIPS 186-2)). This 35: * implementation is not intended for private key generation and therefore does 36: * not include the "mod q" operation (see FIPS 186-2-change1 p74). 37: * The FIPS PRF is stateful; the key changes every time when bytes are acquired. 38: */ 39: struct fips_prf_t { 40: 41: /** 42: * Generic prf_t interface for this fips_prf_t class. 43: */ 44: prf_t prf_interface; 45: }; 46: 47: /** 48: * Creates a new fips_prf_t object. 49: * 50: * FIPS 186-2 defines G() functions used in the PRF function. It can 51: * be implemented either based on SHA1 or DES. 52: * The G() function is selected using the algo parameter. 53: * 54: * @param algo specific FIPS PRF implementation, specifies G() function 55: * @return fips_prf_t object, NULL if not supported. 56: */ 57: fips_prf_t *fips_prf_create(pseudo_random_function_t algo); 58: 59: #endif /** FIPS_PRF_H_ @}*/