--- /dev/null
+/*
+ * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OSSL_INTERNAL_SIZES_H
+# define OSSL_INTERNAL_SIZES_H
+
+/*
+ * Max sizes used to allocate buffers with a fixed sizes, for example for
+ * stack allocations, structure fields, ...
+ */
+# define OSSL_MAX_NAME_SIZE 50 /* Algorithm name */
+# define OSSL_MAX_PROPQUERY_SIZE 256 /* Property query strings */
+
+#endif
/* Just for SSL_MAX_MASTER_KEY_LENGTH */
#include <openssl/ssl.h>
#include "internal/constant_time.h"
+#include "internal/sizes.h"
#include "crypto/rsa.h"
#include "prov/providercommonerr.h"
#include "prov/provider_ctx.h"
{
PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
const OSSL_PARAM *p;
- /* Should be big enough */
- char mdname[80], mdprops[80] = { '\0' };
+ char mdname[OSSL_MAX_NAME_SIZE];
+ char mdprops[OSSL_MAX_PROPQUERY_SIZE] = { '\0' };
char *str = mdname;
int pad_mode;
#include <openssl/dsa.h>
#include <openssl/params.h>
#include <openssl/evp.h>
+#include "internal/sizes.h"
#include "prov/implementations.h"
#include "prov/provider_ctx.h"
#include "crypto/dsa.h"
OPENSSL_CTX *libctx;
DSA *dsa;
size_t mdsize;
- /* Should be big enough */
- char mdname[80];
+ char mdname[OSSL_MAX_NAME_SIZE];
EVP_MD *md;
EVP_MD_CTX *mdctx;
} PROV_DSA_CTX;