fix some code with obvious wrong coding style
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16918)
This commit is contained in:
parent
01451721af
commit
1287dabd0b
@ -503,7 +503,7 @@ static const char *newline_escape_filename(const char *file, int * backslash)
|
||||
file_cpy = app_malloc(mem_len, file);
|
||||
i = 0;
|
||||
|
||||
while(e < length) {
|
||||
while (e < length) {
|
||||
const char c = file[e];
|
||||
if (c == '\n') {
|
||||
file_cpy[i++] = '\\';
|
||||
|
@ -36,7 +36,7 @@ OSSL_LIB_CTX *app_create_libctx(void)
|
||||
*/
|
||||
if (app_libctx == NULL) {
|
||||
if (!app_provider_load(NULL, "null")) {
|
||||
opt_printf_stderr( "Failed to create null provider\n");
|
||||
opt_printf_stderr("Failed to create null provider\n");
|
||||
return NULL;
|
||||
}
|
||||
app_libctx = OSSL_LIB_CTX_new();
|
||||
|
@ -37,7 +37,7 @@ static int loadfiles(char *name)
|
||||
char *p;
|
||||
int last, ret = 1;
|
||||
|
||||
for ( ; ; ) {
|
||||
for (;;) {
|
||||
last = 0;
|
||||
for (p = name; *p != '\0' && *p != LIST_SEPARATOR_CHAR; p++)
|
||||
continue;
|
||||
|
@ -823,7 +823,7 @@ int load_crls(const char *uri, STACK_OF(X509_CRL) **crls,
|
||||
|
||||
static const char *format2string(int format)
|
||||
{
|
||||
switch(format) {
|
||||
switch (format) {
|
||||
case FORMAT_PEM:
|
||||
return "PEM";
|
||||
case FORMAT_ASN1:
|
||||
@ -1942,7 +1942,7 @@ X509_NAME *parse_name(const char *cp, int chtype, int canmulti,
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err,
|
||||
"%s: Error adding %s name attribute \"/%s=%s\"\n",
|
||||
opt_getprog(), desc, typestr ,valstr);
|
||||
opt_getprog(), desc, typestr, valstr);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@ -2845,9 +2845,9 @@ int raw_write_stdout(const void *buf, int siz)
|
||||
# include <floss.h(floss_write)>
|
||||
# endif
|
||||
# endif
|
||||
int raw_write_stdout(const void *buf,int siz)
|
||||
int raw_write_stdout(const void *buf, int siz)
|
||||
{
|
||||
return write(fileno(stdout),(void*)buf,siz);
|
||||
return write(fileno(stdout), (void*)buf, siz);
|
||||
}
|
||||
#else
|
||||
# if defined(__TANDEM)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <openssl/cmp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/cmperr.h>
|
||||
|
||||
|
||||
/* the context for the CMP mock server */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -1537,7 +1537,7 @@ void print_ca_names(BIO *bio, SSL *s)
|
||||
return;
|
||||
}
|
||||
|
||||
BIO_printf(bio, "---\nAcceptable %s certificate CA names\n",cs);
|
||||
BIO_printf(bio, "---\nAcceptable %s certificate CA names\n", cs);
|
||||
for (i = 0; i < sk_X509_NAME_num(sk); i++) {
|
||||
X509_NAME_print_ex(bio, sk_X509_NAME_value(sk, i), 0, get_nameopt());
|
||||
BIO_write(bio, "\n", 1);
|
||||
|
@ -120,7 +120,7 @@ typedef struct _SocketPairTimeoutBlock {
|
||||
} SPTB;
|
||||
|
||||
# ifdef TERM_SOCK_TEST
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -160,7 +160,7 @@ int main (int argc, char *argv[], char *envp[])
|
||||
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -275,7 +275,7 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket)
|
||||
return TERM_SOCK_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -441,7 +441,7 @@ static int CreateSocketPair (int SocketFamily,
|
||||
sin.sin_port = LocalHostPort ;
|
||||
|
||||
status = connect (SockDesc2, (struct sockaddr *) &sin, sizeof(sin));
|
||||
if (status < 0 ) {
|
||||
if (status < 0) {
|
||||
LogMessage ("CreateSocketPair: connect () - %d", errno);
|
||||
sys$cantim (&sptb, 0);
|
||||
sys$cancel (TcpAcceptChan);
|
||||
@ -485,7 +485,7 @@ static int CreateSocketPair (int SocketFamily,
|
||||
return (0) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -499,7 +499,7 @@ static void SocketPairTimeoutAst (int astparm)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -538,7 +538,7 @@ static int TerminalDeviceAst (int astparm)
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
@ -221,7 +221,7 @@ opthelp:
|
||||
for (i = 0; i < (int)len; ++i)
|
||||
BIO_printf(out, "%02X", buf[i]);
|
||||
if (outfile == NULL)
|
||||
BIO_printf(out,"\n");
|
||||
BIO_printf(out, "\n");
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
@ -1132,7 +1132,7 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
OCSP_copy_nonce(bs, req);
|
||||
|
||||
mctx = EVP_MD_CTX_new();
|
||||
if ( mctx == NULL || !EVP_DigestSignInit(mctx, &pkctx, rmd, NULL, rkey)) {
|
||||
if (mctx == NULL || !EVP_DigestSignInit(mctx, &pkctx, rmd, NULL, rkey)) {
|
||||
*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_INTERNALERROR, NULL);
|
||||
goto end;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt)
|
||||
OPENSSL_strlcat(out_buf, ascii_salt, sizeof(out_buf));
|
||||
|
||||
/* assert "$5$rounds=999999999$......salt......" */
|
||||
if (strlen(out_buf) > 3 + 17 * rounds_custom + salt_len )
|
||||
if (strlen(out_buf) > 3 + 17 * rounds_custom + salt_len)
|
||||
goto err;
|
||||
|
||||
md = EVP_MD_CTX_new();
|
||||
|
@ -729,7 +729,7 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx,
|
||||
goto end;
|
||||
}
|
||||
mbuf = app_malloc(filesize, "oneshot sign/verify buffer");
|
||||
switch(pkey_op) {
|
||||
switch (pkey_op) {
|
||||
case EVP_PKEY_OP_VERIFY:
|
||||
buf_len = BIO_read(in, mbuf, filesize);
|
||||
if (buf_len != filesize) {
|
||||
@ -754,7 +754,7 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx,
|
||||
goto end;
|
||||
}
|
||||
|
||||
switch(pkey_op) {
|
||||
switch (pkey_op) {
|
||||
case EVP_PKEY_OP_VERIFY:
|
||||
for (;;) {
|
||||
buf_len = BIO_read(in, tbuf, TBUF_MAXSIZE);
|
||||
|
@ -781,7 +781,7 @@ int req_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!make_REQ(req, pkey, fsubj, multirdn, !gen_x509, chtype)){
|
||||
if (!make_REQ(req, pkey, fsubj, multirdn, !gen_x509, chtype)) {
|
||||
BIO_printf(bio_err, "Error making certificate request\n");
|
||||
goto end;
|
||||
}
|
||||
|
@ -1971,7 +1971,7 @@ int s_client_main(int argc, char **argv)
|
||||
|
||||
if (!noservername && (servername != NULL || dane_tlsa_domain == NULL)) {
|
||||
if (servername == NULL) {
|
||||
if(host == NULL || is_dNS_name(host))
|
||||
if (host == NULL || is_dNS_name(host))
|
||||
servername = (host == NULL) ? "localhost" : host;
|
||||
}
|
||||
if (servername != NULL && !SSL_set_tlsext_host_name(con, servername)) {
|
||||
@ -2984,7 +2984,7 @@ int s_client_main(int argc, char **argv)
|
||||
BIO_printf(bio_err, "RENEGOTIATING\n");
|
||||
SSL_renegotiate(con);
|
||||
cbuf_len = 0;
|
||||
} else if (!c_ign_eof && (cbuf[0] == 'K' || cbuf[0] == 'k' )
|
||||
} else if (!c_ign_eof && (cbuf[0] == 'K' || cbuf[0] == 'k')
|
||||
&& cmdletters) {
|
||||
BIO_printf(bio_err, "KEYUPDATE\n");
|
||||
SSL_key_update(con,
|
||||
|
@ -137,7 +137,7 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
if ((*ctx)->expect_file_generations) {
|
||||
char *p = (*ctx)->entry_name + strlen((*ctx)->entry_name);
|
||||
|
||||
while(p > (*ctx)->entry_name && isdigit(p[-1]))
|
||||
while (p > (*ctx)->entry_name && isdigit(p[-1]))
|
||||
p--;
|
||||
if (p > (*ctx)->entry_name && p[-1] == ';')
|
||||
p[-1] = '\0';
|
||||
|
@ -63,12 +63,13 @@
|
||||
#if 1
|
||||
static void prefetch256(const void *table)
|
||||
{
|
||||
volatile unsigned long *t=(void *)table,ret;
|
||||
volatile unsigned long *t = (void *)table, ret;
|
||||
unsigned long sum;
|
||||
int i;
|
||||
|
||||
/* 32 is common least cache-line size */
|
||||
for (sum=0,i=0;i<256/sizeof(t[0]);i+=32/sizeof(t[0])) sum ^= t[i];
|
||||
for (sum = 0, i = 0; i < 256/sizeof(t[0]); i += 32/sizeof(t[0]))
|
||||
sum ^= t[i];
|
||||
|
||||
ret = sum;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ void ossl_aria_encrypt(const unsigned char *in, unsigned char *out,
|
||||
ARIA_ADD_ROUND_KEY(rk, reg0, reg1, reg2, reg3);
|
||||
rk++;
|
||||
|
||||
while(Nr -= 2){
|
||||
while (Nr -= 2) {
|
||||
ARIA_SUBST_DIFF_EVEN(reg0, reg1, reg2, reg3);
|
||||
ARIA_ADD_ROUND_KEY(rk, reg0, reg1, reg2, reg3);
|
||||
rk++;
|
||||
|
@ -654,7 +654,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
|
||||
{
|
||||
int ret = 0; /* Assume failure */
|
||||
|
||||
switch(family) {
|
||||
switch (family) {
|
||||
case AF_INET:
|
||||
#ifdef AF_INET6
|
||||
case AF_INET6:
|
||||
@ -789,7 +789,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
|
||||
he_fallback_address = INADDR_ANY;
|
||||
if (host == NULL) {
|
||||
he = &he_fallback;
|
||||
switch(lookup_type) {
|
||||
switch (lookup_type) {
|
||||
case BIO_LOOKUP_CLIENT:
|
||||
he_fallback_address = INADDR_LOOPBACK;
|
||||
break;
|
||||
@ -906,12 +906,12 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
|
||||
|
||||
/* The easiest way to create a linked list from an
|
||||
array is to start from the back */
|
||||
for(addrlistp = he->h_addr_list; *addrlistp != NULL;
|
||||
addrlistp++)
|
||||
for (addrlistp = he->h_addr_list; *addrlistp != NULL;
|
||||
addrlistp++)
|
||||
;
|
||||
|
||||
for(addresses = addrlistp - he->h_addr_list;
|
||||
addrlistp--, addresses-- > 0; ) {
|
||||
for (addresses = addrlistp - he->h_addr_list;
|
||||
addrlistp--, addresses-- > 0; ) {
|
||||
if (!addrinfo_wrap(he->h_addrtype, socktype,
|
||||
*addrlistp, he->h_length,
|
||||
se->s_port, &tmp_bai))
|
||||
|
@ -381,7 +381,7 @@ bn_add_words:
|
||||
inc 16,%o1
|
||||
addxcc %g3,%g4,%g3
|
||||
st %g3,[%o0+4]
|
||||
|
||||
|
||||
ld [%o1-4],%g3
|
||||
ld [%o2+12],%g4
|
||||
inc 16,%o2
|
||||
@ -469,7 +469,7 @@ bn_sub_words:
|
||||
inc 16,%o1
|
||||
subxcc %g3,%g4,%g4
|
||||
st %g4,[%o0+4]
|
||||
|
||||
|
||||
ld [%o1-4],%g3
|
||||
ld [%o2+12],%g4
|
||||
inc 16,%o2
|
||||
@ -1040,7 +1040,7 @@ bn_mul_comba4:
|
||||
addxcc c_2,t_2,c_2 !=
|
||||
st c_1,rp(6) !r[6]=c1;
|
||||
st c_2,rp(7) !r[7]=c2;
|
||||
|
||||
|
||||
ret
|
||||
restore %g0,%g0,%o0
|
||||
|
||||
@ -1448,7 +1448,7 @@ bn_sqr_comba4:
|
||||
addxcc c_2,t_2,c_2 !=
|
||||
st c_1,rp(6) !r[6]=c1;
|
||||
st c_2,rp(7) !r[7]=c2;
|
||||
|
||||
|
||||
ret
|
||||
restore %g0,%g0,%o0
|
||||
|
||||
|
@ -496,7 +496,7 @@ bn_add_words:
|
||||
inc 16,%o1
|
||||
addccc %g1,%g2,%g1
|
||||
stuw %g1,[%o0+4]
|
||||
|
||||
|
||||
inc 16,%o2
|
||||
addccc %g3,%g4,%g3
|
||||
stuw %g3,[%o0+8]
|
||||
@ -1126,7 +1126,7 @@ bn_mul_comba4:
|
||||
srlx t_1,32,c_12 !=
|
||||
stuw t_1,rp(6) !r[6]=c1;
|
||||
stuw c_12,rp(7) !r[7]=c2;
|
||||
|
||||
|
||||
ret
|
||||
restore %g0,%g0,%o0
|
||||
|
||||
@ -1548,7 +1548,7 @@ bn_sqr_comba4:
|
||||
srlx t_1,32,c_12
|
||||
stuw t_1,rp(6) !r[6]=c1;
|
||||
stuw c_12,rp(7) !r[7]=c2;
|
||||
|
||||
|
||||
ret
|
||||
restore %g0,%g0,%o0
|
||||
|
||||
|
@ -112,7 +112,7 @@ static int bn_rsa_fips186_4_find_aux_prob_prime(const BIGNUM *Xp1,
|
||||
BN_set_flags(p1, BN_FLG_CONSTTIME);
|
||||
|
||||
/* Find the first odd number >= Xp1 that is probably prime */
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
i++;
|
||||
BN_GENCB_call(cb, 0, i);
|
||||
/* MR test with trial division */
|
||||
|
@ -1095,7 +1095,7 @@ OSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx,
|
||||
}
|
||||
|
||||
msg = OSSL_CMP_MSG_new(libctx, propq);
|
||||
if (msg == NULL){
|
||||
if (msg == NULL) {
|
||||
ERR_raise(ERR_LIB_CMP, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -795,7 +795,7 @@ static EVP_CIPHER *cms_get_key_wrap_cipher(size_t keylen, const CMS_CTX *ctx)
|
||||
{
|
||||
const char *alg = NULL;
|
||||
|
||||
switch(keylen) {
|
||||
switch (keylen) {
|
||||
case 16:
|
||||
alg = "AES-128-WRAP";
|
||||
break;
|
||||
|
@ -71,7 +71,7 @@ static uint64_t ossl_strtouint64(const variant_char *str)
|
||||
base = 16, str++;
|
||||
}
|
||||
|
||||
while((digit = todigit(*str++)) < base)
|
||||
while ((digit = todigit(*str++)) < base)
|
||||
ret = ret * base + digit;
|
||||
|
||||
return ret;
|
||||
@ -80,7 +80,7 @@ static uint64_t ossl_strtouint64(const variant_char *str)
|
||||
static variant_char *ossl_strchr(const variant_char *str, char srch)
|
||||
{ variant_char c;
|
||||
|
||||
while((c = *str)) {
|
||||
while ((c = *str)) {
|
||||
if (c == srch)
|
||||
return (variant_char *)str;
|
||||
str++;
|
||||
|
@ -545,7 +545,7 @@ int ossl_ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point
|
||||
* We have a curve defined by a Weierstrass equation
|
||||
* y^2 + x*y = x^3 + a*x^2 + b.
|
||||
* <=> x^3 + a*x^2 + x*y + b + y^2 = 0
|
||||
* <=> ((x + a) * x + y ) * x + b + y^2 = 0
|
||||
* <=> ((x + a) * x + y) * x + b + y^2 = 0
|
||||
*/
|
||||
if (!BN_GF2m_add(lh, point->X, group->a))
|
||||
goto err;
|
||||
|
@ -574,7 +574,7 @@ int ec_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
|
||||
if (ecbits <= 0)
|
||||
goto err;
|
||||
|
||||
sz = (ecbits + 7 ) / 8;
|
||||
sz = (ecbits + 7) / 8;
|
||||
if (!OSSL_PARAM_BLD_push_BN_pad(tmpl,
|
||||
OSSL_PKEY_PARAM_PRIV_KEY,
|
||||
priv_key, sz))
|
||||
|
@ -295,7 +295,7 @@ int ossl_ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
|
||||
point_conversion_form_t genform;
|
||||
|
||||
if (group == NULL) {
|
||||
ERR_raise(ERR_LIB_EC,EC_R_PASSED_NULL_PARAMETER);
|
||||
ERR_raise(ERR_LIB_EC, EC_R_PASSED_NULL_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1377,7 +1377,7 @@ static int ecp_nistz256_inv_mod_ord(const EC_GROUP *group, BIGNUM *r,
|
||||
/*
|
||||
* The bottom 128 bit of the exponent are processed with fixed 4-bit window
|
||||
*/
|
||||
for(i = 0; i < 32; i++) {
|
||||
for (i = 0; i < 32; i++) {
|
||||
/* expLo - the low 128 bits of the exponent we use (ord(p256) - 2),
|
||||
* split into nibbles */
|
||||
static const unsigned char expLo[32] = {
|
||||
|
@ -1423,8 +1423,8 @@ int ossl_ec_GFp_simple_field_inv(const EC_GROUP *group, BIGNUM *r,
|
||||
/*-
|
||||
* Apply randomization of EC point projective coordinates:
|
||||
*
|
||||
* (X, Y ,Z ) = (lambda^2*X, lambda^3*Y, lambda*Z)
|
||||
* lambda = [1,group->field)
|
||||
* (X, Y, Z) = (lambda^2*X, lambda^3*Y, lambda*Z)
|
||||
* lambda = [1, group->field)
|
||||
*
|
||||
*/
|
||||
int ossl_ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p,
|
||||
|
@ -138,7 +138,7 @@ static int ecx_bits(const EVP_PKEY *pkey)
|
||||
{
|
||||
if (IS25519(pkey->ameth->pkey_id)) {
|
||||
return X25519_BITS;
|
||||
} else if(ISX448(pkey->ameth->pkey_id)) {
|
||||
} else if (ISX448(pkey->ameth->pkey_id)) {
|
||||
return X448_BITS;
|
||||
} else {
|
||||
return ED448_BITS;
|
||||
|
@ -189,7 +189,7 @@ static int evp_pkey_asym_cipher_init(EVP_PKEY_CTX *ctx, int operation,
|
||||
ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
|
||||
return -2;
|
||||
}
|
||||
switch(ctx->operation) {
|
||||
switch (ctx->operation) {
|
||||
case EVP_PKEY_OP_ENCRYPT:
|
||||
if (ctx->pmeth->encrypt_init == NULL)
|
||||
return 1;
|
||||
|
@ -2149,7 +2149,7 @@ static int s390x_aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
if (!enc || !cctx->aes.ccm.tag_set)
|
||||
return 0;
|
||||
|
||||
if(arg < cctx->aes.ccm.m)
|
||||
if (arg < cctx->aes.ccm.m)
|
||||
return 0;
|
||||
|
||||
memcpy(ptr, cctx->aes.ccm.kmac_param.icv.b, cctx->aes.ccm.m);
|
||||
|
@ -73,7 +73,7 @@ static int aria_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
EVP_CIPHER_CTX_get_key_length(ctx) * 8,
|
||||
EVP_CIPHER_CTX_get_cipher_data(ctx));
|
||||
if (ret < 0) {
|
||||
ERR_raise(ERR_LIB_EVP,EVP_R_ARIA_KEY_SETUP_FAILED);
|
||||
ERR_raise(ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@ -216,7 +216,7 @@ static int aria_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
const unsigned char *iv, int enc)
|
||||
{
|
||||
int ret;
|
||||
EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX,ctx);
|
||||
EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX, ctx);
|
||||
|
||||
if (!iv && !key)
|
||||
return 1;
|
||||
@ -227,7 +227,7 @@ static int aria_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks,
|
||||
(block128_f) ossl_aria_encrypt);
|
||||
if (ret < 0) {
|
||||
ERR_raise(ERR_LIB_EVP,EVP_R_ARIA_KEY_SETUP_FAILED);
|
||||
ERR_raise(ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ static int aria_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
|
||||
static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
{
|
||||
EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX,c);
|
||||
EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX, c);
|
||||
|
||||
switch (type) {
|
||||
case EVP_CTRL_INIT:
|
||||
@ -375,7 +375,7 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
case EVP_CTRL_COPY:
|
||||
{
|
||||
EVP_CIPHER_CTX *out = ptr;
|
||||
EVP_ARIA_GCM_CTX *gctx_out = EVP_C_DATA(EVP_ARIA_GCM_CTX,out);
|
||||
EVP_ARIA_GCM_CTX *gctx_out = EVP_C_DATA(EVP_ARIA_GCM_CTX, out);
|
||||
if (gctx->gcm.key) {
|
||||
if (gctx->gcm.key != &gctx->ks)
|
||||
return 0;
|
||||
@ -402,7 +402,7 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
static int aria_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX,ctx);
|
||||
EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX, ctx);
|
||||
int rv = -1;
|
||||
|
||||
/* Encrypt/decrypt must be performed in place */
|
||||
@ -458,7 +458,7 @@ static int aria_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
static int aria_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX,ctx);
|
||||
EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX, ctx);
|
||||
|
||||
/* If not set up, return error */
|
||||
if (!gctx->key_set)
|
||||
@ -513,7 +513,7 @@ static int aria_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
const unsigned char *iv, int enc)
|
||||
{
|
||||
int ret;
|
||||
EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,ctx);
|
||||
EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx);
|
||||
|
||||
if (!iv && !key)
|
||||
return 1;
|
||||
@ -525,7 +525,7 @@ static int aria_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
|
||||
&cctx->ks, (block128_f) ossl_aria_encrypt);
|
||||
if (ret < 0) {
|
||||
ERR_raise(ERR_LIB_EVP,EVP_R_ARIA_KEY_SETUP_FAILED);
|
||||
ERR_raise(ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED);
|
||||
return 0;
|
||||
}
|
||||
cctx->str = NULL;
|
||||
@ -540,7 +540,7 @@ static int aria_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
|
||||
static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
{
|
||||
EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,c);
|
||||
EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, c);
|
||||
|
||||
switch (type) {
|
||||
case EVP_CTRL_INIT:
|
||||
@ -624,7 +624,7 @@ static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
case EVP_CTRL_COPY:
|
||||
{
|
||||
EVP_CIPHER_CTX *out = ptr;
|
||||
EVP_ARIA_CCM_CTX *cctx_out = EVP_C_DATA(EVP_ARIA_CCM_CTX,out);
|
||||
EVP_ARIA_CCM_CTX *cctx_out = EVP_C_DATA(EVP_ARIA_CCM_CTX, out);
|
||||
if (cctx->ccm.key) {
|
||||
if (cctx->ccm.key != &cctx->ks)
|
||||
return 0;
|
||||
@ -641,7 +641,7 @@ static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
static int aria_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,ctx);
|
||||
EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx);
|
||||
CCM128_CONTEXT *ccm = &cctx->ccm;
|
||||
|
||||
/* Encrypt/decrypt must be performed in place */
|
||||
@ -689,7 +689,7 @@ static int aria_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
static int aria_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,ctx);
|
||||
EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx);
|
||||
CCM128_CONTEXT *ccm = &cctx->ccm;
|
||||
|
||||
/* If not set up, return error */
|
||||
|
@ -193,7 +193,7 @@ static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
const unsigned char *iv, int enc)
|
||||
{
|
||||
int ret, mode;
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx);
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx);
|
||||
|
||||
ret = Camellia_set_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8,
|
||||
&dat->ks);
|
||||
@ -220,7 +220,7 @@ static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
static int camellia_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx);
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx);
|
||||
|
||||
if (dat->stream.cbc)
|
||||
(*dat->stream.cbc) (in, out, len, &dat->ks, ctx->iv,
|
||||
@ -238,7 +238,7 @@ static int camellia_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
{
|
||||
size_t bl = EVP_CIPHER_CTX_get_block_size(ctx);
|
||||
size_t i;
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx);
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx);
|
||||
|
||||
if (len < bl)
|
||||
return 1;
|
||||
@ -252,7 +252,7 @@ static int camellia_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
static int camellia_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx);
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx);
|
||||
|
||||
int num = EVP_CIPHER_CTX_get_num(ctx);
|
||||
CRYPTO_ofb128_encrypt(in, out, len, &dat->ks, ctx->iv, &num, dat->block);
|
||||
@ -263,7 +263,7 @@ static int camellia_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
static int camellia_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx);
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx);
|
||||
|
||||
int num = EVP_CIPHER_CTX_get_num(ctx);
|
||||
CRYPTO_cfb128_encrypt(in, out, len, &dat->ks, ctx->iv, &num,
|
||||
@ -275,7 +275,7 @@ static int camellia_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
static int camellia_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx);
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx);
|
||||
|
||||
int num = EVP_CIPHER_CTX_get_num(ctx);
|
||||
CRYPTO_cfb128_8_encrypt(in, out, len, &dat->ks, ctx->iv, &num,
|
||||
@ -287,7 +287,7 @@ static int camellia_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
static int camellia_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx);
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx);
|
||||
|
||||
if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS)) {
|
||||
int num = EVP_CIPHER_CTX_get_num(ctx);
|
||||
@ -326,7 +326,7 @@ static int camellia_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
{
|
||||
int snum = EVP_CIPHER_CTX_get_num(ctx);
|
||||
unsigned int num;
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx);
|
||||
EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx);
|
||||
|
||||
if (snum < 0)
|
||||
return 0;
|
||||
|
@ -498,7 +498,7 @@ static int chacha20_poly1305_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
|
||||
{
|
||||
EVP_CHACHA_AEAD_CTX *actx = aead_data(ctx);
|
||||
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case EVP_CTRL_INIT:
|
||||
if (actx == NULL)
|
||||
actx = ctx->cipher_data
|
||||
|
@ -42,7 +42,7 @@ static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t inl)
|
||||
{
|
||||
BLOCK_CIPHER_ecb_loop()
|
||||
IDEA_ecb_encrypt(in + i, out + i, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks);
|
||||
IDEA_ecb_encrypt(in + i, out + i, &EVP_C_DATA(EVP_IDEA_KEY, ctx)->ks);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -64,12 +64,12 @@ static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
enc = 1;
|
||||
}
|
||||
if (enc)
|
||||
IDEA_set_encrypt_key(key, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks);
|
||||
IDEA_set_encrypt_key(key, &EVP_C_DATA(EVP_IDEA_KEY, ctx)->ks);
|
||||
else {
|
||||
IDEA_KEY_SCHEDULE tmp;
|
||||
|
||||
IDEA_set_encrypt_key(key, &tmp);
|
||||
IDEA_set_decrypt_key(&tmp, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks);
|
||||
IDEA_set_decrypt_key(&tmp, &EVP_C_DATA(EVP_IDEA_KEY, ctx)->ks);
|
||||
OPENSSL_cleanse((unsigned char *)&tmp, sizeof(IDEA_KEY_SCHEDULE));
|
||||
}
|
||||
return 1;
|
||||
|
@ -36,6 +36,6 @@ IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed,
|
||||
static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
const unsigned char *iv, int enc)
|
||||
{
|
||||
SEED_set_key(key, &EVP_C_DATA(EVP_SEED_KEY,ctx)->ks);
|
||||
SEED_set_key(key, &EVP_C_DATA(EVP_SEED_KEY, ctx)->ks);
|
||||
return 1;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth)
|
||||
{
|
||||
if (app_pkey_methods == NULL) {
|
||||
app_pkey_methods = sk_EVP_PKEY_METHOD_new(pmeth_cmp);
|
||||
if (app_pkey_methods == NULL){
|
||||
if (app_pkey_methods == NULL) {
|
||||
ERR_raise(ERR_LIB_EVP, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
@ -866,7 +866,7 @@ int evp_pkey_ctx_set_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params)
|
||||
|
||||
for (p = params; p->key != NULL; p++) {
|
||||
/* Check the ctx actually understands this parameter */
|
||||
if (OSSL_PARAM_locate_const(settable, p->key) == NULL )
|
||||
if (OSSL_PARAM_locate_const(settable, p->key) == NULL)
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -889,9 +889,9 @@ int evp_pkey_ctx_get_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params)
|
||||
const OSSL_PARAM *gettable = EVP_PKEY_CTX_gettable_params(ctx);
|
||||
const OSSL_PARAM *p;
|
||||
|
||||
for (p = params; p->key != NULL; p++ ) {
|
||||
for (p = params; p->key != NULL; p++) {
|
||||
/* Check the ctx actually understands this parameter */
|
||||
if (OSSL_PARAM_locate_const(gettable, p->key) == NULL )
|
||||
if (OSSL_PARAM_locate_const(gettable, p->key) == NULL)
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ static int generate_q_fips186_4(BN_CTX *ctx, BIGNUM *q, const EVP_MD *evpmd,
|
||||
|
||||
/* find q */
|
||||
for (;;) {
|
||||
if(!BN_GENCB_call(cb, 0, m++))
|
||||
if (!BN_GENCB_call(cb, 0, m++))
|
||||
goto err;
|
||||
|
||||
/* A.1.1.2 Step (5) : generate seed with size seed_len */
|
||||
@ -673,7 +673,7 @@ int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx,
|
||||
* A.1.1.3 Step (10)
|
||||
* n = floor(L / hash_outlen) - 1
|
||||
*/
|
||||
n = (L - 1 ) / (mdsize << 3);
|
||||
n = (L - 1) / (mdsize << 3);
|
||||
|
||||
/* Calculate 2^(L-1): Used in step A.1.1.2 Step (11.3) */
|
||||
if (!BN_lshift(test, BN_value_one(), L - 1))
|
||||
@ -688,9 +688,9 @@ int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx,
|
||||
*res = FFC_CHECK_Q_MISMATCH;
|
||||
goto err;
|
||||
}
|
||||
if(!BN_GENCB_call(cb, 2, 0))
|
||||
if (!BN_GENCB_call(cb, 2, 0))
|
||||
goto err;
|
||||
if(!BN_GENCB_call(cb, 3, 0))
|
||||
if (!BN_GENCB_call(cb, 3, 0))
|
||||
goto err;
|
||||
|
||||
memcpy(seed_tmp, seed, seedlen);
|
||||
|
@ -276,7 +276,7 @@ static void contract(OPENSSL_LHASH *lh)
|
||||
n = OPENSSL_realloc(lh->b,
|
||||
(unsigned int)(sizeof(OPENSSL_LH_NODE *) * lh->pmax));
|
||||
if (n == NULL) {
|
||||
/* fputs("realloc error in lhash",stderr); */
|
||||
/* fputs("realloc error in lhash", stderr); */
|
||||
lh->error++;
|
||||
return;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype, const unsigned
|
||||
}
|
||||
bag->type = OBJ_nid2obj(type);
|
||||
|
||||
switch(vtype) {
|
||||
switch (vtype) {
|
||||
case V_ASN1_OCTET_STRING:
|
||||
{
|
||||
ASN1_OCTET_STRING *strtmp = ASN1_OCTET_STRING_new();
|
||||
@ -161,7 +161,7 @@ PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype, const unsigned
|
||||
safebag->value.bag = bag;
|
||||
safebag->type = OBJ_nid2obj(NID_secretBag);
|
||||
return safebag;
|
||||
|
||||
|
||||
err:
|
||||
PKCS12_BAGS_free(bag);
|
||||
return NULL;
|
||||
|
@ -263,7 +263,7 @@ void OPENSSL_cpuid_setup(void)
|
||||
sigaction(SIGILL, &ill_act, &ill_oact);
|
||||
|
||||
#ifndef OSSL_IMPLEMENT_GETAUXVAL
|
||||
if (sigsetjmp(ill_jmp,1) == 0) {
|
||||
if (sigsetjmp(ill_jmp, 1) == 0) {
|
||||
OPENSSL_fpu_probe();
|
||||
OPENSSL_ppccap_P |= PPC_FPU;
|
||||
|
||||
|
@ -576,7 +576,7 @@ static void put_char(char ch, char **buf, size_t *remain, size_t *needed)
|
||||
++*needed;
|
||||
return;
|
||||
}
|
||||
if(*remain == 1)
|
||||
if (*remain == 1)
|
||||
**buf = '\0';
|
||||
else
|
||||
**buf = ch;
|
||||
@ -595,16 +595,16 @@ static void put_str(const char *str, char **buf, size_t *remain, size_t *needed)
|
||||
if (*remain == 0)
|
||||
return;
|
||||
|
||||
if(*remain < len + 1)
|
||||
if (*remain < len + 1)
|
||||
len = *remain - 1;
|
||||
|
||||
if(len > 0) {
|
||||
if (len > 0) {
|
||||
strncpy(*buf, str, len);
|
||||
*buf += len;
|
||||
*remain -= len;
|
||||
}
|
||||
|
||||
if(len < olen && *remain == 1) {
|
||||
if (len < olen && *remain == 1) {
|
||||
**buf = '\0';
|
||||
++*buf;
|
||||
--*remain;
|
||||
|
@ -85,14 +85,14 @@ int hpns_socket(int family,
|
||||
|
||||
socket_transport_name_get(AF_UNIX, current_transport, 20);
|
||||
|
||||
if (strcmp(current_transport,transport) == 0)
|
||||
if (strcmp(current_transport, transport) == 0)
|
||||
return socket(family, type, protocol);
|
||||
|
||||
/* set the requested socket transport */
|
||||
if (socket_transport_name_set(AF_UNIX, transport))
|
||||
return -1;
|
||||
|
||||
socket_rc = socket(family,type,protocol);
|
||||
socket_rc = socket(family, type, protocol);
|
||||
|
||||
/* set mode back to what it was */
|
||||
if (socket_transport_name_set(AF_UNIX, current_transport))
|
||||
@ -135,7 +135,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
|
||||
setbuf(fp, NULL);
|
||||
|
||||
/* Try to connect */
|
||||
for ( ; ; ) {
|
||||
for (;;) {
|
||||
if (connect(fd, (struct sockaddr *)&addr, i) == 0)
|
||||
break;
|
||||
# ifdef EISCONN
|
||||
|
@ -144,14 +144,14 @@ int RAND_load_file(const char *file, long bytes)
|
||||
# pragma environment restore
|
||||
#endif
|
||||
|
||||
for ( ; ; ) {
|
||||
for (;;) {
|
||||
if (bytes > 0)
|
||||
n = (bytes <= RAND_LOAD_BUF_SIZE) ? (int)bytes : RAND_BUF_SIZE;
|
||||
else
|
||||
n = RAND_LOAD_BUF_SIZE;
|
||||
i = fread(buf, 1, n, in);
|
||||
#ifdef EINTR
|
||||
if (ferror(in) && errno == EINTR){
|
||||
if (ferror(in) && errno == EINTR) {
|
||||
clearerr(in);
|
||||
if (i == 0)
|
||||
continue;
|
||||
|
@ -216,7 +216,7 @@ static int rsa_pss_param_print(BIO *bp, int pss_key, RSA_PSS_PARAMS *pss,
|
||||
return 0;
|
||||
}
|
||||
} else if (pss == NULL) {
|
||||
if (BIO_puts(bp,"(INVALID PSS PARAMETERS)\n") <= 0)
|
||||
if (BIO_puts(bp, "(INVALID PSS PARAMETERS)\n") <= 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ static int collect_numbers(STACK_OF(BIGNUM) *numbers,
|
||||
if (numbers == NULL)
|
||||
return 0;
|
||||
|
||||
for (i = 0; names[i] != NULL; i++){
|
||||
for (i = 0; names[i] != NULL; i++) {
|
||||
p = OSSL_PARAM_locate_const(params, names[i]);
|
||||
if (p != NULL) {
|
||||
BIGNUM *tmp = NULL;
|
||||
|
@ -394,7 +394,7 @@ static int check_padding_md(const EVP_MD *md, int padding)
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
switch(mdnid) {
|
||||
switch (mdnid) {
|
||||
/* List of all supported RSA digests */
|
||||
case NID_sha1:
|
||||
case NID_sha224:
|
||||
|
@ -125,7 +125,7 @@ int ossl_rsa_fips186_4_gen_prob_primes(RSA *rsa, RSA_ACVP_TEST *test,
|
||||
if (!ossl_bn_rsa_fips186_4_gen_prob_primes(rsa->p, Xpo, p1, p2, Xp, Xp1, Xp2,
|
||||
nbits, e, ctx, cb))
|
||||
goto err;
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
/* (Step 5) Generate q, Xq*/
|
||||
if (!ossl_bn_rsa_fips186_4_gen_prob_primes(rsa->q, Xqo, q1, q2, Xq, Xq1,
|
||||
Xq2, nbits, e, ctx, cb))
|
||||
|
@ -1242,11 +1242,11 @@ int main()
|
||||
printf(++i % 16 && i != sizeof(out) ? " " : "\n");
|
||||
}
|
||||
|
||||
if (memcmp(out,result,sizeof(out))) {
|
||||
fprintf(stderr,"failure\n");
|
||||
if (memcmp(out, result, sizeof(out))) {
|
||||
fprintf(stderr, "failure\n");
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr,"success\n");
|
||||
fprintf(stderr, "success\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ int ossl_sm2_key_private_check(const EC_KEY *eckey)
|
||||
if (eckey == NULL
|
||||
|| (group = EC_KEY_get0_group(eckey)) == NULL
|
||||
|| (priv_key = EC_KEY_get0_private_key(eckey)) == NULL
|
||||
|| (order = EC_GROUP_get0_order(group)) == NULL ) {
|
||||
|| (order = EC_GROUP_get0_order(group)) == NULL) {
|
||||
ERR_raise(ERR_LIB_SM2, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ char *SRP_create_verifier_ex(const char *user, const char *pass, char **salt,
|
||||
if (N_bn_alloc == NULL)
|
||||
goto err;
|
||||
N_bn = N_bn_alloc;
|
||||
if ((len = t_fromb64(tmp, sizeof(tmp) ,g)) <= 0)
|
||||
if ((len = t_fromb64(tmp, sizeof(tmp), g)) <= 0)
|
||||
goto err;
|
||||
g_bn_alloc = BN_bin2bn(tmp, len, NULL);
|
||||
if (g_bn_alloc == NULL)
|
||||
|
@ -135,8 +135,8 @@ OSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq,
|
||||
if (loader_ctx == NULL) {
|
||||
OSSL_STORE_LOADER_free(fetched_loader);
|
||||
fetched_loader = NULL;
|
||||
} else if(!loader_set_params(fetched_loader, loader_ctx,
|
||||
params, propq)) {
|
||||
} else if (!loader_set_params(fetched_loader, loader_ctx,
|
||||
params, propq)) {
|
||||
(void)fetched_loader->p_close(loader_ctx);
|
||||
OSSL_STORE_LOADER_free(fetched_loader);
|
||||
fetched_loader = NULL;
|
||||
|
@ -54,7 +54,7 @@ static int policy_cache_create(X509 *x,
|
||||
goto bad_policy;
|
||||
}
|
||||
cache->anyPolicy = data;
|
||||
} else if (sk_X509_POLICY_DATA_find(cache->data, data) >=0 ) {
|
||||
} else if (sk_X509_POLICY_DATA_find(cache->data, data) >=0) {
|
||||
ret = -1;
|
||||
goto bad_policy;
|
||||
} else if (!sk_X509_POLICY_DATA_push(cache->data, data)) {
|
||||
|
@ -93,7 +93,7 @@ X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
|
||||
if (tree) {
|
||||
if (tree->extra_data == NULL)
|
||||
tree->extra_data = sk_X509_POLICY_DATA_new_null();
|
||||
if (tree->extra_data == NULL){
|
||||
if (tree->extra_data == NULL) {
|
||||
ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
|
||||
goto node_error;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ static int i2r_NAMING_AUTHORITY(const struct v3_ext_method *method, void *in,
|
||||
|| BIO_printf(bp, "\n") <= 0)
|
||||
goto err;
|
||||
}
|
||||
if (namingAuthority->namingAuthorityUrl != NULL ) {
|
||||
if (namingAuthority->namingAuthorityUrl != NULL) {
|
||||
if (BIO_printf(bp, "%*s namingAuthorityUrl: ", ind, "") <= 0
|
||||
|| ASN1_STRING_print(bp, namingAuthority->namingAuthorityUrl) <= 0
|
||||
|| BIO_printf(bp, "\n") <= 0)
|
||||
|
@ -47,18 +47,16 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
ASN1_SEQUENCE(PROXY_POLICY) =
|
||||
{
|
||||
ASN1_SIMPLE(PROXY_POLICY,policyLanguage,ASN1_OBJECT),
|
||||
ASN1_OPT(PROXY_POLICY,policy,ASN1_OCTET_STRING)
|
||||
ASN1_SEQUENCE(PROXY_POLICY) = {
|
||||
ASN1_SIMPLE(PROXY_POLICY, policyLanguage, ASN1_OBJECT),
|
||||
ASN1_OPT(PROXY_POLICY, policy, ASN1_OCTET_STRING)
|
||||
} ASN1_SEQUENCE_END(PROXY_POLICY)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS(PROXY_POLICY)
|
||||
|
||||
ASN1_SEQUENCE(PROXY_CERT_INFO_EXTENSION) =
|
||||
{
|
||||
ASN1_OPT(PROXY_CERT_INFO_EXTENSION,pcPathLengthConstraint,ASN1_INTEGER),
|
||||
ASN1_SIMPLE(PROXY_CERT_INFO_EXTENSION,proxyPolicy,PROXY_POLICY)
|
||||
ASN1_SEQUENCE(PROXY_CERT_INFO_EXTENSION) = {
|
||||
ASN1_OPT(PROXY_CERT_INFO_EXTENSION, pcPathLengthConstraint, ASN1_INTEGER),
|
||||
ASN1_SIMPLE(PROXY_CERT_INFO_EXTENSION, proxyPolicy, PROXY_POLICY)
|
||||
} ASN1_SEQUENCE_END(PROXY_CERT_INFO_EXTENSION)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
|
||||
|
@ -3286,7 +3286,7 @@ static int build_chain(X509_STORE_CTX *ctx)
|
||||
return 0;
|
||||
case X509_TRUST_UNTRUSTED:
|
||||
default:
|
||||
switch(ctx->error) {
|
||||
switch (ctx->error) {
|
||||
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
|
||||
case X509_V_ERR_CERT_NOT_YET_VALID:
|
||||
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
|
||||
|
@ -20,9 +20,9 @@ static int X509_REVOKED_cmp(const X509_REVOKED *const *a,
|
||||
static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
|
||||
|
||||
ASN1_SEQUENCE(X509_REVOKED) = {
|
||||
ASN1_EMBED(X509_REVOKED,serialNumber, ASN1_INTEGER),
|
||||
ASN1_SIMPLE(X509_REVOKED,revocationDate, ASN1_TIME),
|
||||
ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION)
|
||||
ASN1_EMBED(X509_REVOKED, serialNumber, ASN1_INTEGER),
|
||||
ASN1_SIMPLE(X509_REVOKED, revocationDate, ASN1_TIME),
|
||||
ASN1_SEQUENCE_OF_OPT(X509_REVOKED, extensions, X509_EXTENSION)
|
||||
} ASN1_SEQUENCE_END(X509_REVOKED)
|
||||
|
||||
static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r);
|
||||
|
@ -47,7 +47,7 @@ int main(int argc, char * argv[])
|
||||
char *digest_value=NULL;
|
||||
int j;
|
||||
|
||||
input = BIO_new_fd( fileno(stdin), 1 );
|
||||
input = BIO_new_fd(fileno(stdin), 1);
|
||||
if (input == NULL) {
|
||||
fprintf(stderr, "BIO_new_fd() for stdin returned NULL\n");
|
||||
goto cleanup;
|
||||
@ -63,7 +63,7 @@ int main(int argc, char * argv[])
|
||||
* The algorithm name is case insensitive.
|
||||
* See providers(7) for details about algorithm fetching
|
||||
*/
|
||||
md = EVP_MD_fetch( library_context, "SHA3-512", NULL );
|
||||
md = EVP_MD_fetch(library_context, "SHA3-512", NULL);
|
||||
if (md == NULL) {
|
||||
fprintf(stderr, "EVP_MD_fetch did not find SHA3-512.\n");
|
||||
goto cleanup;
|
||||
@ -81,7 +81,7 @@ int main(int argc, char * argv[])
|
||||
goto cleanup;
|
||||
}
|
||||
/* set our bio_digest BIO to digest data */
|
||||
if (BIO_set_md(bio_digest,md) != 1) {
|
||||
if (BIO_set_md(bio_digest, md) != 1) {
|
||||
fprintf(stderr, "BIO_set_md failed.\n");
|
||||
goto cleanup;
|
||||
}
|
||||
@ -89,9 +89,9 @@ int main(int argc, char * argv[])
|
||||
* We will use BIO chaining so that as we read, the digest gets updated
|
||||
* See the man page for BIO_push
|
||||
*/
|
||||
BIO *reading = BIO_push( bio_digest, input );
|
||||
|
||||
while( BIO_read(reading, buffer, sizeof(buffer)) > 0 )
|
||||
BIO *reading = BIO_push(bio_digest, input);
|
||||
|
||||
while (BIO_read(reading, buffer, sizeof(buffer)) > 0)
|
||||
;
|
||||
|
||||
/*-
|
||||
@ -102,12 +102,12 @@ int main(int argc, char * argv[])
|
||||
fprintf(stderr, "BIO_gets(bio_digest) failed\n");
|
||||
goto cleanup;
|
||||
}
|
||||
for (j=0; j<digest_size; j++) {
|
||||
for (j = 0; j < digest_size; j++) {
|
||||
fprintf(stdout, "%02x", (unsigned char)digest_value[j]);
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
result = 0;
|
||||
|
||||
|
||||
cleanup:
|
||||
if (result != 0)
|
||||
ERR_print_errors_fp(stderr);
|
||||
|
@ -124,7 +124,7 @@ cleanup:
|
||||
int main(void)
|
||||
{
|
||||
int result = 1;
|
||||
BIO *input = BIO_new_fd( fileno(stdin), 1 );
|
||||
BIO *input = BIO_new_fd(fileno(stdin), 1);
|
||||
|
||||
if (input != NULL) {
|
||||
result = demonstrate_digest(input);
|
||||
|
@ -35,7 +35,7 @@ static unsigned char password[] = {
|
||||
static unsigned char pbkdf2_salt[] = {
|
||||
'N', 'a', 'C', 'l'
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* The iteration parameter can be variable or hard coded. The disadvantage with
|
||||
* hard coding them is that they cannot easily be adjusted for future
|
||||
|
@ -787,7 +787,7 @@ static int bind_afalg(ENGINE *e)
|
||||
* now, as bind_aflag can only be called by one thread at a
|
||||
* time.
|
||||
*/
|
||||
for(i = 0; i < OSSL_NELEM(afalg_cipher_nids); i++) {
|
||||
for (i = 0; i < OSSL_NELEM(afalg_cipher_nids); i++) {
|
||||
if (afalg_aes_cbc(afalg_cipher_nids[i]) == NULL) {
|
||||
AFALGerr(AFALG_F_BIND_AFALG, AFALG_R_INIT_FAILED);
|
||||
return 0;
|
||||
@ -916,7 +916,7 @@ static int afalg_finish(ENGINE *e)
|
||||
static int free_cbc(void)
|
||||
{
|
||||
short unsigned int i;
|
||||
for(i = 0; i < OSSL_NELEM(afalg_cipher_nids); i++) {
|
||||
for (i = 0; i < OSSL_NELEM(afalg_cipher_nids); i++) {
|
||||
EVP_CIPHER_meth_free(cbc_handle[i]._hidden);
|
||||
cbc_handle[i]._hidden = NULL;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ static int capi_init(ENGINE *e)
|
||||
/* Setup RSA_METHOD */
|
||||
rsa_capi_idx = RSA_get_ex_new_index(0, NULL, NULL, NULL, 0);
|
||||
ossl_rsa_meth = RSA_PKCS1_OpenSSL();
|
||||
if ( !RSA_meth_set_pub_enc(capi_rsa_method,
|
||||
if (!RSA_meth_set_pub_enc(capi_rsa_method,
|
||||
RSA_meth_get_pub_enc(ossl_rsa_meth))
|
||||
|| !RSA_meth_set_pub_dec(capi_rsa_method,
|
||||
RSA_meth_get_pub_dec(ossl_rsa_meth))
|
||||
@ -444,7 +444,7 @@ static int capi_init(ENGINE *e)
|
||||
/* Setup DSA Method */
|
||||
dsa_capi_idx = DSA_get_ex_new_index(0, NULL, NULL, NULL, 0);
|
||||
ossl_dsa_meth = DSA_OpenSSL();
|
||||
if ( !DSA_meth_set_sign(capi_dsa_method, capi_dsa_do_sign)
|
||||
if (!DSA_meth_set_sign(capi_dsa_method, capi_dsa_do_sign)
|
||||
|| !DSA_meth_set_verify(capi_dsa_method,
|
||||
DSA_meth_get_verify(ossl_dsa_meth))
|
||||
|| !DSA_meth_set_finish(capi_dsa_method, capi_dsa_free)
|
||||
|
@ -633,7 +633,7 @@ static void dump_cipher_info(void)
|
||||
fprintf (stderr, "Cipher %s, NID=%d, /dev/crypto info: id=%d, ",
|
||||
name ? name : "unknown", cipher_data[i].nid,
|
||||
cipher_data[i].devcryptoid);
|
||||
if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION ) {
|
||||
if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION) {
|
||||
fprintf (stderr, "CIOCGSESSION (session open call) failed\n");
|
||||
continue;
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ static int ossltest_aes128_gcm_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case EVP_CTRL_AEAD_GET_TAG:
|
||||
/* Always give the same tag */
|
||||
memset(ptr, 0, EVP_GCM_TLS_TAG_LEN);
|
||||
|
@ -85,7 +85,7 @@ typedef enum {
|
||||
*/
|
||||
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
|
||||
/*
|
||||
* The same as CT_POLICY_EVAL_CTX_new_ex() but the default library
|
||||
* context and property query string is used.
|
||||
|
@ -62,7 +62,7 @@ void ossl_prov_cleanup_entropy(PROV_CTX *prov_ctx, unsigned char *buf,
|
||||
|
||||
size_t ossl_prov_get_nonce(PROV_CTX *prov_ctx, unsigned char **pout,
|
||||
size_t min_len, size_t max_len,
|
||||
const void *salt,size_t salt_len)
|
||||
const void *salt, size_t salt_len)
|
||||
{
|
||||
if (c_get_nonce == NULL)
|
||||
return 0;
|
||||
|
@ -193,7 +193,7 @@ const OSSL_DISPATCH ossl_chacha20_functions[] = {
|
||||
{ OSSL_FUNC_CIPHER_FINAL, (void (*)(void))chacha20_final },
|
||||
{ OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))chacha20_cipher},
|
||||
{ OSSL_FUNC_CIPHER_GET_PARAMS, (void (*)(void))chacha20_get_params },
|
||||
{ OSSL_FUNC_CIPHER_GETTABLE_PARAMS,(void (*)(void))chacha20_gettable_params },
|
||||
{ OSSL_FUNC_CIPHER_GETTABLE_PARAMS, (void (*)(void))chacha20_gettable_params },
|
||||
{ OSSL_FUNC_CIPHER_GET_CTX_PARAMS, (void (*)(void))chacha20_get_ctx_params },
|
||||
{ OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS,
|
||||
(void (*)(void))chacha20_gettable_ctx_params },
|
||||
|
@ -110,7 +110,7 @@ int ossl_cipher_unpadblock(unsigned char *buf, size_t *buflen, size_t blocksize)
|
||||
size_t pad, i;
|
||||
size_t len = *buflen;
|
||||
|
||||
if(len != blocksize) {
|
||||
if (len != blocksize) {
|
||||
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ typedef int write_bio_of_void_fn(BIO *bp, const void *x);
|
||||
/* Free the blob allocated during key_to_paramstring_fn */
|
||||
static void free_asn1_data(int type, void *data)
|
||||
{
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case V_ASN1_OBJECT:
|
||||
ASN1_OBJECT_free(data);
|
||||
break;
|
||||
|
@ -460,7 +460,7 @@ static int dh_get_ctx_params(void *vpdhctx, OSSL_PARAM params[])
|
||||
if (p != NULL
|
||||
&& !OSSL_PARAM_set_utf8_string(p, pdhctx->kdf_md == NULL
|
||||
? ""
|
||||
: EVP_MD_get0_name(pdhctx->kdf_md))){
|
||||
: EVP_MD_get0_name(pdhctx->kdf_md))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ int ecdh_get_ctx_params(void *vpecdhctx, OSSL_PARAM params[])
|
||||
if (p != NULL
|
||||
&& !OSSL_PARAM_set_utf8_string(p, pectx->kdf_md == NULL
|
||||
? ""
|
||||
: EVP_MD_get0_name(pectx->kdf_md))){
|
||||
: EVP_MD_get0_name(pectx->kdf_md))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -450,7 +450,7 @@ int ecdh_plain_derive(void *vpecdhctx, unsigned char *secret,
|
||||
}
|
||||
|
||||
if ((group = EC_KEY_get0_group(pecdhctx->k)) == NULL
|
||||
|| (cofactor = EC_GROUP_get0_cofactor(group)) == NULL )
|
||||
|| (cofactor = EC_GROUP_get0_cofactor(group)) == NULL)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
|
@ -185,7 +185,7 @@ static int kdf_pbkdf1_set_ctx_params(void *vctx, const OSSL_PARAM params[])
|
||||
return 0;
|
||||
|
||||
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SALT)) != NULL)
|
||||
if (!kdf_pbkdf1_set_membuf(&ctx->salt, &ctx->salt_len,p))
|
||||
if (!kdf_pbkdf1_set_membuf(&ctx->salt, &ctx->salt_len, p))
|
||||
return 0;
|
||||
|
||||
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_ITER)) != NULL)
|
||||
|
@ -194,7 +194,7 @@ static int kdf_pbkdf2_set_ctx_params(void *vctx, const OSSL_PARAM params[])
|
||||
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SALT_LENGTH);
|
||||
return 0;
|
||||
}
|
||||
if (!pbkdf2_set_membuf(&ctx->salt, &ctx->salt_len,p))
|
||||
if (!pbkdf2_set_membuf(&ctx->salt, &ctx->salt_len, p))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ static int kdf_pkcs12_set_ctx_params(void *vctx, const OSSL_PARAM params[])
|
||||
return 0;
|
||||
|
||||
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SALT)) != NULL)
|
||||
if (!pkcs12kdf_set_membuf(&ctx->salt, &ctx->salt_len,p))
|
||||
if (!pkcs12kdf_set_membuf(&ctx->salt, &ctx->salt_len, p))
|
||||
return 0;
|
||||
|
||||
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_PKCS12_ID)) != NULL)
|
||||
|
@ -173,7 +173,7 @@ static int kdf_pvk_set_ctx_params(void *vctx, const OSSL_PARAM params[])
|
||||
return 0;
|
||||
|
||||
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SALT)) != NULL) {
|
||||
if (!pvk_set_membuf(&ctx->salt, &ctx->salt_len,p))
|
||||
if (!pvk_set_membuf(&ctx->salt, &ctx->salt_len, p))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ int key_to_params(const EC_KEY *eckey, OSSL_PARAM_BLD *tmpl,
|
||||
ecbits = EC_GROUP_order_bits(ecg);
|
||||
if (ecbits <= 0)
|
||||
goto err;
|
||||
sz = (ecbits + 7 ) / 8;
|
||||
sz = (ecbits + 7) / 8;
|
||||
|
||||
if (!ossl_param_build_set_bn_pad(tmpl, params,
|
||||
OSSL_PKEY_PARAM_PRIV_KEY,
|
||||
|
@ -113,7 +113,7 @@ static int hash_df(PROV_DRBG *drbg, unsigned char *out,
|
||||
memcpy(out, vtmp, outlen);
|
||||
OPENSSL_cleanse(vtmp, hash->blocklen);
|
||||
break;
|
||||
} else if(!EVP_DigestFinal(ctx, out, NULL)) {
|
||||
} else if (!EVP_DigestFinal(ctx, out, NULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ static int hash_gen(PROV_DRBG *drbg, unsigned char *out, size_t outlen)
|
||||
if (outlen == 0)
|
||||
return 1;
|
||||
memcpy(hash->vtmp, hash->V, drbg->seedlen);
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
if (!EVP_DigestInit_ex(hash->ctx, ossl_prov_digest_md(&hash->digest),
|
||||
NULL)
|
||||
|| !EVP_DigestUpdate(hash->ctx, hash->vtmp, drbg->seedlen))
|
||||
|
@ -176,7 +176,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
|
||||
/* Get wall clock time, take 8 bits. */
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
v = (unsigned char)(ts.tv_nsec & 0xFF);
|
||||
ossl_rand_pool_add(pool, arg, &v, sizeof(v) , 2);
|
||||
ossl_rand_pool_add(pool, arg, &v, sizeof(v), 2);
|
||||
}
|
||||
return ossl_rand_pool_entropy_available(pool);
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ size_t data_collect_method(RAND_POOL *pool)
|
||||
uint32_t status;
|
||||
uint32_t efn;
|
||||
IOSB iosb;
|
||||
$DESCRIPTOR(SYSDEVICE,"SYS$SYSDEVICE:");
|
||||
$DESCRIPTOR(SYSDEVICE, "SYS$SYSDEVICE:");
|
||||
|
||||
if ((status = sys$getdviw(EFN$C_ENF, 0, &SYSDEVICE, DVI_items,
|
||||
0, 0, 0, 0, 0)) != SS$_NORMAL) {
|
||||
|
@ -136,7 +136,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
|
||||
RANDOM_NUM_GEN_STATUS status = randStatus();
|
||||
|
||||
if ((status == RANDOM_NUM_GEN_ENOUGH_ENTROPY)
|
||||
|| (status == RANDOM_NUM_GEN_MAX_ENTROPY) ) {
|
||||
|| (status == RANDOM_NUM_GEN_MAX_ENTROPY)) {
|
||||
result = randBytes(buffer, bytes_needed);
|
||||
if (result == OK)
|
||||
ossl_rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed);
|
||||
|
@ -124,7 +124,7 @@ static int rsa_check_padding(const PROV_RSA_CTX *prsactx,
|
||||
const char *mdname, const char *mgf1_mdname,
|
||||
int mdnid)
|
||||
{
|
||||
switch(prsactx->pad_mode) {
|
||||
switch (prsactx->pad_mode) {
|
||||
case RSA_NO_PADDING:
|
||||
if (mdname != NULL || mdnid != NID_undef) {
|
||||
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PADDING_MODE);
|
||||
@ -196,7 +196,7 @@ static void *rsa_newctx(void *provctx, const char *propq)
|
||||
static int rsa_pss_compute_saltlen(PROV_RSA_CTX *ctx)
|
||||
{
|
||||
int saltlen = ctx->saltlen;
|
||||
|
||||
|
||||
if (saltlen == RSA_PSS_SALTLEN_DIGEST) {
|
||||
saltlen = EVP_MD_get_size(ctx->md);
|
||||
} else if (saltlen == RSA_PSS_SALTLEN_AUTO || saltlen == RSA_PSS_SALTLEN_MAX) {
|
||||
@ -232,7 +232,7 @@ static unsigned char *rsa_generate_signature_aid(PROV_RSA_CTX *ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch(ctx->pad_mode) {
|
||||
switch (ctx->pad_mode) {
|
||||
case RSA_PKCS1_PADDING:
|
||||
ret = ossl_DER_w_algorithmIdentifier_MDWithRSAEncryption(&pkt, -1,
|
||||
ctx->mdnid);
|
||||
|
@ -49,7 +49,7 @@ int dtls1_dispatch_alert(SSL *s)
|
||||
i = do_dtls1_write(s, SSL3_RT_ALERT, &buf[0], sizeof(buf), 0, &written);
|
||||
if (i <= 0) {
|
||||
s->s3.alert_dispatch = 1;
|
||||
/* fprintf( stderr, "not done with alert\n" ); */
|
||||
/* fprintf(stderr, "not done with alert\n"); */
|
||||
} else {
|
||||
(void)BIO_flush(s->wbio);
|
||||
|
||||
|
@ -812,7 +812,7 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey,
|
||||
const SSL_CIPHER *cp;
|
||||
int reverse = 0;
|
||||
|
||||
OSSL_TRACE_BEGIN(TLS_CIPHER){
|
||||
OSSL_TRACE_BEGIN(TLS_CIPHER) {
|
||||
BIO_printf(trc_out,
|
||||
"Applying rule %d with %08x/%08x/%08x/%08x/%08x %08x (%d)\n",
|
||||
rule, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls,
|
||||
@ -1001,7 +1001,7 @@ static int ssl_cipher_process_rulestr(const char *rule_str,
|
||||
|
||||
retval = 1;
|
||||
l = rule_str;
|
||||
for ( ; ; ) {
|
||||
for (;;) {
|
||||
ch = *l;
|
||||
|
||||
if (ch == '\0')
|
||||
|
@ -35,7 +35,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_ssl_base)
|
||||
SSL_COMP_get_compression_methods();
|
||||
#endif
|
||||
ssl_sort_cipher_list();
|
||||
OSSL_TRACE(INIT,"ossl_init_ssl_base: SSL_add_ssl_module()\n");
|
||||
OSSL_TRACE(INIT, "ossl_init_ssl_base: SSL_add_ssl_module()\n");
|
||||
/*
|
||||
* We ignore an error return here. Not much we can do - but not that bad
|
||||
* either. We can still safely continue.
|
||||
|
@ -3939,7 +3939,7 @@ const SSL_METHOD *ssl_bad_method(int ver)
|
||||
|
||||
const char *ssl_protocol_to_string(int version)
|
||||
{
|
||||
switch(version)
|
||||
switch (version)
|
||||
{
|
||||
case TLS1_3_VERSION:
|
||||
return "TLSv1.3";
|
||||
|
@ -1017,7 +1017,7 @@ int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_PSK
|
||||
if(sess == NULL
|
||||
if (sess == NULL
|
||||
&& s->psk_server_callback != NULL
|
||||
&& idlen <= PSK_MAX_IDENTITY_LEN) {
|
||||
char *pskid = NULL;
|
||||
|
@ -3198,7 +3198,7 @@ static int tls_construct_cke_gost18(SSL *s, WPACKET *pkt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (EVP_PKEY_encrypt_init(pkey_ctx) <= 0 ) {
|
||||
if (EVP_PKEY_encrypt_init(pkey_ctx) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
};
|
||||
|
@ -1707,7 +1707,7 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
s->s3.send_connection_binding = 0;
|
||||
/* Check what signalling cipher-suite values were received. */
|
||||
if (scsvs != NULL) {
|
||||
for(i = 0; i < sk_SSL_CIPHER_num(scsvs); i++) {
|
||||
for (i = 0; i < sk_SSL_CIPHER_num(scsvs); i++) {
|
||||
c = sk_SSL_CIPHER_value(scsvs, i);
|
||||
if (SSL_CIPHER_get_id(c) == SSL3_CK_SCSV) {
|
||||
if (s->renegotiate) {
|
||||
|
@ -640,7 +640,7 @@ int tls13_change_cipher_state(SSL *s, int which)
|
||||
}
|
||||
|
||||
/* check whether cipher is known */
|
||||
if(!ossl_assert(cipher != NULL))
|
||||
if (!ossl_assert(cipher != NULL))
|
||||
goto err;
|
||||
|
||||
if (!derive_secret_key_and_iv(s, which & SSL3_CC_WRITE, md, cipher,
|
||||
|
@ -465,7 +465,7 @@ int setup_tests(void)
|
||||
# endif
|
||||
|
||||
while ((o = opt_next()) != OPT_EOF) {
|
||||
switch(o) {
|
||||
switch (o) {
|
||||
case OPT_PRINT:
|
||||
print_test_data();
|
||||
return 1;
|
||||
|
@ -172,7 +172,7 @@ static int do_bio_cipher(const EVP_CIPHER* cipher, const unsigned char* key,
|
||||
|
||||
static int do_test_bio_cipher(const EVP_CIPHER* cipher, int idx)
|
||||
{
|
||||
switch(idx)
|
||||
switch (idx)
|
||||
{
|
||||
case 0:
|
||||
return do_bio_cipher(cipher, KEY, NULL);
|
||||
|
@ -712,7 +712,7 @@ static int test_gf2m_add(void)
|
||||
|
||||
static int test_gf2m_mod(void)
|
||||
{
|
||||
BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL, *e = NULL;
|
||||
BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL, *e = NULL;
|
||||
int i, j, st = 0;
|
||||
|
||||
if (!TEST_ptr(a = BN_new())
|
||||
@ -805,7 +805,7 @@ static int test_gf2m_mul(void)
|
||||
|
||||
static int test_gf2m_sqr(void)
|
||||
{
|
||||
BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL;
|
||||
int i, j, st = 0;
|
||||
|
||||
if (!TEST_ptr(a = BN_new())
|
||||
@ -844,7 +844,7 @@ static int test_gf2m_sqr(void)
|
||||
|
||||
static int test_gf2m_modinv(void)
|
||||
{
|
||||
BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL;
|
||||
int i, j, st = 0;
|
||||
|
||||
if (!TEST_ptr(a = BN_new())
|
||||
@ -881,7 +881,7 @@ static int test_gf2m_modinv(void)
|
||||
|
||||
static int test_gf2m_moddiv(void)
|
||||
{
|
||||
BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *e = NULL, *f = NULL;
|
||||
int i, j, st = 0;
|
||||
|
||||
@ -925,7 +925,7 @@ static int test_gf2m_moddiv(void)
|
||||
|
||||
static int test_gf2m_modexp(void)
|
||||
{
|
||||
BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *e = NULL, *f = NULL;
|
||||
int i, j, st = 0;
|
||||
|
||||
@ -973,7 +973,7 @@ static int test_gf2m_modexp(void)
|
||||
|
||||
static int test_gf2m_modsqrt(void)
|
||||
{
|
||||
BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *e = NULL, *f = NULL;
|
||||
int i, j, st = 0;
|
||||
|
||||
@ -1018,7 +1018,7 @@ static int test_gf2m_modsqrt(void)
|
||||
|
||||
static int test_gf2m_modsolvequad(void)
|
||||
{
|
||||
BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL;
|
||||
BIGNUM *e = NULL;
|
||||
int i, j, s = 0, t, st = 0;
|
||||
|
||||
@ -1757,7 +1757,7 @@ static int test_bn2padded(void)
|
||||
# define BOTTOM_BIT_NOTOUCH 0
|
||||
if (!TEST_true(BN_rand(n, bytes * 8, TOP_BIT_ON, BOTTOM_BIT_NOTOUCH)))
|
||||
goto err;
|
||||
if (!TEST_int_eq(BN_num_bytes(n),A) bytes
|
||||
if (!TEST_int_eq(BN_num_bytes(n), A) bytes
|
||||
|| TEST_int_eq(BN_bn2bin(n, reference), bytes))
|
||||
goto err;
|
||||
/* Empty buffer should fail. */
|
||||
|
@ -91,7 +91,7 @@ static int test_client_hello(int currtest)
|
||||
if (!TEST_true(SSL_CTX_set_max_proto_version(ctx, 0)))
|
||||
goto end;
|
||||
|
||||
switch(currtest) {
|
||||
switch (currtest) {
|
||||
case TEST_SET_SESSION_TICK_DATA_VER_NEG:
|
||||
#if !defined(OPENSSL_NO_TLS1_3) && defined(OPENSSL_NO_TLS1_2)
|
||||
/* TLSv1.3 is enabled and TLSv1.2 is disabled so can't do this test */
|
||||
|
@ -85,9 +85,9 @@ static int test_binary_op_s(size_t (*op) (size_t a, size_t b),
|
||||
const char *op_name, size_t a, size_t b,
|
||||
int is_true)
|
||||
{
|
||||
if (is_true && !TEST_size_t_eq(op(a,b), CONSTTIME_TRUE_S))
|
||||
if (is_true && !TEST_size_t_eq(op(a, b), CONSTTIME_TRUE_S))
|
||||
return 0;
|
||||
if (!is_true && !TEST_uint_eq(op(a,b), CONSTTIME_FALSE_S))
|
||||
if (!is_true && !TEST_uint_eq(op(a, b), CONSTTIME_FALSE_S))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ int setup_tests(void)
|
||||
}
|
||||
|
||||
argc = test_get_argument_count();
|
||||
switch(argc) {
|
||||
switch (argc) {
|
||||
case 0:
|
||||
is_fips = 0;
|
||||
bad_fips = 0;
|
||||
|
@ -577,7 +577,7 @@ static int rfc5114_test(void)
|
||||
|
||||
if (!TEST_ptr(priv_key = BN_bin2bn(td->xB, td->xB_len, NULL))
|
||||
|| !TEST_ptr(pub_key = BN_bin2bn(td->yB, td->yB_len, NULL))
|
||||
|| !TEST_true( DH_set0_key(dhB, pub_key, priv_key)))
|
||||
|| !TEST_true(DH_set0_key(dhB, pub_key, priv_key)))
|
||||
goto bad_err;
|
||||
priv_key = pub_key = NULL;
|
||||
|
||||
|
@ -2861,11 +2861,11 @@ static int custom_params_test(int id)
|
||||
goto err;
|
||||
|
||||
/* create two `EVP_PKEY`s from the `EC_KEY`s */
|
||||
if(!TEST_ptr(pkey1 = EVP_PKEY_new())
|
||||
if (!TEST_ptr(pkey1 = EVP_PKEY_new())
|
||||
|| !TEST_int_eq(EVP_PKEY_assign_EC_KEY(pkey1, eckey1), 1))
|
||||
goto err;
|
||||
eckey1 = NULL; /* ownership passed to pkey1 */
|
||||
if(!TEST_ptr(pkey2 = EVP_PKEY_new())
|
||||
if (!TEST_ptr(pkey2 = EVP_PKEY_new())
|
||||
|| !TEST_int_eq(EVP_PKEY_assign_EC_KEY(pkey2, eckey2), 1))
|
||||
goto err;
|
||||
eckey2 = NULL; /* ownership passed to pkey2 */
|
||||
|
@ -1021,7 +1021,7 @@ static int test_EVP_PKEY_sign(int tst)
|
||||
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13
|
||||
};
|
||||
|
||||
if (tst == 0 ) {
|
||||
if (tst == 0) {
|
||||
if (!TEST_ptr(pkey = load_example_rsa_key()))
|
||||
goto out;
|
||||
} else if (tst == 1) {
|
||||
@ -2882,7 +2882,7 @@ static int test_evp_iv_aes(int idx)
|
||||
if (nullprov != NULL && idx < 6)
|
||||
return TEST_skip("Test does not support a non-default library context");
|
||||
|
||||
switch(idx) {
|
||||
switch (idx) {
|
||||
case 0:
|
||||
type = EVP_aes_128_cbc();
|
||||
/* FALLTHROUGH */
|
||||
@ -3026,7 +3026,7 @@ static int test_evp_iv_des(int idx)
|
||||
if (lgcyprov == NULL && idx < 3)
|
||||
return TEST_skip("Test requires legacy provider to be loaded");
|
||||
|
||||
switch(idx) {
|
||||
switch (idx) {
|
||||
case 0:
|
||||
type = EVP_CIPHER_fetch(testctx, "des-cbc", testpropq);
|
||||
ref_iv = cbc_state_des;
|
||||
@ -3300,7 +3300,7 @@ static const EVP_INIT_TEST_st evp_init_tests[] = {
|
||||
static int evp_init_seq_set_iv(EVP_CIPHER_CTX *ctx, const EVP_INIT_TEST_st *t)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
|
||||
if (t->ivlen != 0) {
|
||||
if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen, NULL)))
|
||||
goto err;
|
||||
@ -3817,7 +3817,7 @@ static int test_custom_pmeth(int idx)
|
||||
if (testctx != NULL)
|
||||
return 1;
|
||||
|
||||
switch(idx) {
|
||||
switch (idx) {
|
||||
case 0:
|
||||
case 6:
|
||||
id = EVP_PKEY_RSA;
|
||||
|
@ -1496,7 +1496,7 @@ static int test_kdf_sshkdf(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int test_kdfs_same( EVP_KDF *kdf1, EVP_KDF *kdf2)
|
||||
static int test_kdfs_same(EVP_KDF *kdf1, EVP_KDF *kdf2)
|
||||
{
|
||||
/* Fast path in case the two are the same algorithm pointer */
|
||||
if (kdf1 == kdf2)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user