#include #include #include #include #include #include "rnd.h" #include "die.h" #include "str.h" #include "crypto.h" #include "ioops.h" #include "config.h" #include "keypair.h" void generate_keypair(void) { struct passwd *pw = getpwuid(getuid()); unsigned char publickey[crypto_box_pub_key_size]; unsigned char secretkey[crypto_box_sec_key_size]; char file[128]; xmemset(publickey, 0, sizeof(publickey)); xmemset(secretkey, 0, sizeof(secretkey)); curve25519_selftest(); printf("Reading from %s (this may take a while) ...\n", HIG_ENTROPY_SOURCE); gen_key_bytes(secretkey, sizeof(secretkey)); crypto_scalarmult_curve25519_base(publickey, secretkey); slprintf(file, sizeof(file), "%s/%s", pw->pw_dir, FILE_PUBKEY); write_blob_or_die(file, publickey, sizeof(publickey)); printf("Public key written to %s!\n", file); slprintf(file, sizeof(file), "%s/%s", pw->pw_dir, FILE_PRIVKEY); write_blob_or_die(file, secretkey, sizeof(secretkey)); printf("Secret key written to %s!\n", file); xmemset(publickey, 0, sizeof(publickey)); xmemset(secretkey, 0, sizeof(secretkey)); } void verify_keypair(void) { int result; struct passwd *pw = getpwuid(getuid()); unsigned char publickey[crypto_box_pub_key_size]; unsigned char publicres[crypto_box_pub_key_size]; unsigned char secretkey[crypto_box_sec_key_size]; char file[128]; curve25519_selftest(); xmemset(publickey, 0, sizeof(publickey)); xmemset(publicres, 0, sizeof(publicres)); xmemset(secretkey, 0, sizeof(secretkey)); slprintf(file, sizeof(file), "%s/%s", pw->pw_dir, FILE_PUBKEY); read_blob_or_die(file, publickey, sizeof(publickey)); slprintf(file, sizeof(file), "%s/%s", pw->pw_dir, FILE_PRIVKEY); read_blob_or_die(file, secretkey, sizeof(secretkey)); crypto_scalarmult_curve25519_base(publicres, secretkey); result = crypto_verify_32(publicres, publickey); xmemset(publickey, 0, sizeof(publickey)); xmemset(publicres, 0, sizeof(publicres)); xmemset(secretkey, 0, sizeof(secretkey)); if (result) panic("Keypair is corrupt! You need to regenerate!\n"); } s-private-remove&id=d7847a7017b2a2759dd5590c0cffdbdf2994918e'>commitdiff
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-04-01 09:00:35 +0200
committerIngo Molnar <mingo@kernel.org>2016-04-01 09:03:27 +0200
commitd7847a7017b2a2759dd5590c0cffdbdf2994918e (patch)
tree81f714f8f40df7c16e7ef4da889275c3c8d2a6e7 /Documentation/i2c
parent16bf92261b1b6cb1a1c0671b445a2fcb5a1ecc96 (diff)
x86/cpufeature: Fix build bug caused by merge artifact with the removal of cpu_has_hypervisor
The 0-day build robot by Fengguang Wu reported a build failure: arch/x86/events//intel/cstate.c: In function 'cstate_pmu_init': arch/x86/events//intel/cstate.c:680:6: error: 'cpu_has_hypervisor' undeclared (first use in this function) ... which was caused by a merge mistake I made when applying the following patch: 0c9f3536cc71 ("x86/cpufeature: Remove cpu_has_hypervisor") apply the missing hunk as well. Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: David Kershner <david.kershner@unisys.com> Cc: Borislav Petkov <bp@suse.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: sparmaintainer@unisys.com Cc: virtualization@lists.linux-foundation.org Link: http://lkml.kernel.org/r/1459266123-21878-3-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'Documentation/i2c')