Merge pull request #3221 from julek-wolfssl/wolfSSL_dtls_import-const-buf

Change buffer in wolfSSL_dtls_import to be const
This commit is contained in:
toddouska
2020-09-30 10:45:25 -07:00
committed by GitHub
4 changed files with 11 additions and 11 deletions

View File

@ -629,7 +629,7 @@ static int ExportKeyState(WOLFSSL* ssl, byte* exp, word32 len, byte ver,
return idx;
}
static int ImportCipherSpecState(WOLFSSL* ssl, byte* exp, word32 len, byte ver)
static int ImportCipherSpecState(WOLFSSL* ssl, const byte* exp, word32 len, byte ver)
{
word32 idx = 0;
CipherSpecs* specs;
@ -666,7 +666,7 @@ static int ImportCipherSpecState(WOLFSSL* ssl, byte* exp, word32 len, byte ver)
}
static int ImportKeyState(WOLFSSL* ssl, byte* exp, word32 len, byte ver)
static int ImportKeyState(WOLFSSL* ssl, const byte* exp, word32 len, byte ver)
{
word32 idx = 0;
byte sz;
@ -962,7 +962,7 @@ static int dtls_export_new(WOLFSSL* ssl, byte* exp, word32 len, byte ver)
/* copy items from Export struct to Options struct
* On success returns size of buffer used on failure returns a negative value */
static int dtls_export_load(WOLFSSL* ssl, byte* exp, word32 len, byte ver)
static int dtls_export_load(WOLFSSL* ssl, const byte* exp, word32 len, byte ver)
{
int idx = 0;
Options* options = &ssl->options;
@ -1144,7 +1144,7 @@ static int ExportPeerInfo(WOLFSSL* ssl, byte* exp, word32 len, byte ver)
#endif /* !WOLFSSL_SESSION_EXPORT_NOPEER */
static int ImportPeerInfo(WOLFSSL* ssl, byte* buf, word32 len, byte ver)
static int ImportPeerInfo(WOLFSSL* ssl, const byte* buf, word32 len, byte ver)
{
word16 idx = 0;
word16 ipSz;
@ -1346,7 +1346,7 @@ int wolfSSL_dtls_export_internal(WOLFSSL* ssl, byte* buf, word32 sz)
/* On success return amount of buffer consumed */
int wolfSSL_dtls_import_state_internal(WOLFSSL* ssl, byte* buf, word32 sz)
int wolfSSL_dtls_import_state_internal(WOLFSSL* ssl, const byte* buf, word32 sz)
{
word32 idx = 0;
word16 length = 0;
@ -1413,12 +1413,12 @@ int wolfSSL_dtls_import_state_internal(WOLFSSL* ssl, byte* buf, word32 sz)
idx += ret;
WOLFSSL_LEAVE("wolfSSL_dtls_import_state_internal", ret);
return ret;
return idx;
}
/* On success return amount of buffer consumed */
int wolfSSL_dtls_import_internal(WOLFSSL* ssl, byte* buf, word32 sz)
int wolfSSL_dtls_import_internal(WOLFSSL* ssl, const byte* buf, word32 sz)
{
word32 idx = 0;
word16 length = 0;

View File

@ -191,7 +191,7 @@ byte tsip_rootCAverified( );
#ifdef WOLFSSL_SESSION_EXPORT
#ifdef WOLFSSL_DTLS
int wolfSSL_dtls_import(WOLFSSL* ssl, unsigned char* buf, unsigned int sz)
int wolfSSL_dtls_import(WOLFSSL* ssl, const unsigned char* buf, unsigned int sz)
{
WOLFSSL_ENTER("wolfSSL_session_import");

View File

@ -1634,14 +1634,14 @@ WOLFSSL_LOCAL ProtocolVersion MakeTLSv1_3(void);
WOLFSSL_LOCAL ProtocolVersion MakeDTLSv1_2(void);
#ifdef WOLFSSL_SESSION_EXPORT
WOLFSSL_LOCAL int wolfSSL_dtls_import_internal(WOLFSSL* ssl, byte* buf,
WOLFSSL_LOCAL int wolfSSL_dtls_import_internal(WOLFSSL* ssl, const byte* buf,
word32 sz);
WOLFSSL_LOCAL int wolfSSL_dtls_export_internal(WOLFSSL* ssl, byte* buf,
word32 sz);
WOLFSSL_LOCAL int wolfSSL_dtls_export_state_internal(WOLFSSL* ssl,
byte* buf, word32 sz);
WOLFSSL_LOCAL int wolfSSL_dtls_import_state_internal(WOLFSSL* ssl,
byte* buf, word32 sz);
const byte* buf, word32 sz);
WOLFSSL_LOCAL int wolfSSL_send_session(WOLFSSL* ssl);
#endif
#endif

View File

@ -743,7 +743,7 @@ typedef int (*wc_dtls_export)(WOLFSSL* ssl,
#define WOLFSSL_DTLS_EXPORT_TYPES
#endif /* WOLFSSL_DTLS_EXPORT_TYPES */
WOLFSSL_API int wolfSSL_dtls_import(WOLFSSL* ssl, unsigned char* buf,
WOLFSSL_API int wolfSSL_dtls_import(WOLFSSL* ssl, const unsigned char* buf,
unsigned int sz);
WOLFSSL_API int wolfSSL_CTX_dtls_set_export(WOLFSSL_CTX* ctx,
wc_dtls_export func);