rbg.c revision a734c64bff58bda2fa48c2795453e092167b0ff7
/*
* Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
*
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file
*
* RBG mechanism
*
* This mechanism is designed to comply with ANS X9.82 Part 4 (April
* 2011 Draft) Section 10. This standard is unfortunately not freely
* available.
*
* The chosen RBG design is that of a DRBG with a live entropy source
* with no conditioning function. Only a single security strength is
* supported. No seedfile is used since there may be no non-volatile
* storage available. The system UUID is used as the personalisation
* string.
*/
#include <stdint.h>
#include <string.h>
#include <ipxe/settings.h>
/** The RBG */
struct random_bit_generator rbg;
/**
* Start up RBG
*
* @ret rc Return status code
*
* This is the RBG_Startup function defined in ANS X9.82 Part 4 (April
* 2011 Draft) Section 9.1.2.2.
*/
static int rbg_startup ( void ) {
int len;
int rc;
/* Try to obtain system UUID for use as personalisation
* string, in accordance with ANS X9.82 Part 3-2007 Section
* 8.5.2. If no UUID is available, proceed without a
* personalisation string.
*/
len = 0;
}
/* Instantiate DRBG */
return rc;
}
return 0;
}
/**
* Shut down RBG
*
*/
static void rbg_shutdown ( void ) {
/* Uninstantiate DRBG */
}
/** RBG startup function */
static void rbg_startup_fn ( void ) {
/* Start up RBG. There is no way to report an error at this
* stage, but a failed startup will result in an invalid DRBG
* that refuses to generate bits.
*/
rbg_startup();
}
/** RBG shutdown function */
/* Shut down RBG */
rbg_shutdown();
}
/** RBG startup table entry */
};