Date: Sat, 18 Jul 2015 13:09:57 GMT From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r288528 - soc2013/def/crashdump-head/sbin/cryptcore Message-ID: <201507181309.t6ID9vSJ028502@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: def Date: Sat Jul 18 13:09:57 2015 New Revision: 288528 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=288528 Log: Change data types of bytes and size variables to ssize_t. Modified: soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c Modified: soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c ============================================================================== --- soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c Sat Jul 18 12:25:47 2015 (r288527) +++ soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c Sat Jul 18 13:09:57 2015 (r288528) @@ -97,8 +97,9 @@ FILE *fp; struct kerneldumpkey *kdk; RSA *privkey; - int err, fd, ofd, privkeysize, size; - size_t bufused, bytes; + int err, fd, ofd, olen, privkeysize; + ssize_t bytes, size; + size_t bufused; PJDLOG_ASSERT(privkeyfile != NULL); PJDLOG_ASSERT(keyfile != NULL); @@ -120,8 +121,8 @@ fd = open(keyfile, O_RDONLY); if (fd == -1) pjdlog_exit(1, "Unable to open %s", keyfile); - size = (int)read(fd, kdk, sizeof(struct kerneldumpkey)); - if (size == sizeof(struct kerneldumpkey)) { + size = read(fd, kdk, sizeof(struct kerneldumpkey)); + if (size == (ssize_t)sizeof(struct kerneldumpkey)) { kdk = realloc(kdk, kdk->kdk_size); size += read(fd, &kdk->kdk_encryptedkey, kdk->kdk_size - sizeof(struct kerneldumpkey)); @@ -129,7 +130,7 @@ err = errno; close(fd); fd = -1; - if (size != (int)kdk->kdk_size) { + if (size != (ssize_t)kdk->kdk_size) { errno = err; pjdlog_exit(1, "Unable to read data from %s", keyfile); } @@ -178,14 +179,14 @@ if (bufused != sizeof(buf)) continue; - if (EVP_DecryptUpdate(&ctx, buf, &size, buf, + if (EVP_DecryptUpdate(&ctx, buf, &olen, buf, sizeof(buf)) == 0) { pjdlog_error("Unable to decrypt core."); goto failed; } - PJDLOG_ASSERT(size == sizeof(buf)); + PJDLOG_ASSERT(olen == (int)sizeof(buf)); - if (write(ofd, buf, sizeof(buf)) != sizeof(buf)) { + if (write(ofd, buf, sizeof(buf)) != (ssize_t)sizeof(buf)) { pjdlog_errno(LOG_ERR, "Unable to write data to %s", output); goto failed;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507181309.t6ID9vSJ028502>