-/* $OpenBSD: uvm_swap_encrypt.c,v 1.21 2015/05/04 10:21:15 dlg Exp $ */
+/* $OpenBSD: uvm_swap_encrypt.c,v 1.22 2015/05/06 04:00:10 dlg Exp $ */
/*
* Copyright 1999 Niels Provos <provos@citi.umich.edu>
/* NOTREACHED */
}
+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)
{
-/* $OpenBSD: uvm_swap_encrypt.h,v 1.9 2009/03/23 22:10:04 oga Exp $ */
+/* $OpenBSD: uvm_swap_encrypt.h,v 1.10 2015/05/06 04:00:10 dlg Exp $ */
/*
* Copyright 1999 Niels Provos <provos@citi.umich.edu>
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);
} \
} while(0);
+void swap_key_create(struct swap_key *);
void swap_key_delete(struct swap_key *);
extern int uvm_doswapencrypt; /* swapencrypt enabled/disabled */