Date: Wed, 19 Aug 2015 09:24:35 GMT From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289913 - in soc2013/def/crashdump-head: sbin/cryptcore sys/kern sys/sys Message-ID: <201508190924.t7J9OZF1098079@socsvn.freebsd.org>
index | next in thread | raw e-mail
Author: def Date: Wed Aug 19 09:24:34 2015 New Revision: 289913 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289913 Log: Allocate in dump_encrypted_write instead of kerneldumpcrypto. Modified: soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c soc2013/def/crashdump-head/sys/kern/kern_shutdown.c soc2013/def/crashdump-head/sys/sys/kerneldump.h Modified: soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c ============================================================================== --- soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c Wed Aug 19 06:08:11 2015 (r289912) +++ soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c Wed Aug 19 09:24:34 2015 (r289913) @@ -216,7 +216,7 @@ cryptcore_decrypt(const char *privkeyfile, const char *keyfile, const char *input, const char *output) { - uint8_t buf[KERNELDUMP_BUFFER_SIZE], key[KERNELDUMP_KEY_SIZE]; + uint8_t buf[2 * KERNELDUMP_BLOCK_SIZE], key[KERNELDUMP_KEY_SIZE]; EVP_CIPHER_CTX ctx; FILE *fp; struct kerneldumpkey *kdk; Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Wed Aug 19 06:08:11 2015 (r289912) +++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Wed Aug 19 09:24:34 2015 (r289913) @@ -153,7 +153,6 @@ cipherInstance kdc_ci; off_t kdc_lastoffset; size_t kdc_lastlength; - uint8_t kdc_buf[KERNELDUMP_BUFFER_SIZE]; } dumpcrypto; static struct kerneldumpkey *dumpkey; @@ -1014,13 +1013,12 @@ dump_encrypted_write(struct dumperinfo *di, void *virtual, vm_offset_t physical, off_t offset, size_t length) { + uint8_t buf[2 * KERNELDUMP_BLOCK_SIZE]; struct kerneldumpcrypto *kdc; - struct kerneldumpkey *kdk; int error; size_t nbytes; kdc = di->kdc; - kdk = di->kdk; error = dump_check_bounds(di, offset, length); if (error != 0) @@ -1041,23 +1039,22 @@ kdc->kdc_lastlength = length; while (length > 0) { - if (length >= KERNELDUMP_BUFFER_SIZE) - nbytes = KERNELDUMP_BUFFER_SIZE; + if (length >= sizeof(buf)) + nbytes = sizeof(buf); else nbytes = length; - memcpy(kdc->kdc_buf, virtual, nbytes); + memcpy(buf, virtual, nbytes); - error = rijndael_blockEncrypt(&kdc->kdc_ci, &kdc->kdc_ki, - kdc->kdc_buf, 8 * nbytes, kdc->kdc_buf); + error = rijndael_blockEncrypt(&kdc->kdc_ci, &kdc->kdc_ki, buf, + 8 * nbytes, buf); if (error <= 0) return (EIO); error = rijndael_cipherInit(&kdc->kdc_ci, MODE_CBC, - kdc->kdc_buf + nbytes - KERNELDUMP_IV_SIZE); + buf + nbytes - KERNELDUMP_IV_SIZE); if (error <= 0) return (EIO); - error = di->dumper(di->priv, kdc->kdc_buf, physical, - offset, nbytes); + error = di->dumper(di->priv, buf, physical, offset, nbytes); if (error != 0) return (error); Modified: soc2013/def/crashdump-head/sys/sys/kerneldump.h ============================================================================== --- soc2013/def/crashdump-head/sys/sys/kerneldump.h Wed Aug 19 06:08:11 2015 (r289912) +++ soc2013/def/crashdump-head/sys/sys/kerneldump.h Wed Aug 19 09:24:34 2015 (r289913) @@ -55,7 +55,6 @@ #endif #define KERNELDUMP_BLOCK_SIZE 512 -#define KERNELDUMP_BUFFER_SIZE 1024 #define KERNELDUMP_IV_SIZE 16 #define KERNELDUMP_KEY_SIZE 32help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508190924.t7J9OZF1098079>
