Dr. Werner Fink 2015-08-14 12:17:46 +00:00 committed by Git OBS Bridge
parent 6980a402a4
commit d9d1ffc8bd
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Aug 13 11:46:12 UTC 2015 - werner@suse.de
- Change use-rndaddentropy-ioctl-to-load-random-seed.patch to
make it work on big endian
-------------------------------------------------------------------
Tue Aug 11 09:48:26 UTC 2015 - jengelh@inai.de

View File

@ -39,12 +39,12 @@ Index: systemd-221/src/random-seed/random-seed.c
- buf = malloc(buf_size);
- if (!buf) {
+ entropy = malloc(sizeof(struct rand_pool_info) + buf_size);
+ entropy = (struct rand_pool_info*) malloc(sizeof(struct rand_pool_info) + buf_size);
+ if (!entropy) {
r = log_oom();
goto finish;
}
+ entropy->buf_size = buf_size;
+ entropy->buf_size = (typeof(entropy->buf_size)) buf_size;
r = mkdir_parents_label(RANDOM_SEED, 0755);
if (r < 0) {
@ -77,7 +77,7 @@ Index: systemd-221/src/random-seed/random-seed.c
}
- k = loop_read(seed_fd, buf, buf_size, false);
+ k = loop_read(seed_fd, entropy->buf, entropy->buf_size, false);
+ k = loop_read(seed_fd, entropy->buf, (size_t) entropy->buf_size, false);
if (k < 0)
r = log_error_errno(k, "Failed to read seed from " RANDOM_SEED ": %m");
else if (k == 0)
@ -88,7 +88,7 @@ Index: systemd-221/src/random-seed/random-seed.c
- r = loop_write(random_fd, buf, (size_t) k, false);
- if (r < 0)
- log_error_errno(r, "Failed to write seed to /dev/urandom: %m");
+ if (entropy->entropy_count && ((size_t)k) == entropy->buf_size) {
+ if (entropy->entropy_count && (size_t)k == (size_t)entropy->buf_size) {
+ r = ioctl(random_fd, RNDADDENTROPY, entropy);
+ if (r < 0) {
+ log_error_errno(errno, "Failed to write seed to /dev/urandom: %m");
@ -141,7 +141,7 @@ Index: systemd-221/src/random-seed/random-seed.c
(void) fchown(seed_fd, 0, 0);
- k = loop_read(random_fd, buf, buf_size, false);
+ k = loop_read(random_fd, entropy->buf, entropy->buf_size, false);
+ k = loop_read(random_fd, entropy->buf, (size_t) entropy->buf_size, false);
if (k < 0) {
r = log_error_errno(k, "Failed to read new seed from /dev/urandom: %m");
goto finish;