diff options
Diffstat (limited to 'src/entropy/beos_stats')
-rw-r--r-- | src/entropy/beos_stats/es_beos.cpp | 43 | ||||
-rw-r--r-- | src/entropy/beos_stats/es_beos.h | 3 |
2 files changed, 12 insertions, 34 deletions
diff --git a/src/entropy/beos_stats/es_beos.cpp b/src/entropy/beos_stats/es_beos.cpp index b5a5e7fee..d7c0c6cd6 100644 --- a/src/entropy/beos_stats/es_beos.cpp +++ b/src/entropy/beos_stats/es_beos.cpp @@ -4,7 +4,6 @@ */ #include <botan/es_beos.h> -#include <botan/xor_buf.h> #include <kernel/OS.h> #include <kernel/image.h> @@ -13,69 +12,49 @@ namespace Botan { /** -* BeOS Fast Poll +* BeOS entropy poll */ -u32bit BeOS_EntropySource::fast_poll(byte buf[], u32bit length) +void BeOS_EntropySource::poll(Entropy_Accumulator& accum) { - if(length == 0) - return 0; - length = std::min<u32bit>(length, 32); - - u32bit buf_i = 0; - system_info info_sys; get_system_info(&info_sys); - buf_i = xor_into_buf(buf, buf_i, length, info_sys); + accum.add(info_sys, 2); - key_info info_key; + key_info info_key; // current state of the keyboard get_key_info(&info_key); - buf_i = xor_into_buf(buf, buf_i, length, key_info); + accum.add(info_key, 0); - buf_i = xor_into_buf(buf, buf_i, length, idle_time()); + accum.add(idle_time(), 0); - return length; - } - -/** -* BeOS slow poll -*/ -u32bit BeOS_EntropySource::slow_poll(byte buf[], u32bit length) - { - if(length == 0) - return 0; - - u32bit buf_i = 0; team_info info_team; int32 cookie_team = 0; while(get_next_team_info(&cookie_team, &info_team) == B_OK) { - buf_i = xor_into_buf(buf, buf_i, length, info_team); + accum.add(info_team, 2); team_id id = info_team.team; int32 cookie = 0; thread_info info_thr; while(get_next_thread_info(id, &cookie, &info_thr) == B_OK) - buf_i = xor_into_buf(buf, buf_i, length, info_thr); + accum.add(info_thr, 1); cookie = 0; image_info info_img; while(get_next_image_info(id, &cookie, &info_img) == B_OK) - buf_i = xor_into_buf(buf, buf_i, length, info_img); + accum.add(info_img, 1); cookie = 0; sem_info info_sem; while(get_next_sem_info(id, &cookie, &info_sem) == B_OK) - buf_i = xor_into_buf(buf, buf_i, length, info_sem); + accum.add(info_sem, 1); cookie = 0; area_info info_area; while(get_next_area_info(id, &cookie, &info_area) == B_OK) - buf_i = xor_into_buf(buf, buf_i, length, info_area); + accum.add(info_area, 2); } - - return length; } } diff --git a/src/entropy/beos_stats/es_beos.h b/src/entropy/beos_stats/es_beos.h index 686ac5c38..0ae670e94 100644 --- a/src/entropy/beos_stats/es_beos.h +++ b/src/entropy/beos_stats/es_beos.h @@ -18,8 +18,7 @@ class BOTAN_DLL BeOS_EntropySource : public EntropySource private: std::string name() const { return "BeOS Statistics"; } - u32bit fast_poll(byte buf[], u32bit length); - u32bit slow_poll(byte buf[], u32bit length); + void poll(Entropy_Accumulator& accum); }; } |