mirror of https://github.com/openssl/openssl
Enable some disabled __owurs
Fixes #15902 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/15905)
This commit is contained in:
parent
1bb5ce7a33
commit
98283a61f5
|
@ -1017,7 +1017,8 @@ int cms_main(int argc, char **argv)
|
|||
&& wrap_cipher != NULL) {
|
||||
EVP_CIPHER_CTX *wctx;
|
||||
wctx = CMS_RecipientInfo_kari_get0_ctx(ri);
|
||||
EVP_EncryptInit_ex(wctx, wrap_cipher, NULL, NULL, NULL);
|
||||
if (EVP_EncryptInit_ex(wctx, wrap_cipher, NULL, NULL, NULL) != 1)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
74
apps/speed.c
74
apps/speed.c
|
@ -757,7 +757,7 @@ static int EVP_Update_loop(void *args)
|
|||
rc = EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
if (rc != 1) {
|
||||
/* reset iv in case of counter overflow */
|
||||
(void)EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1);
|
||||
rc = EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -765,14 +765,17 @@ static int EVP_Update_loop(void *args)
|
|||
rc = EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
if (rc != 1) {
|
||||
/* reset iv in case of counter overflow */
|
||||
(void)EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1);
|
||||
rc = EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (decrypt)
|
||||
EVP_DecryptFinal_ex(ctx, buf, &outl);
|
||||
rc = EVP_DecryptFinal_ex(ctx, buf, &outl);
|
||||
else
|
||||
EVP_EncryptFinal_ex(ctx, buf, &outl);
|
||||
rc = EVP_EncryptFinal_ex(ctx, buf, &outl);
|
||||
|
||||
if (rc <= 1)
|
||||
BIO_printf(bio_err, "Error finalizing cipher loop\n");
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -786,31 +789,36 @@ static int EVP_Update_loop_ccm(void *args)
|
|||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
unsigned char *buf = tempargs->buf;
|
||||
EVP_CIPHER_CTX *ctx = tempargs->ctx;
|
||||
int outl, count;
|
||||
int outl, count, realcount = 0, final;
|
||||
unsigned char tag[12];
|
||||
|
||||
if (decrypt) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
(void)EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag),
|
||||
tag);
|
||||
/* reset iv */
|
||||
(void)EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
/* counter is reset on every update */
|
||||
(void)EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag),
|
||||
tag) > 0
|
||||
/* reset iv */
|
||||
&& EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv) > 0
|
||||
/* counter is reset on every update */
|
||||
&& EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]) > 0)
|
||||
realcount++;
|
||||
}
|
||||
} else {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
/* restore iv length field */
|
||||
(void)EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);
|
||||
/* counter is reset on every update */
|
||||
(void)EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
if (EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]) > 0
|
||||
/* counter is reset on every update */
|
||||
&& EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]) > 0)
|
||||
realcount++;
|
||||
}
|
||||
}
|
||||
if (decrypt)
|
||||
(void)EVP_DecryptFinal_ex(ctx, buf, &outl);
|
||||
final = EVP_DecryptFinal_ex(ctx, buf, &outl);
|
||||
else
|
||||
(void)EVP_EncryptFinal_ex(ctx, buf, &outl);
|
||||
return count;
|
||||
final = EVP_EncryptFinal_ex(ctx, buf, &outl);
|
||||
|
||||
if (final <= 1)
|
||||
BIO_printf(bio_err, "Error finalizing ccm loop\n");
|
||||
return realcount;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -823,28 +831,30 @@ static int EVP_Update_loop_aead(void *args)
|
|||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
unsigned char *buf = tempargs->buf;
|
||||
EVP_CIPHER_CTX *ctx = tempargs->ctx;
|
||||
int outl, count;
|
||||
int outl, count, realcount = 0;
|
||||
unsigned char aad[13] = { 0xcc };
|
||||
unsigned char faketag[16] = { 0xcc };
|
||||
|
||||
if (decrypt) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
(void)EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
(void)EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
|
||||
sizeof(faketag), faketag);
|
||||
(void)EVP_DecryptUpdate(ctx, NULL, &outl, aad, sizeof(aad));
|
||||
(void)EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
(void)EVP_DecryptFinal_ex(ctx, buf + outl, &outl);
|
||||
if (EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv) > 0
|
||||
&& EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
|
||||
sizeof(faketag), faketag) > 0
|
||||
&& EVP_DecryptUpdate(ctx, NULL, &outl, aad, sizeof(aad)) > 0
|
||||
&& EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]) > 0
|
||||
&& EVP_DecryptFinal_ex(ctx, buf + outl, &outl) >0)
|
||||
realcount++;
|
||||
}
|
||||
} else {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
(void)EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
(void)EVP_EncryptUpdate(ctx, NULL, &outl, aad, sizeof(aad));
|
||||
(void)EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
(void)EVP_EncryptFinal_ex(ctx, buf + outl, &outl);
|
||||
if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) > 0
|
||||
&& EVP_EncryptUpdate(ctx, NULL, &outl, aad, sizeof(aad)) > 0
|
||||
&& EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]) > 0
|
||||
&& EVP_EncryptFinal_ex(ctx, buf + outl, &outl) > 0)
|
||||
realcount++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
return realcount;
|
||||
}
|
||||
|
||||
static long rsa_c[RSA_NUM][2]; /* # RSA iteration test */
|
||||
|
@ -3663,7 +3673,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single,
|
|||
static const int mblengths_list[] =
|
||||
{ 8 * 1024, 2 * 8 * 1024, 4 * 8 * 1024, 8 * 8 * 1024, 8 * 16 * 1024 };
|
||||
const int *mblengths = mblengths_list;
|
||||
int j, count, keylen, num = OSSL_NELEM(mblengths_list);
|
||||
int j, count, keylen, num = OSSL_NELEM(mblengths_list), ciph_success = 1;
|
||||
const char *alg_name;
|
||||
unsigned char *inp = NULL, *out = NULL, *key, no_key[32], no_iv[16];
|
||||
EVP_CIPHER_CTX *ctx = NULL;
|
||||
|
@ -3737,12 +3747,14 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single,
|
|||
aad[12] = (unsigned char)(len);
|
||||
pad = EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_TLS1_AAD,
|
||||
EVP_AEAD_TLS1_AAD_LEN, aad);
|
||||
EVP_Cipher(ctx, out, inp, len + pad);
|
||||
ciph_success = EVP_Cipher(ctx, out, inp, len + pad);
|
||||
}
|
||||
}
|
||||
d = Time_F(STOP);
|
||||
BIO_printf(bio_err, mr ? "+R:%d:%s:%f\n"
|
||||
: "%d %s's in %.2fs\n", count, "evp", d);
|
||||
if ((ciph_success <= 0) && (mr == 0))
|
||||
BIO_printf(bio_err, "Error performing cipher op\n");
|
||||
results[D_EVP][j] = ((double)count) / d * mblengths[j];
|
||||
}
|
||||
|
||||
|
|
|
@ -673,7 +673,7 @@ void BIO_set_md(BIO *, const EVP_MD *md);
|
|||
# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
|
||||
# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(c_pp))
|
||||
|
||||
/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c,
|
||||
__owur int EVP_Cipher(EVP_CIPHER_CTX *c,
|
||||
unsigned char *out,
|
||||
const unsigned char *in, unsigned int inl);
|
||||
|
||||
|
@ -751,7 +751,7 @@ int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags);
|
|||
|
||||
__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
||||
const unsigned char *key, const unsigned char *iv);
|
||||
/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,
|
||||
__owur int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,
|
||||
const EVP_CIPHER *cipher, ENGINE *impl,
|
||||
const unsigned char *key,
|
||||
const unsigned char *iv);
|
||||
|
@ -759,16 +759,16 @@ __owur int EVP_EncryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
|||
const unsigned char *key,
|
||||
const unsigned char *iv,
|
||||
const OSSL_PARAM params[]);
|
||||
/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
__owur int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl, const unsigned char *in, int inl);
|
||||
/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
__owur int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl);
|
||||
/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
__owur int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl);
|
||||
|
||||
__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
||||
const unsigned char *key, const unsigned char *iv);
|
||||
/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,
|
||||
__owur int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,
|
||||
const EVP_CIPHER *cipher, ENGINE *impl,
|
||||
const unsigned char *key,
|
||||
const unsigned char *iv);
|
||||
|
@ -776,17 +776,17 @@ __owur int EVP_DecryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
|||
const unsigned char *key,
|
||||
const unsigned char *iv,
|
||||
const OSSL_PARAM params[]);
|
||||
/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
__owur int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl, const unsigned char *in, int inl);
|
||||
__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
||||
int *outl);
|
||||
/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
||||
__owur int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
||||
int *outl);
|
||||
|
||||
__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
||||
const unsigned char *key, const unsigned char *iv,
|
||||
int enc);
|
||||
/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,
|
||||
__owur int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,
|
||||
const EVP_CIPHER *cipher, ENGINE *impl,
|
||||
const unsigned char *key,
|
||||
const unsigned char *iv, int enc);
|
||||
|
@ -820,18 +820,18 @@ __owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret,
|
|||
size_t siglen, const unsigned char *tbs,
|
||||
size_t tbslen);
|
||||
|
||||
int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
__owur int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
const char *mdname, OSSL_LIB_CTX *libctx,
|
||||
const char *props, EVP_PKEY *pkey,
|
||||
const OSSL_PARAM params[]);
|
||||
/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
__owur int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
const EVP_MD *type, ENGINE *e,
|
||||
EVP_PKEY *pkey);
|
||||
int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize);
|
||||
__owur int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize);
|
||||
__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
|
||||
size_t *siglen);
|
||||
|
||||
int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
__owur int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
const char *mdname, OSSL_LIB_CTX *libctx,
|
||||
const char *props, EVP_PKEY *pkey,
|
||||
const OSSL_PARAM params[]);
|
||||
|
|
Loading…
Reference in New Issue