summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
55f0eb1)
MSVC is not C99 compatible[1]. Errors:
test_ciphers.c(312,25): error C2057: expected constant expression
test_ciphers.c(312,25): error C2466: cannot allocate an array of constant size 0
test_ciphers.c(312,26): error C2133: 'c': unknown size
Link: https://docs.microsoft.com/en-us/cpp/c-language/ansi-conformance
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
#include <openssl/asn1.h>
#include <string.h>
#include <openssl/asn1.h>
#include <string.h>
+#if defined _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+#elif defined __linux__
+# include <alloca.h>
+#endif
+#include <stdlib.h>
+
#define T(e) ({ \
if (!(e)) {\
ERR_print_errors_fp(stderr);\
#define T(e) ({ \
if (!(e)) {\
ERR_print_errors_fp(stderr);\
static int test_block(const EVP_CIPHER *type, const char *name, int block_size,
const unsigned char *pt, const unsigned char *key, const unsigned char *exp,
static int test_block(const EVP_CIPHER *type, const char *name, int block_size,
const unsigned char *pt, const unsigned char *key, const unsigned char *exp,
- size_t size, const unsigned char *iv, size_t iv_size, int acpkm,
+ const size_t size, const unsigned char *iv, size_t iv_size, int acpkm,
int inplace)
{
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
const char *standard = acpkm? "R 23565.1.017-2018" : "GOST R 34.13-2015";
int inplace)
{
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
const char *standard = acpkm? "R 23565.1.017-2018" : "GOST R 34.13-2015";
+ unsigned char *c = alloca(size);
int outlen, tmplen;
int ret = 0, test;
int outlen, tmplen;
int ret = 0, test;
if (inplace)
memcpy(c, pt, size);
else
if (inplace)
memcpy(c, pt, size);
else
- memset(c, 0, sizeof(c));
if (acpkm) {
if (EVP_CIPHER_get0_provider(type) != NULL) {
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
if (acpkm) {
if (EVP_CIPHER_get0_provider(type) != NULL) {
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
if (inplace)
memcpy(c, pt, size);
else
if (inplace)
memcpy(c, pt, size);
else
- memset(c, 0, sizeof(c));
if (acpkm) {
if (EVP_CIPHER_get0_provider(type) != NULL) {
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
if (acpkm) {
if (EVP_CIPHER_get0_provider(type) != NULL) {
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
if (inplace)
memcpy(c, exp, size);
else
if (inplace)
memcpy(c, exp, size);
else
- memset(c, 0, sizeof(c));
if (acpkm) {
if (EVP_CIPHER_get0_provider(type) != NULL) {
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
if (acpkm) {
if (EVP_CIPHER_get0_provider(type) != NULL) {
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
static int test_stream(const EVP_CIPHER *type, const char *name,
const unsigned char *pt, const unsigned char *key, const unsigned char *exp,
static int test_stream(const EVP_CIPHER *type, const char *name,
const unsigned char *pt, const unsigned char *key, const unsigned char *exp,
- size_t size, const unsigned char *iv, size_t iv_size, int acpkm)
+ const size_t size, const unsigned char *iv, size_t iv_size, int acpkm)
{
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
const char *standard = acpkm? "R 23565.1.017-2018" : "GOST R 34.13-2015";
{
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
const char *standard = acpkm? "R 23565.1.017-2018" : "GOST R 34.13-2015";
+ unsigned char *c = alloca(size);
int ret = 0, test;
int z;
int ret = 0, test;
int z;
T(EVP_CIPHER_block_size(type) == 1);
for (z = 1; z <= size; z++) {
T(EVP_CIPHER_block_size(type) == 1);
for (z = 1; z <= size; z++) {
int outlen, tmplen;
int sz = 0;
int i;
int outlen, tmplen;
int sz = 0;
int i;
EVP_CIPHER_CTX_init(ctx);
T(EVP_CipherInit_ex(ctx, type, NULL, key, iv, 1));
T(EVP_CIPHER_CTX_set_padding(ctx, 0));
EVP_CIPHER_CTX_init(ctx);
T(EVP_CipherInit_ex(ctx, type, NULL, key, iv, 1));
T(EVP_CIPHER_CTX_set_padding(ctx, 0));
- memset(c, 0xff, sizeof(c));
if (acpkm) {
if (EVP_CIPHER_get0_provider(type) != NULL) {
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
if (acpkm) {
if (EVP_CIPHER_get0_provider(type) != NULL) {
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };