Merge pull request #2777 from dgarske/constchar

Fixes for char strings not marked as const.
This commit is contained in:
toddouska
2020-02-03 11:12:55 -08:00
committed by GitHub
3 changed files with 19 additions and 19 deletions

View File

@ -21864,8 +21864,8 @@ int wolfSSL_X509_cmp(const WOLFSSL_X509 *a, const WOLFSSL_X509 *b)
/* print signature algo */ /* print signature algo */
{ {
int oid; int oid;
char* sig; const char* sig;
if ((oid = wolfSSL_X509_get_signature_type(x509)) <= 0) { if ((oid = wolfSSL_X509_get_signature_type(x509)) <= 0) {
WOLFSSL_MSG("Error getting x509 signature type"); WOLFSSL_MSG("Error getting x509 signature type");

View File

@ -496,56 +496,56 @@ static int GetInteger7Bit(const byte* input, word32* inOutIdx, word32 maxIdx)
#if !defined(NO_DSA) && !defined(NO_SHA) #if !defined(NO_DSA) && !defined(NO_SHA)
static char sigSha1wDsaName[] = "SHAwDSA"; static const char sigSha1wDsaName[] = "SHAwDSA";
#endif /* NO_DSA */ #endif /* NO_DSA */
#ifndef NO_RSA #ifndef NO_RSA
#ifdef WOLFSSL_MD2 #ifdef WOLFSSL_MD2
static char sigMd2wRsaName[] = "md2WithRSAEncryption"; static const char sigMd2wRsaName[] = "md2WithRSAEncryption";
#endif #endif
#ifndef NO_MD5 #ifndef NO_MD5
static char sigMd5wRsaName[] = "md5WithRSAEncryption"; static const char sigMd5wRsaName[] = "md5WithRSAEncryption";
#endif #endif
#ifndef NO_SHA #ifndef NO_SHA
static char sigSha1wRsaName[] = "sha1WithRSAEncryption"; static const char sigSha1wRsaName[] = "sha1WithRSAEncryption";
#endif #endif
#ifdef WOLFSSL_SHA224 #ifdef WOLFSSL_SHA224
static char sigSha224wRsaName[] = "sha224WithRSAEncryption"; static const char sigSha224wRsaName[] = "sha224WithRSAEncryption";
#endif #endif
#ifndef NO_SHA256 #ifndef NO_SHA256
static char sigSha256wRsaName[] = "sha256WithRSAEncryption"; static const char sigSha256wRsaName[] = "sha256WithRSAEncryption";
#endif #endif
#ifdef WOLFSSL_SHA384 #ifdef WOLFSSL_SHA384
static char sigSha384wRsaName[] = "sha384WithRSAEncryption"; static const char sigSha384wRsaName[] = "sha384WithRSAEncryption";
#endif #endif
#ifdef WOLFSSL_SHA512 #ifdef WOLFSSL_SHA512
static char sigSha512wRsaName[] = "sha512WithRSAEncryption"; static const char sigSha512wRsaName[] = "sha512WithRSAEncryption";
#endif #endif
#endif /* NO_RSA */ #endif /* NO_RSA */
#ifdef HAVE_ECC #ifdef HAVE_ECC
#ifndef NO_SHA #ifndef NO_SHA
static char sigSha1wEcdsaName[] = "SHAwECDSA"; static const char sigSha1wEcdsaName[] = "SHAwECDSA";
#endif #endif
#ifdef WOLFSSL_SHA224 #ifdef WOLFSSL_SHA224
static char sigSha224wEcdsaName[] = "SHA224wECDSA"; static const char sigSha224wEcdsaName[] = "SHA224wECDSA";
#endif #endif
#ifndef NO_SHA256 #ifndef NO_SHA256
static char sigSha256wEcdsaName[] = "SHA256wECDSA"; static const char sigSha256wEcdsaName[] = "SHA256wECDSA";
#endif #endif
#ifdef WOLFSSL_SHA384 #ifdef WOLFSSL_SHA384
static char sigSha384wEcdsaName[] = "SHA384wECDSA"; static const char sigSha384wEcdsaName[] = "SHA384wECDSA";
#endif #endif
#ifdef WOLFSSL_SHA512 #ifdef WOLFSSL_SHA512
static char sigSha512wEcdsaName[] = "SHA512wECDSA"; static const char sigSha512wEcdsaName[] = "SHA512wECDSA";
#endif #endif
#endif /* HAVE_ECC */ #endif /* HAVE_ECC */
static char sigUnknownName[] = "Unknown"; static const char sigUnknownName[] = "Unknown";
/* Get the human readable string for a signature type /* Get the human readable string for a signature type
* *
* oid Oid value for signature * oid Oid value for signature
*/ */
char* GetSigName(int oid) { const char* GetSigName(int oid) {
switch (oid) { switch (oid) {
#if !defined(NO_DSA) && !defined(NO_SHA) #if !defined(NO_DSA) && !defined(NO_SHA)
case CTC_SHAwDSA: case CTC_SHAwDSA:
@ -15067,7 +15067,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
ret = MEMORY_E; ret = MEMORY_E;
if (ret == 0) { if (ret == 0) {
static char customName[] = "Custom"; static const char customName[] = "Custom";
XMEMSET(curve, 0, sizeof(*curve)); XMEMSET(curve, 0, sizeof(*curve));
#ifndef WOLFSSL_ECC_CURVE_STATIC #ifndef WOLFSSL_ECC_CURVE_STATIC
curve->name = customName; curve->name = customName;

View File

@ -1103,7 +1103,7 @@ WOLFSSL_LOCAL int GetShortInt(const byte* input, word32* inOutIdx, int* number,
WOLFSSL_LOCAL int SetShortInt(byte* input, word32* inOutIdx, word32 number, WOLFSSL_LOCAL int SetShortInt(byte* input, word32* inOutIdx, word32 number,
word32 maxIdx); word32 maxIdx);
WOLFSSL_LOCAL char* GetSigName(int oid); WOLFSSL_LOCAL const char* GetSigName(int oid);
WOLFSSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len, WOLFSSL_LOCAL int GetLength(const byte* input, word32* inOutIdx, int* len,
word32 maxIdx); word32 maxIdx);
WOLFSSL_LOCAL int GetLength_ex(const byte* input, word32* inOutIdx, int* len, WOLFSSL_LOCAL int GetLength_ex(const byte* input, word32* inOutIdx, int* len,