Code style: space after 'if'
Reviewed-by: Matt Caswell <gitlab@openssl.org>
This commit is contained in:
parent
e963109fcd
commit
c70908d247
@ -572,7 +572,7 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
|
||||
char *prompt = NULL;
|
||||
|
||||
prompt = UI_construct_prompt(ui, "pass phrase", prompt_info);
|
||||
if(!prompt) {
|
||||
if (!prompt) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
UI_free(ui);
|
||||
return 0;
|
||||
@ -586,7 +586,7 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
|
||||
PW_MIN_LENGTH, bufsiz - 1);
|
||||
if (ok >= 0 && verify) {
|
||||
buff = (char *)OPENSSL_malloc(bufsiz);
|
||||
if(!buff) {
|
||||
if (!buff) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
UI_free(ui);
|
||||
OPENSSL_free(prompt);
|
||||
|
10
apps/ca.c
10
apps/ca.c
@ -558,7 +558,7 @@ int MAIN(int argc, char **argv)
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
len = strlen(s) + sizeof(CONFIG_FILE);
|
||||
tofree = OPENSSL_malloc(len);
|
||||
if(!tofree) {
|
||||
if (!tofree) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto err;
|
||||
}
|
||||
@ -566,7 +566,7 @@ int MAIN(int argc, char **argv)
|
||||
#else
|
||||
len = strlen(s) + sizeof(CONFIG_FILE) + 1;
|
||||
tofree = OPENSSL_malloc(len);
|
||||
if(!tofree) {
|
||||
if (!tofree) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto err;
|
||||
}
|
||||
@ -2803,7 +2803,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
||||
ASN1_GENERALIZEDTIME *comp_time = NULL;
|
||||
tmp = BUF_strdup(str);
|
||||
|
||||
if(!tmp) {
|
||||
if (!tmp) {
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
@ -2825,7 +2825,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
||||
|
||||
if (prevtm) {
|
||||
*prevtm = ASN1_UTCTIME_new();
|
||||
if(!*prevtm) {
|
||||
if (!*prevtm) {
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
@ -2869,7 +2869,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
||||
goto err;
|
||||
}
|
||||
comp_time = ASN1_GENERALIZEDTIME_new();
|
||||
if(!comp_time) {
|
||||
if (!comp_time) {
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ static char *MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
|
||||
PW_CB_DATA cb_tmp;
|
||||
int l;
|
||||
|
||||
if(!pass) {
|
||||
if (!pass) {
|
||||
BIO_printf(bio_err, "Malloc failure\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ static int ebcdic_write(BIO *b, const char *in, int inl)
|
||||
num = inl;
|
||||
wbuf =
|
||||
(EBCDIC_OUTBUFF *) OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num);
|
||||
if(!wbuf)
|
||||
if (!wbuf)
|
||||
return 0;
|
||||
OPENSSL_free(b->ptr);
|
||||
|
||||
@ -2916,7 +2916,7 @@ static int generate_session_id(const SSL *ssl, unsigned char *id,
|
||||
{
|
||||
unsigned int count = 0;
|
||||
do {
|
||||
if(RAND_pseudo_bytes(id, *id_len) < 0)
|
||||
if (RAND_pseudo_bytes(id, *id_len) < 0)
|
||||
return 0;
|
||||
/*
|
||||
* Prefix the session_id with the required prefix. NB: If our prefix
|
||||
|
@ -302,7 +302,7 @@ static int parseArgs(int argc, char **argv)
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
maxTime = atoi(*(++argv));
|
||||
if(maxTime <= 0) {
|
||||
if (maxTime <= 0) {
|
||||
BIO_printf(bio_err, "time must be > 0\n");
|
||||
badop = 1;
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ int MAIN(int argc, char **argv)
|
||||
# ifdef OPENSSL_SYS_VMS
|
||||
len = strlen(s) + sizeof(CONFIG_FILE);
|
||||
tofree = OPENSSL_malloc(len);
|
||||
if(!tofree) {
|
||||
if (!tofree) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto err;
|
||||
}
|
||||
@ -443,7 +443,7 @@ int MAIN(int argc, char **argv)
|
||||
# else
|
||||
len = strlen(s) + sizeof(CONFIG_FILE) + 1;
|
||||
tofree = OPENSSL_malloc(len);
|
||||
if(!tofree) {
|
||||
if (!tofree) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto err;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
|
||||
if ((flags & SMIME_DETACHED) && data) {
|
||||
/* We want multipart/signed */
|
||||
/* Generate a random boundary */
|
||||
if(RAND_pseudo_bytes((unsigned char *)bound, 32) < 0)
|
||||
if (RAND_pseudo_bytes((unsigned char *)bound, 32) < 0)
|
||||
return 0;
|
||||
for (i = 0; i < 32; i++) {
|
||||
c = bound[i] & 0xf;
|
||||
|
@ -162,7 +162,7 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
|
||||
p = OPENSSL_malloc(derlen);
|
||||
if(!p)
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
ndef_aux->derbuf = p;
|
||||
@ -232,7 +232,7 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
|
||||
p = OPENSSL_malloc(derlen);
|
||||
if(!p)
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
ndef_aux->derbuf = p;
|
||||
|
@ -290,7 +290,7 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
|
||||
const ASN1_TEMPLATE *seqtt;
|
||||
seqtt = asn1_do_adb(fld, tt, 1);
|
||||
if(!seqtt)
|
||||
if (!seqtt)
|
||||
return 0;
|
||||
tmpfld = asn1_get_field_ptr(fld, seqtt);
|
||||
if (!asn1_template_print_ctx(out, tmpfld,
|
||||
|
@ -177,7 +177,7 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
|
||||
/* Save start position */
|
||||
q = *pp;
|
||||
|
||||
if(!a || *a == NULL) {
|
||||
if (!a || *a == NULL) {
|
||||
freeret = 1;
|
||||
}
|
||||
ret = d2i_X509(a, pp, length);
|
||||
@ -192,7 +192,7 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
|
||||
goto err;
|
||||
return ret;
|
||||
err:
|
||||
if(freeret) {
|
||||
if (freeret) {
|
||||
X509_free(ret);
|
||||
if (a)
|
||||
*a = NULL;
|
||||
|
@ -710,7 +710,7 @@ doapr_outch(char **sbuffer,
|
||||
if (*maxlen == 0)
|
||||
*maxlen = 1024;
|
||||
*buffer = OPENSSL_malloc(*maxlen);
|
||||
if(!*buffer) {
|
||||
if (!*buffer) {
|
||||
/* Panic! Can't really do anything sensible. Just return */
|
||||
return;
|
||||
}
|
||||
@ -722,7 +722,7 @@ doapr_outch(char **sbuffer,
|
||||
} else {
|
||||
*maxlen += 1024;
|
||||
*buffer = OPENSSL_realloc(*buffer, *maxlen);
|
||||
if(!*buffer) {
|
||||
if (!*buffer) {
|
||||
/* Panic! Can't really do anything sensible. Just return */
|
||||
return;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ static int nbiof_read(BIO *b, char *out, int outl)
|
||||
|
||||
BIO_clear_retry_flags(b);
|
||||
#if 1
|
||||
if(RAND_pseudo_bytes(&n, 1) < 0)
|
||||
if (RAND_pseudo_bytes(&n, 1) < 0)
|
||||
return -1;
|
||||
num = (n & 0x07);
|
||||
|
||||
@ -179,7 +179,7 @@ static int nbiof_write(BIO *b, const char *in, int inl)
|
||||
num = nt->lwn;
|
||||
nt->lwn = 0;
|
||||
} else {
|
||||
if(RAND_pseudo_bytes(&n, 1) < 0)
|
||||
if (RAND_pseudo_bytes(&n, 1) < 0)
|
||||
return -1;
|
||||
num = (n & 7);
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
|
||||
*/
|
||||
sockopt_len = (socklen_t) (sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
|
||||
authchunks = OPENSSL_malloc(sockopt_len);
|
||||
if(!authchunks) {
|
||||
if (!authchunks) {
|
||||
BIO_vfree(bio);
|
||||
return (NULL);
|
||||
}
|
||||
@ -1364,7 +1364,7 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
|
||||
if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) {
|
||||
char *tmp;
|
||||
data->saved_message.bio = b;
|
||||
if(!(tmp = OPENSSL_malloc(inl))) {
|
||||
if (!(tmp = OPENSSL_malloc(inl))) {
|
||||
BIOerr(BIO_F_DGRAM_SCTP_WRITE, ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
|
||||
unsigned char c;
|
||||
|
||||
for (i = 0; i < bytes; i++) {
|
||||
if(RAND_pseudo_bytes(&c, 1) < 0)
|
||||
if (RAND_pseudo_bytes(&c, 1) < 0)
|
||||
goto err;
|
||||
if (c >= 128 && i > 0)
|
||||
buf[i] = buf[i - 1];
|
||||
|
@ -231,7 +231,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
|
||||
return 0;
|
||||
}
|
||||
tmp = OPENSSL_malloc(inlen);
|
||||
if(!tmp)
|
||||
if (!tmp)
|
||||
return 0;
|
||||
/* setup IV by decrypting last two blocks */
|
||||
EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
|
||||
|
@ -456,7 +456,7 @@ void doencryption(void)
|
||||
len = l - rem;
|
||||
if (feof(DES_IN)) {
|
||||
for (i = 7 - rem; i > 0; i--) {
|
||||
if(RAND_pseudo_bytes(buf + l++, 1) < 0)
|
||||
if (RAND_pseudo_bytes(buf + l++, 1) < 0)
|
||||
goto problems;
|
||||
}
|
||||
buf[l++] = rem;
|
||||
|
@ -132,7 +132,7 @@ int DES_enc_write(int fd, const void *_buf, int len,
|
||||
if (len < 8) {
|
||||
cp = shortbuf;
|
||||
memcpy(shortbuf, buf, len);
|
||||
if(RAND_pseudo_bytes(shortbuf + len, 8 - len) < 0) {
|
||||
if (RAND_pseudo_bytes(shortbuf + len, 8 - len) < 0) {
|
||||
return -1;
|
||||
}
|
||||
rnum = 8;
|
||||
|
@ -135,7 +135,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
||||
dh = pkey->pkey.dh;
|
||||
|
||||
str = ASN1_STRING_new();
|
||||
if(!str) {
|
||||
if (!str) {
|
||||
DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
|
||||
goto err;
|
||||
|
||||
if (!seed_len) {
|
||||
if(RAND_pseudo_bytes(seed, qsize) < 0)
|
||||
if (RAND_pseudo_bytes(seed, qsize) < 0)
|
||||
goto err;
|
||||
seed_is_random = 1;
|
||||
} else {
|
||||
|
@ -106,23 +106,23 @@ static DSA_METHOD openssl_dsa_meth = {
|
||||
#define DSA_MOD_EXP(err_instr,dsa,rr,a1,p1,a2,p2,m,ctx,in_mont) \
|
||||
do { \
|
||||
int _tmp_res53; \
|
||||
if((dsa)->meth->dsa_mod_exp) \
|
||||
if ((dsa)->meth->dsa_mod_exp) \
|
||||
_tmp_res53 = (dsa)->meth->dsa_mod_exp((dsa), (rr), (a1), (p1), \
|
||||
(a2), (p2), (m), (ctx), (in_mont)); \
|
||||
else \
|
||||
_tmp_res53 = BN_mod_exp2_mont((rr), (a1), (p1), (a2), (p2), \
|
||||
(m), (ctx), (in_mont)); \
|
||||
if(!_tmp_res53) err_instr; \
|
||||
if (!_tmp_res53) err_instr; \
|
||||
} while(0)
|
||||
#define DSA_BN_MOD_EXP(err_instr,dsa,r,a,p,m,ctx,m_ctx) \
|
||||
do { \
|
||||
int _tmp_res53; \
|
||||
if((dsa)->meth->bn_mod_exp) \
|
||||
if ((dsa)->meth->bn_mod_exp) \
|
||||
_tmp_res53 = (dsa)->meth->bn_mod_exp((dsa), (r), (a), (p), \
|
||||
(m), (ctx), (m_ctx)); \
|
||||
else \
|
||||
_tmp_res53 = BN_mod_exp_mont((r), (a), (p), (m), (ctx), (m_ctx)); \
|
||||
if(!_tmp_res53) err_instr; \
|
||||
if (!_tmp_res53) err_instr; \
|
||||
} while(0)
|
||||
|
||||
const DSA_METHOD *DSA_OpenSSL(void)
|
||||
|
@ -285,7 +285,7 @@ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname)
|
||||
* honest. For one thing, I think I have to return a negative value for any
|
||||
* error because possible DSO_ctrl() commands may return values such as
|
||||
* "size"s that can legitimately be zero (making the standard
|
||||
* "if(DSO_cmd(...))" form that works almost everywhere else fail at odd
|
||||
* "if (DSO_cmd(...))" form that works almost everywhere else fail at odd
|
||||
* times. I'd prefer "output" values to be passed by reference and the return
|
||||
* value as success/failure like usual ... but we conform when we must... :-)
|
||||
*/
|
||||
|
@ -539,7 +539,7 @@ static char *vms_name_converter(DSO *dso, const char *filename)
|
||||
{
|
||||
int len = strlen(filename);
|
||||
char *not_translated = OPENSSL_malloc(len + 1);
|
||||
if(not_translated)
|
||||
if (not_translated)
|
||||
strcpy(not_translated, filename);
|
||||
return (not_translated);
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ static int sig_out(BIO *b)
|
||||
* FIXME: there's absolutely no guarantee this makes any sense at all,
|
||||
* particularly now EVP_MD_CTX has been restructured.
|
||||
*/
|
||||
if(RAND_pseudo_bytes(md->md_data, md->digest->md_size) < 0)
|
||||
if (RAND_pseudo_bytes(md->md_data, md->digest->md_size) < 0)
|
||||
goto berr;
|
||||
memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size);
|
||||
longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
|
||||
|
@ -91,13 +91,13 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
|
||||
if (md != NULL) {
|
||||
reset = 1;
|
||||
ctx->md = md;
|
||||
} else if(ctx->md) {
|
||||
} else if (ctx->md) {
|
||||
md = ctx->md;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!ctx->key_init && key == NULL)
|
||||
if (!ctx->key_init && key == NULL)
|
||||
return 0;
|
||||
|
||||
if (key != NULL) {
|
||||
@ -113,7 +113,7 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
|
||||
&ctx->key_length))
|
||||
goto err;
|
||||
} else {
|
||||
if(len < 0 || len > (int)sizeof(ctx->key))
|
||||
if (len < 0 || len > (int)sizeof(ctx->key))
|
||||
return 0;
|
||||
memcpy(ctx->key, key, len);
|
||||
ctx->key_length = len;
|
||||
@ -159,7 +159,7 @@ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
|
||||
if (FIPS_mode() && !ctx->i_ctx.engine)
|
||||
return FIPS_hmac_update(ctx, data, len);
|
||||
#endif
|
||||
if(!ctx->key_init)
|
||||
if (!ctx->key_init)
|
||||
return 0;
|
||||
|
||||
return EVP_DigestUpdate(&ctx->md_ctx, data, len);
|
||||
@ -174,7 +174,7 @@ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
|
||||
return FIPS_hmac_final(ctx, md, len);
|
||||
#endif
|
||||
|
||||
if(!ctx->key_init)
|
||||
if (!ctx->key_init)
|
||||
goto err;
|
||||
|
||||
if (!EVP_DigestFinal_ex(&ctx->md_ctx, buf, &i))
|
||||
@ -208,7 +208,7 @@ int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)
|
||||
if (!EVP_MD_CTX_copy(&dctx->md_ctx, &sctx->md_ctx))
|
||||
goto err;
|
||||
dctx->key_init = sctx->key_init;
|
||||
if(sctx->key_init) {
|
||||
if (sctx->key_init) {
|
||||
memcpy(dctx->key, sctx->key, HMAC_MAX_MD_CBLOCK);
|
||||
dctx->key_length = sctx->key_length;
|
||||
}
|
||||
|
@ -173,22 +173,22 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* test4 */
|
||||
HMAC_CTX_init(&ctx);
|
||||
if(HMAC_Init_ex(&ctx, NULL, 0, NULL, NULL)) {
|
||||
if (HMAC_Init_ex(&ctx, NULL, 0, NULL, NULL)) {
|
||||
printf("Should fail to initialise HMAC with empty MD and key (test 4)\n");
|
||||
err++;
|
||||
goto test5;
|
||||
}
|
||||
if(HMAC_Update(&ctx, test[4].data, test[4].data_len)) {
|
||||
if (HMAC_Update(&ctx, test[4].data, test[4].data_len)) {
|
||||
printf("Should fail HMAC_Update with ctx not set up (test 4)\n");
|
||||
err++;
|
||||
goto test5;
|
||||
}
|
||||
if(HMAC_Init_ex(&ctx, NULL, 0, EVP_sha1(), NULL)) {
|
||||
if (HMAC_Init_ex(&ctx, NULL, 0, EVP_sha1(), NULL)) {
|
||||
printf("Should fail to initialise HMAC with empty key (test 4)\n");
|
||||
err++;
|
||||
goto test5;
|
||||
}
|
||||
if(HMAC_Update(&ctx, test[4].data, test[4].data_len)) {
|
||||
if (HMAC_Update(&ctx, test[4].data, test[4].data_len)) {
|
||||
printf("Should fail HMAC_Update with ctx not set up (test 4)\n");
|
||||
err++;
|
||||
goto test5;
|
||||
@ -196,32 +196,32 @@ int main(int argc, char *argv[])
|
||||
printf("test 4 ok\n");
|
||||
test5:
|
||||
HMAC_CTX_init(&ctx);
|
||||
if(HMAC_Init_ex(&ctx, test[4].key, test[4].key_len, NULL, NULL)) {
|
||||
if (HMAC_Init_ex(&ctx, test[4].key, test[4].key_len, NULL, NULL)) {
|
||||
printf("Should fail to initialise HMAC with empty MD (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(HMAC_Update(&ctx, test[4].data, test[4].data_len)) {
|
||||
if (HMAC_Update(&ctx, test[4].data, test[4].data_len)) {
|
||||
printf("Should fail HMAC_Update with ctx not set up (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(HMAC_Init_ex(&ctx, test[4].key, -1, EVP_sha1(), NULL)) {
|
||||
if (HMAC_Init_ex(&ctx, test[4].key, -1, EVP_sha1(), NULL)) {
|
||||
printf("Should fail to initialise HMAC with invalid key len(test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Init_ex(&ctx, test[4].key, test[4].key_len, EVP_sha1(), NULL)) {
|
||||
if (!HMAC_Init_ex(&ctx, test[4].key, test[4].key_len, EVP_sha1(), NULL)) {
|
||||
printf("Failed to initialise HMAC (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Update(&ctx, test[4].data, test[4].data_len)) {
|
||||
if (!HMAC_Update(&ctx, test[4].data, test[4].data_len)) {
|
||||
printf("Error updating HMAC with data (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Final(&ctx, buf, &len)) {
|
||||
if (!HMAC_Final(&ctx, buf, &len)) {
|
||||
printf("Error finalising data (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
@ -233,17 +233,17 @@ test5:
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Init_ex(&ctx, NULL, 0, EVP_sha256(), NULL)) {
|
||||
if (!HMAC_Init_ex(&ctx, NULL, 0, EVP_sha256(), NULL)) {
|
||||
printf("Failed to reinitialise HMAC (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Update(&ctx, test[5].data, test[5].data_len)) {
|
||||
if (!HMAC_Update(&ctx, test[5].data, test[5].data_len)) {
|
||||
printf("Error updating HMAC with data (sha256) (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Final(&ctx, buf, &len)) {
|
||||
if (!HMAC_Final(&ctx, buf, &len)) {
|
||||
printf("Error finalising data (sha256) (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
@ -255,17 +255,17 @@ test5:
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Init_ex(&ctx, test[6].key, test[6].key_len, NULL, NULL)) {
|
||||
if (!HMAC_Init_ex(&ctx, test[6].key, test[6].key_len, NULL, NULL)) {
|
||||
printf("Failed to reinitialise HMAC with key (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Update(&ctx, test[6].data, test[6].data_len)) {
|
||||
if (!HMAC_Update(&ctx, test[6].data, test[6].data_len)) {
|
||||
printf("Error updating HMAC with data (new key) (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
}
|
||||
if(!HMAC_Final(&ctx, buf, &len)) {
|
||||
if (!HMAC_Final(&ctx, buf, &len)) {
|
||||
printf("Error finalising data (new key) (test 5)\n");
|
||||
err++;
|
||||
goto test6;
|
||||
@ -280,22 +280,22 @@ test5:
|
||||
}
|
||||
test6:
|
||||
HMAC_CTX_init(&ctx);
|
||||
if(!HMAC_Init_ex(&ctx, test[7].key, test[7].key_len, EVP_sha1(), NULL)) {
|
||||
if (!HMAC_Init_ex(&ctx, test[7].key, test[7].key_len, EVP_sha1(), NULL)) {
|
||||
printf("Failed to initialise HMAC (test 6)\n");
|
||||
err++;
|
||||
goto end;
|
||||
}
|
||||
if(!HMAC_Update(&ctx, test[7].data, test[7].data_len)) {
|
||||
if (!HMAC_Update(&ctx, test[7].data, test[7].data_len)) {
|
||||
printf("Error updating HMAC with data (test 6)\n");
|
||||
err++;
|
||||
goto end;
|
||||
}
|
||||
if(!HMAC_CTX_copy(&ctx2, &ctx)) {
|
||||
if (!HMAC_CTX_copy(&ctx2, &ctx)) {
|
||||
printf("Failed to copy HMAC_CTX (test 6)\n");
|
||||
err++;
|
||||
goto end;
|
||||
}
|
||||
if(!HMAC_Final(&ctx2, buf, &len)) {
|
||||
if (!HMAC_Final(&ctx2, buf, &len)) {
|
||||
printf("Error finalising data (test 6)\n");
|
||||
err++;
|
||||
goto end;
|
||||
|
@ -313,7 +313,7 @@ void OBJ_NAME_do_all_sorted(int type,
|
||||
d.names =
|
||||
OPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh) * sizeof *d.names);
|
||||
/* Really should return an error if !d.names...but its a void function! */
|
||||
if(d.names) {
|
||||
if (d.names) {
|
||||
d.n = 0;
|
||||
OBJ_NAME_do_all(type, do_all_sorted_fn, &d);
|
||||
|
||||
|
@ -361,7 +361,7 @@ static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts,
|
||||
ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
|
||||
if (val)
|
||||
memcpy(tmpval, val, len);
|
||||
else if(RAND_pseudo_bytes(tmpval, len) < 0)
|
||||
else if (RAND_pseudo_bytes(tmpval, len) < 0)
|
||||
goto err;
|
||||
if (!X509V3_add1_i2d(exts, NID_id_pkix_OCSP_Nonce,
|
||||
&os, 0, X509V3_ADD_REPLACE))
|
||||
|
@ -149,7 +149,7 @@ int RAND_poll(void)
|
||||
if (DosQuerySysState) {
|
||||
char *buffer = OPENSSL_malloc(256 * 1024);
|
||||
|
||||
if(!buffer)
|
||||
if (!buffer)
|
||||
return 0;
|
||||
|
||||
if (DosQuerySysState(0x1F, 0, 0, 0, buffer, 256 * 1024) == 0) {
|
||||
|
@ -497,7 +497,7 @@ SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
|
||||
if (!SRP_user_pwd_set_ids(user, username, NULL))
|
||||
goto err;
|
||||
|
||||
if(RAND_pseudo_bytes(digv, SHA_DIGEST_LENGTH) < 0)
|
||||
if (RAND_pseudo_bytes(digv, SHA_DIGEST_LENGTH) < 0)
|
||||
goto err;
|
||||
EVP_MD_CTX_init(&ctxt);
|
||||
EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
|
||||
@ -550,7 +550,7 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt,
|
||||
}
|
||||
|
||||
if (*salt == NULL) {
|
||||
if(RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN) < 0)
|
||||
if (RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN) < 0)
|
||||
goto err;
|
||||
|
||||
s = BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL);
|
||||
@ -611,7 +611,7 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
|
||||
srp_bn_print(g);
|
||||
|
||||
if (*salt == NULL) {
|
||||
if(RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN) < 0)
|
||||
if (RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN) < 0)
|
||||
goto err;
|
||||
|
||||
*salt = BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL);
|
||||
|
@ -117,7 +117,7 @@ void CRYPTO_thread_setup(void)
|
||||
int i;
|
||||
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE));
|
||||
if(!lock_cs) {
|
||||
if (!lock_cs) {
|
||||
/* Nothing we can do about this...void function! */
|
||||
return;
|
||||
}
|
||||
@ -172,7 +172,7 @@ void CRYPTO_thread_setup(void)
|
||||
# else
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(rwlock_t));
|
||||
# endif
|
||||
if(!lock_cs) {
|
||||
if (!lock_cs) {
|
||||
/* Nothing we can do about this...void function! */
|
||||
return;
|
||||
}
|
||||
@ -260,7 +260,7 @@ void CRYPTO_thread_setup(void)
|
||||
char filename[20];
|
||||
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
|
||||
if(!lock_cs) {
|
||||
if (!lock_cs) {
|
||||
/* Nothing we can do about this...void function! */
|
||||
return;
|
||||
}
|
||||
@ -328,11 +328,11 @@ void CRYPTO_thread_setup(void)
|
||||
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
|
||||
lock_count = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
|
||||
if(!lock_cs || !lock_count) {
|
||||
if (!lock_cs || !lock_count) {
|
||||
/* Nothing we can do about this...void function! */
|
||||
if(lock_cs)
|
||||
if (lock_cs)
|
||||
OPENSSL_free(lock_cs);
|
||||
if(lock_count)
|
||||
if (lock_count)
|
||||
OPENSSL_free(lock_count);
|
||||
return;
|
||||
}
|
||||
|
@ -230,11 +230,11 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx,
|
||||
goto merr;
|
||||
if (!sk_POLICYQUALINFO_push(pol->qualifiers, qual))
|
||||
goto merr;
|
||||
if(!(qual->pqualid = OBJ_nid2obj(NID_id_qt_cps))) {
|
||||
if (!(qual->pqualid = OBJ_nid2obj(NID_id_qt_cps))) {
|
||||
X509V3err(X509V3_F_POLICY_SECTION, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
if(!(qual->d.cpsuri = M_ASN1_IA5STRING_new()))
|
||||
if (!(qual->d.cpsuri = M_ASN1_IA5STRING_new()))
|
||||
goto merr;
|
||||
if (!ASN1_STRING_set(qual->d.cpsuri, cnf->value,
|
||||
strlen(cnf->value)))
|
||||
@ -294,7 +294,7 @@ static POLICYQUALINFO *notice_section(X509V3_CTX *ctx,
|
||||
POLICYQUALINFO *qual;
|
||||
if (!(qual = POLICYQUALINFO_new()))
|
||||
goto merr;
|
||||
if(!(qual->pqualid = OBJ_nid2obj(NID_id_qt_unotice))) {
|
||||
if (!(qual->pqualid = OBJ_nid2obj(NID_id_qt_unotice))) {
|
||||
X509V3err(X509V3_F_NOTICE_SECTION, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
@ -304,7 +304,7 @@ static POLICYQUALINFO *notice_section(X509V3_CTX *ctx,
|
||||
for (i = 0; i < sk_CONF_VALUE_num(unot); i++) {
|
||||
cnf = sk_CONF_VALUE_value(unot, i);
|
||||
if (!strcmp(cnf->name, "explicitText")) {
|
||||
if(!(not->exptext = M_ASN1_VISIBLESTRING_new()))
|
||||
if (!(not->exptext = M_ASN1_VISIBLESTRING_new()))
|
||||
goto merr;
|
||||
if (!ASN1_STRING_set(not->exptext, cnf->value,
|
||||
strlen(cnf->value)))
|
||||
|
@ -761,7 +761,7 @@ SSL_CTX *tls_create_ctx(struct tls_create_ctx_args a, void *apparg)
|
||||
if (tls_dhe1024 == NULL) {
|
||||
int i;
|
||||
|
||||
if(RAND_bytes((unsigned char *)&i, sizeof i) <= 0)
|
||||
if (RAND_bytes((unsigned char *)&i, sizeof i) <= 0)
|
||||
goto err_return;
|
||||
/*
|
||||
* make sure that i is non-negative -- pick one of the provided
|
||||
|
@ -1540,7 +1540,7 @@ int dtls1_process_heartbeat(SSL *s)
|
||||
memcpy(bp, pl, payload);
|
||||
bp += payload;
|
||||
/* Random padding */
|
||||
if(RAND_pseudo_bytes(bp, padding) < 0) {
|
||||
if (RAND_pseudo_bytes(bp, padding) < 0) {
|
||||
OPENSSL_free(buffer);
|
||||
return -1;
|
||||
}
|
||||
@ -1625,11 +1625,11 @@ int dtls1_heartbeat(SSL *s)
|
||||
/* Sequence number */
|
||||
s2n(s->tlsext_hb_seq, p);
|
||||
/* 16 random bytes */
|
||||
if(RAND_pseudo_bytes(p, 16) < 0)
|
||||
if (RAND_pseudo_bytes(p, 16) < 0)
|
||||
goto err;
|
||||
p += 16;
|
||||
/* Random padding */
|
||||
if(RAND_pseudo_bytes(p, padding) < 0)
|
||||
if (RAND_pseudo_bytes(p, padding) < 0)
|
||||
goto err;
|
||||
|
||||
ret = dtls1_write_bytes(s, TLS1_RT_HEARTBEAT, buf, 3 + payload + padding);
|
||||
|
@ -2729,7 +2729,7 @@ int ssl3_send_client_key_exchange(SSL *s)
|
||||
|
||||
EVP_PKEY_encrypt_init(pkey_ctx);
|
||||
/* Generate session key */
|
||||
if(RAND_bytes(premaster_secret, 32) <= 0) {
|
||||
if (RAND_bytes(premaster_secret, 32) <= 0) {
|
||||
EVP_PKEY_CTX_free(pkey_ctx);
|
||||
goto err;
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static int tls1_PRF(long digest_mask,
|
||||
if ((m << TLS1_PRF_DGST_SHIFT) & digest_mask)
|
||||
count++;
|
||||
}
|
||||
if(!count) {
|
||||
if (!count) {
|
||||
/* Should never happen */
|
||||
SSLerr(SSL_F_TLS1_PRF, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
|
@ -2612,7 +2612,7 @@ int tls1_process_heartbeat(SSL *s)
|
||||
memcpy(bp, pl, payload);
|
||||
bp += payload;
|
||||
/* Random padding */
|
||||
if(RAND_pseudo_bytes(bp, padding) < 0) {
|
||||
if (RAND_pseudo_bytes(bp, padding) < 0) {
|
||||
OPENSSL_free(buffer);
|
||||
return -1;
|
||||
}
|
||||
@ -2698,13 +2698,13 @@ int tls1_heartbeat(SSL *s)
|
||||
/* Sequence number */
|
||||
s2n(s->tlsext_hb_seq, p);
|
||||
/* 16 random bytes */
|
||||
if(RAND_pseudo_bytes(p, 16) < 0) {
|
||||
if (RAND_pseudo_bytes(p, 16) < 0) {
|
||||
SSLerr(SSL_F_TLS1_HEARTBEAT, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
p += 16;
|
||||
/* Random padding */
|
||||
if(RAND_pseudo_bytes(p, padding) < 0) {
|
||||
if (RAND_pseudo_bytes(p, padding) < 0) {
|
||||
SSLerr(SSL_F_TLS1_HEARTBEAT, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ int SRP_Calc_A_param(SSL *s)
|
||||
{
|
||||
unsigned char rnd[SSL_MAX_MASTER_KEY_LENGTH];
|
||||
|
||||
if(RAND_bytes(rnd, sizeof(rnd)) <= 0)
|
||||
if (RAND_bytes(rnd, sizeof(rnd)) <= 0)
|
||||
return -1;
|
||||
s->srp_ctx.a = BN_bin2bn(rnd, sizeof(rnd), s->srp_ctx.a);
|
||||
OPENSSL_cleanse(rnd, sizeof(rnd));
|
||||
|
Loading…
Reference in New Issue
Block a user