"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/random.c" between
cryptsetup-2.3.6.tar.xz and cryptsetup-2.4.0.tar.xz

About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.

random.c  (cryptsetup-2.3.6.tar.xz):random.c  (cryptsetup-2.4.0.tar.xz)
skipping to change at line 156 skipping to change at line 156
/* Initialisation of both RNG file descriptors is mandatory */ /* Initialisation of both RNG file descriptors is mandatory */
int crypt_random_init(struct crypt_device *ctx) int crypt_random_init(struct crypt_device *ctx)
{ {
if (random_initialised) if (random_initialised)
return 0; return 0;
/* Used for CRYPT_RND_NORMAL */ /* Used for CRYPT_RND_NORMAL */
if(urandom_fd == -1) if(urandom_fd == -1)
urandom_fd = open(URANDOM_DEVICE, O_RDONLY | O_CLOEXEC); urandom_fd = open(URANDOM_DEVICE, O_RDONLY | O_CLOEXEC);
if(urandom_fd == -1) if(urandom_fd == -1)
goto fail; goto err;
/* Used for CRYPT_RND_KEY */ /* Used for CRYPT_RND_KEY */
if(random_fd == -1) if(random_fd == -1)
random_fd = open(RANDOM_DEVICE, O_RDONLY | O_NONBLOCK | O_CLOEXEC ); random_fd = open(RANDOM_DEVICE, O_RDONLY | O_NONBLOCK | O_CLOEXEC );
if(random_fd == -1) if(random_fd == -1)
goto fail; goto err;
if (crypt_fips_mode()) if (crypt_fips_mode())
log_verbose(ctx, _("Running in FIPS mode.")); log_verbose(ctx, _("Running in FIPS mode."));
random_initialised = 1; random_initialised = 1;
return 0; return 0;
fail: err:
crypt_random_exit(); crypt_random_exit();
log_err(ctx, _("Fatal error during RNG initialisation.")); log_err(ctx, _("Fatal error during RNG initialisation."));
return -ENOSYS; return -ENOSYS;
} }
int crypt_random_get(struct crypt_device *ctx, char *buf, size_t len, int qualit y) int crypt_random_get(struct crypt_device *ctx, char *buf, size_t len, int qualit y)
{ {
int status, rng_type; int status, rng_type;
switch(quality) { switch(quality) {
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)