FB_security 板


On Sun, Sep 16, 2012 at 05:21:21PM +0100, Mark Murray wrote: > Tweeks along the way may include reverting to the original intent of > starting the PRNG blocked, and only unblocking once reseeded. I hope I'm testing this incorrectly, but I think we've managed to break this over the years. 1. Putting: entropy_file="NO" entropy_dir="NO" entropy_save_sz="0" # Size of the entropy cache files. entropy_save_num="0" # Number of entropy cache files to save. harvest_interrupt="NO" # Entropy device harvests interrupt randomness harvest_ethernet="NO" # Entropy device harvests ethernet randomness harvest_p_to_p="NO" # Entropy device harvests point-to-point randomness in /etc/rc.conf 2. Commenting out "better_than_nothing": Index: initrandom =================================================================== --- initrandom (revision 240709) +++ initrandom (working copy) @@ -77,7 +77,7 @@ initrandom_start() ;; esac - better_than_nothing + #better_than_nothing echo -n ' kickstart' fi 3. Boot single user and delete ${entropy_file} and ${entropy_dir}/* 4. Adding this patch (which I'd like to commit (but not changing the defaults)): ----------%<----------%<----------%<----------%<----------%<---------- Index: sys/dev/random/randomdev_soft.c =================================================================== --- sys/dev/random/randomdev_soft.c (revision 240694) +++ sys/dev/random/randomdev_soft.c (working copy) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/poll.h> #include <sys/proc.h> #include <sys/random.h> +#include <sys/sbuf.h> #include <sys/selinfo.h> #include <sys/sysctl.h> #include <sys/uio.h> @@ -72,7 +73,7 @@ struct random_systat random_yarrow = { .write = random_yarrow_write, .poll = random_yarrow_poll, .reseed = random_yarrow_flush_reseed, - .seeded = 1, + .seeded = 0, }; MALLOC_DEFINE(M_ENTROPY, "entropy", "Entropy harvesting buffers"); @@ -85,7 +86,7 @@ struct mtx harvest_mtx; /* Lockable FIFO queue holding entropy buffers */ struct entropyfifo { - int count; + unsigned int count; STAILQ_HEAD(harvestlist, harvest) head; }; @@ -97,6 +98,9 @@ static struct entropyfifo emptyfifo; /* Harvested entropy */ static struct entropyfifo harvestfifo[ENTROPYSOURCE]; +/* Count processed categories of randomness. */ +static unsigned long e_src_cnt[ENTROPYSOURCE]; + /* <0 to end the kthread, 0 to let it run, 1 to flush the harvest queues */ static int random_kthread_control = 0; @@ -114,6 +118,34 @@ random_check_boolean(SYSCTL_HANDLER_ARGS return sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); } +static int +sysctl_random_sys_entropy_processed(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sb; + int error; + + sbuf_new(&sb, NULL, 256, SBUF_AUTOEXTEND); + sbuf_printf(&sb, +"write=%lu/%u, keyboard=%lu/%u, mouse=%lu/%u, net=%lu/%u, interrupt=%lu/%u, pure=%lu/%u", + e_src_cnt[RANDOM_WRITE], + harvestfifo[RANDOM_WRITE].count, + e_src_cnt[RANDOM_KEYBOARD], + harvestfifo[RANDOM_KEYBOARD].count, + e_src_cnt[RANDOM_MOUSE], + harvestfifo[RANDOM_MOUSE].count, + e_src_cnt[RANDOM_NET], + harvestfifo[RANDOM_NET].count, + e_src_cnt[RANDOM_INTERRUPT], + harvestfifo[RANDOM_INTERRUPT].count, + e_src_cnt[RANDOM_PURE], + harvestfifo[RANDOM_PURE].count); + sbuf_trim(&sb); + sbuf_finish(&sb); + error = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); + sbuf_delete(&sb); + return (error); +} + /* ARGSUSED */ void random_yarrow_init(void) @@ -138,7 +170,7 @@ random_yarrow_init(void) SYSCTL_ADD_PROC(&random_clist, SYSCTL_CHILDREN(random_sys_o), OID_AUTO, "seeded", CTLTYPE_INT | CTLFLAG_RW, - &random_systat.seeded, 1, random_check_boolean, "I", + &random_systat.seeded, 0, random_check_boolean, "I", "Seeded State"); random_sys_harvest_o = SYSCTL_ADD_NODE(&random_clist, @@ -166,6 +198,10 @@ random_yarrow_init(void) OID_AUTO, "swi", CTLTYPE_INT | CTLFLAG_RW, &harvest.swi, 0, random_check_boolean, "I", "Harvest SWI entropy"); + SYSCTL_ADD_PROC(&random_clist, SYSCTL_CHILDREN(random_sys_harvest_o), + OID_AUTO, "entropy_processed", CTLTYPE_STRING | CTLFLAG_RD, + NULL, 0, sysctl_random_sys_entropy_processed, "A", + "Number of harvested/queued entropy sources"); /* Initialise the harvest fifos */ STAILQ_INIT(&emptyfifo.head); @@ -263,8 +299,10 @@ random_kthread(void *arg __unused) */ if (!STAILQ_EMPTY(&local_queue)) { mtx_unlock_spin(&harvest_mtx); - STAILQ_FOREACH(event, &local_queue, next) + STAILQ_FOREACH(event, &local_queue, next) { random_process_event(event); + e_src_cnt[event->source]++; + } mtx_lock_spin(&harvest_mtx); STAILQ_CONCAT(&emptyfifo.head, &local_queue); emptyfifo.count += local_count; Index: sys/dev/random/harvest.c =================================================================== --- sys/dev/random/harvest.c (revision 240694) +++ sys/dev/random/harvest.c (working copy) @@ -48,7 +48,12 @@ __FBSDID("$FreeBSD$"); static int read_random_phony(void *, int); /* Structure holding the desired entropy sources */ -struct harvest_select harvest = { 1, 1, 1, 0 }; +struct harvest_select harvest = { + 0, /*ethernet*/ + 0, /*pt2pt*/ + 0, /*intr*/ + 0, /*swi*/ +}; static int warned = 0; /* hold the address of the routine which is actually called if @@ -84,6 +89,12 @@ random_yarrow_deinit_harvester(void) * XXXRW: get_cyclecount() is cheap on most modern hardware, where cycle * counters are built in, but on older hardware it will do a real time clock * read which can be quite expensive. + * + * @entropy Buffer of 'count' bytes of potential entropy. + * @count Number of bytes in 'buffer' to process. + * @bits Estimated number of bits of entropy in 'buffer'. + * @frac Estimated number of fractional bits entropy in 'buffer'. + * @origin Origin where this entropy was gathered. */ void random_harvest(void *entropy, u_int count, u_int bits, u_int frac, ----------%<----------%<----------%<----------%<----------%<---------- 5. Still lets me boot multi-user and login: ngoc# sysctl kern.random kern.random.yarrow.gengateinterval: 10 kern.random.yarrow.bins: 10 kern.random.yarrow.fastthresh: 192 kern.random.yarrow.slowthresh: 256 kern.random.yarrow.slowoverthresh: 2 kern.random.sys.seeded: 0 kern.random.sys.harvest.ethernet: 0 kern.random.sys.harvest.point_to_point: 0 kern.random.sys.harvest.interrupt: 0 kern.random.sys.harvest.swi: 0 kern.random.sys.harvest.entropy_processed: write=0/0, keyboard=0/0, mouse=0/0, net=0/0, interrupt=0/0, pure=0/0 Also, I'm having trouble finding the source for 'swi' harvesting. Do you know where it is? -- -- David ([email protected]) _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-security To unsubscribe, send any mail to "[email protected]"







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草
伺服器連線錯誤,造成您的不便還請多多包涵!
「贊助商連結」






like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:iOS站內搜尋

TOP