Index: uvm_swap_encrypt.c =================================================================== RCS file: /cvs/src/sys/uvm/uvm_swap_encrypt.c,v retrieving revision 1.21 diff -u -p -r1.21 uvm_swap_encrypt.c --- uvm_swap_encrypt.c 4 May 2015 10:21:15 -0000 1.21 +++ uvm_swap_encrypt.c 4 May 2015 23:27:51 -0000 @@ -88,6 +88,13 @@ swap_encrypt_ctl(int *name, u_int namele } void +swap_key_create(struct swap_key *key) +{ + arc4random_buf(key->key, sizeof(key->key)); + uvm_swpkeyscreated++; +} + +void swap_key_delete(struct swap_key *key) { /* Make sure that this key gets removed if we just used it */ Index: uvm_swap_encrypt.h =================================================================== RCS file: /cvs/src/sys/uvm/uvm_swap_encrypt.h,v retrieving revision 1.9 diff -u -p -r1.9 uvm_swap_encrypt.h --- uvm_swap_encrypt.h 23 Mar 2009 22:10:04 -0000 1.9 +++ uvm_swap_encrypt.h 4 May 2015 23:27:51 -0000 @@ -61,13 +61,9 @@ void swap_decrypt(struct swap_key *,cadd void swap_key_cleanup(struct swap_key *); void swap_key_prepare(struct swap_key *, int); -extern u_int uvm_swpkeyscreated; - #define SWAP_KEY_GET(s,x) do { \ if ((x)->refcount == 0) { \ - arc4random_buf((x)->key,\ - sizeof((x)->key)); \ - uvm_swpkeyscreated++; \ + swap_key_create(x); \ } \ (x)->refcount++; \ } while(0); @@ -79,6 +75,7 @@ extern u_int uvm_swpkeyscreated; } \ } while(0); +void swap_key_create(struct swap_key *); void swap_key_delete(struct swap_key *); extern int uvm_doswapencrypt; /* swapencrypt enabled/disabled */