Update pre9
This commit is contained in:
+12
-14
@@ -24,7 +24,6 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/lhash.h>
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
# include <openssl/rsa.h>
|
||||
@@ -177,21 +176,22 @@ static void exts_cleanup(OPENSSL_STRING *x)
|
||||
static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv)
|
||||
{
|
||||
char *p;
|
||||
size_t off;
|
||||
|
||||
/* Check syntax. */
|
||||
if (strchr(kv, '=') == NULL)
|
||||
return 1;
|
||||
|
||||
/* Skip leading whitespace, make a copy. */
|
||||
while (*kv && isspace(*kv))
|
||||
if (*++kv == '\0')
|
||||
return 1;
|
||||
if ((p = strchr(kv, '=')) == NULL)
|
||||
return 1;
|
||||
off = p - kv;
|
||||
if ((kv = OPENSSL_strdup(kv)) == NULL)
|
||||
return -1;
|
||||
|
||||
/* Skip trailing space before the equal sign. */
|
||||
for (p = strchr(kv, '='); p > kv; --p)
|
||||
if (p[-1] != ' ' && p[-1] != '\t')
|
||||
for (p = kv + off; p > kv; --p)
|
||||
if (!isspace(p[-1]))
|
||||
break;
|
||||
if (p == kv) {
|
||||
OPENSSL_free(kv);
|
||||
@@ -199,16 +199,13 @@ static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv)
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
/* Finally have a clean "key"; see if it's there. */
|
||||
if (lh_OPENSSL_STRING_retrieve(addexts, (OPENSSL_STRING*)kv) != NULL) {
|
||||
BIO_printf(bio_err, "Extension \"%s\" repeated\n", kv);
|
||||
OPENSSL_free(kv);
|
||||
return 1;
|
||||
/* Finally have a clean "key"; see if it's there [by attempt to add it]. */
|
||||
if ((p = (char *)lh_OPENSSL_STRING_insert(addexts, (OPENSSL_STRING*)kv))
|
||||
!= NULL || lh_OPENSSL_STRING_error(addexts)) {
|
||||
OPENSSL_free(p != NULL ? p : kv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Not found; add it. */
|
||||
if (lh_OPENSSL_STRING_insert(addexts, (OPENSSL_STRING*)kv) == NULL)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -950,6 +947,7 @@ int req_main(int argc, char **argv)
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
NCONF_free(req_conf);
|
||||
NCONF_free(addext_conf);
|
||||
BIO_free(addext_bio);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
|
||||
+15
-7
@@ -903,14 +903,18 @@ static int EVP_Update_loop(void *args)
|
||||
if (decrypt) {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
rc = EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
if (rc != 1)
|
||||
if (rc != 1) {
|
||||
/* reset iv in case of counter overflow */
|
||||
EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
rc = EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
if (rc != 1)
|
||||
if (rc != 1) {
|
||||
/* reset iv in case of counter overflow */
|
||||
EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (decrypt)
|
||||
@@ -937,20 +941,24 @@ static int EVP_Update_loop_ccm(void *args)
|
||||
#endif
|
||||
if (decrypt) {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag);
|
||||
EVP_DecryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);
|
||||
/* reset iv */
|
||||
EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
/* counter is reset on every update */
|
||||
EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
EVP_DecryptFinal_ex(ctx, buf, &outl);
|
||||
}
|
||||
} else {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
/* restore iv length field */
|
||||
EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);
|
||||
/* counter is reset on every update */
|
||||
EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
EVP_EncryptFinal_ex(ctx, buf, &outl);
|
||||
}
|
||||
}
|
||||
if (decrypt)
|
||||
EVP_DecryptFinal_ex(ctx, buf, &outl);
|
||||
else
|
||||
EVP_EncryptFinal_ex(ctx, buf, &outl);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user