aboutsummaryrefslogtreecommitdiffstats
path: root/apps/enc.c
diff options
context:
space:
mode:
authorPaul Yang <paulyang.inf@gmail.com>2017-06-13 01:24:02 +0800
committerRich Salz <rsalz@openssl.org>2017-06-12 16:11:05 -0400
commit2234212c3dde887e0b7fa08277d035cd132e2cce (patch)
treeb786145f72f8938a11d4c6fc6ff815e0ae6c43a4 /apps/enc.c
parent71d8c138cf0a72663cd401d753564eecd8c23289 (diff)
downloadopenssl-2234212c3dde887e0b7fa08277d035cd132e2cce.tar.gz
Clean up a bundle of codingstyle stuff in apps directory
Mostly braces and NULL pointer check and also copyright year bump Signed-off-by: Paul Yang <paulyang.inf@gmail.com> Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3657)
Diffstat (limited to 'apps/enc.c')
-rw-r--r--apps/enc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/enc.c b/apps/enc.c
index 157cb943b6..1ff1d6bf91 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -113,13 +113,13 @@ int enc_main(int argc, char **argv)
/* first check the program name */
prog = opt_progname(argv[0]);
- if (strcmp(prog, "base64") == 0)
+ if (strcmp(prog, "base64") == 0) {
base64 = 1;
#ifdef ZLIB
- else if (strcmp(prog, "zlib") == 0)
+ } else if (strcmp(prog, "zlib") == 0) {
do_zlib = 1;
#endif
- else {
+ } else {
cipher = EVP_get_cipherbyname(prog);
if (cipher == NULL && strcmp(prog, "enc") != 0) {
BIO_printf(bio_err, "%s is not a known cipher\n", prog);
@@ -292,12 +292,13 @@ int enc_main(int argc, char **argv)
if (infile == NULL) {
in = dup_bio_in(informat);
- } else
+ } else {
in = bio_open_default(infile, 'r', informat);
+ }
if (in == NULL)
goto end;
- if (!str && passarg) {
+ if (str == NULL && passarg != NULL) {
if (!app_passwd(passarg, NULL, &pass, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
goto end;
@@ -393,17 +394,18 @@ int enc_main(int argc, char **argv)
unsigned char *sptr;
size_t str_len = strlen(str);
- if (nosalt)
+ if (nosalt) {
sptr = NULL;
- else {
+ } else {
if (enc) {
if (hsalt) {
if (!set_hex(hsalt, salt, sizeof salt)) {
BIO_printf(bio_err, "invalid hex salt value\n");
goto end;
}
- } else if (RAND_bytes(salt, sizeof salt) <= 0)
+ } else if (RAND_bytes(salt, sizeof salt) <= 0) {
goto end;
+ }
/*
* If -P option then don't bother writing
*/