-/* $OpenBSD: enc.c,v 1.29 2023/06/11 11:54:44 tb Exp $ */
+/* $OpenBSD: enc.c,v 1.30 2023/06/11 12:06:08 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
fclose(infile);
i = strlen(buf);
- if ((i > 0) && ((buf[i - 1] == '\n') || (buf[i - 1] == '\r')))
+ if (i > 0 && (buf[i - 1] == '\n' || buf[i - 1] == '\r'))
buf[--i] = '\0';
- if ((i > 0) && ((buf[i - 1] == '\n') || (buf[i - 1] == '\r')))
+ if (i > 0 && (buf[i - 1] == '\n' || buf[i - 1] == '\r'))
buf[--i] = '\0';
if (i < 1) {
BIO_printf(bio_err, "zero length password\n");
cfg.md);
goto end;
}
- if (dgst == NULL) {
+ if (dgst == NULL)
dgst = EVP_sha256();
- }
if (cfg.bufsize != NULL) {
char *p = cfg.bufsize;
}
strbuf = malloc(SIZE);
buff = malloc(EVP_ENCODE_LENGTH(bsize));
- if ((buff == NULL) || (strbuf == NULL)) {
+ if (buff == NULL || strbuf == NULL) {
BIO_printf(bio_err, "malloc failure %ld\n", (long) EVP_ENCODE_LENGTH(bsize));
goto end;
}
in = BIO_new(BIO_s_file());
out = BIO_new(BIO_s_file());
- if ((in == NULL) || (out == NULL)) {
+ if (in == NULL || out == NULL) {
ERR_print_errors(bio_err);
goto end;
}
}
if (!cfg.keystr && cfg.passarg) {
- if (!app_passwd(bio_err, cfg.passarg, NULL,
- &pass, NULL)) {
+ if (!app_passwd(bio_err, cfg.passarg, NULL, &pass, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
goto end;
}
cfg.keystr = pass;
}
- if (cfg.keystr == NULL && cfg.cipher != NULL &&
- cfg.hkey == NULL) {
+ if (cfg.keystr == NULL && cfg.cipher != NULL && cfg.hkey == NULL) {
for (;;) {
char buf[200];
int retval;
explicit_bzero(cfg.keystr,
strlen(cfg.keystr));
}
- if (cfg.hiv != NULL &&
- !set_hex(cfg.hiv, iv, sizeof iv)) {
+ if (cfg.hiv != NULL && !set_hex(cfg.hiv, iv, sizeof iv)) {
BIO_printf(bio_err, "invalid hex iv value\n");
goto end;
}
BIO_printf(bio_err, "iv undefined\n");
goto end;
}
- if (cfg.hkey != NULL &&
- !set_hex(cfg.hkey, key, sizeof key)) {
+ if (cfg.hkey != NULL && !set_hex(cfg.hkey, key, sizeof key)) {
BIO_printf(bio_err, "invalid hex key value\n");
goto end;
}
if (cfg.nopad)
EVP_CIPHER_CTX_set_padding(ctx, 0);
- if (!EVP_CipherInit_ex(ctx, NULL, NULL, key, iv,
- cfg.enc)) {
+ if (!EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, cfg.enc)) {
BIO_printf(bio_err, "Error setting cipher %s\n",
EVP_CIPHER_name(cfg.cipher));
ERR_print_errors(bio_err);
*(in++) = '\0';
if (j == 0)
break;
- if ((j >= '0') && (j <= '9'))
+ if (j >= '0' && j <= '9')
j -= '0';
- else if ((j >= 'A') && (j <= 'F'))
+ else if (j >= 'A' && j <= 'F')
j = j - 'A' + 10;
- else if ((j >= 'a') && (j <= 'f'))
+ else if (j >= 'a' && j <= 'f')
j = j - 'a' + 10;
else {
BIO_printf(bio_err, "non-hex digit\n");