falcon randint # cat randint.c /*- {solar,pappy}(@)gentoo.org Tue Jun 19 00:39:29 */ #include #include #include #include #include static int randint_init(void) { unsigned int seed[2]; unsigned int jiffiecatcher[2]; /* let's do the time warp */ jiffiecatcher[0] = jiffies; jiffiecatcher[1] = jiffies; printk(KERN_INFO "jiffies: 0x%0*x,0x%0*x\n", sizeof(int), jiffiecatcher[0], sizeof(int), jiffiecatche r[1]); seed[0] = secure_tcp_sequence_number(0,(__force __be32)(current->pid + jiffiecatcher[0]),0,0); seed[1] = secure_tcp_sequence_number(0,(__force __be32)(current->pid + jiffiecatcher[1]),0,0); if (seed[0] == seed[1]) { printk(KERN_ALERT "Possible Security Problem: Fast repeated calls to the function secure_tcp_sequen ce_number() is not cryptographically safe: 0x%0*x=0x%0*x\n", sizeof(long), seed[0], sizeof(long), seed[1]); return 1; } else { printk(KERN_INFO "Checking randomization: Fast repeated calls to the function secure_tcp_sequence_n umber(): 0x%0*x=0x%0*x\n", sizeof(long), seed[0], sizeof(long), seed[1]); return 0; } } static void randint_exit(void) { return; } module_init(randint_init); module_exit(randint_exit); MODULE_LICENSE("GPL");