forked from wolfSSL/wolfssl
make building into resip easier
This commit is contained in:
@ -41,6 +41,9 @@
|
|||||||
/* Uncomment next line if using Mbed */
|
/* Uncomment next line if using Mbed */
|
||||||
/* #define MBED */
|
/* #define MBED */
|
||||||
|
|
||||||
|
#ifdef USE_CYASSL_CONFIG
|
||||||
|
#include "config.h" /* may not want global HAVE_CONFIG_H */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef IPHONE
|
#ifdef IPHONE
|
||||||
#define SIZEOF_LONG_LONG 8
|
#define SIZEOF_LONG_LONG 8
|
||||||
|
@ -33,15 +33,16 @@
|
|||||||
#include "prefix_hmac.h"
|
#include "prefix_hmac.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned char* HMAC(const EVP_MD* evp_md, const void* key, int key_len,
|
#include "evp.h"
|
||||||
const unsigned char* d, int n, unsigned char* md, unsigned int* md_len);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
unsigned char* HMAC(const EVP_MD* evp_md, const void* key, int key_len,
|
||||||
|
const unsigned char* d, int n, unsigned char* md, unsigned int* md_len);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -26,6 +26,9 @@ void SHA1_Init(SHA_CTX*);
|
|||||||
void SHA1_Update(SHA_CTX*, const void*, unsigned long);
|
void SHA1_Update(SHA_CTX*, const void*, unsigned long);
|
||||||
void SHA1_Final(unsigned char*, SHA_CTX*);
|
void SHA1_Final(unsigned char*, SHA_CTX*);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SHA_DIGEST_LENGTH = 20
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -612,6 +612,7 @@ int FreeCyaSSL(void); /* call when done to free session cache mutex */
|
|||||||
int CyaSSL_Debugging_ON(void); /* turn logging on, only if compiled in */
|
int CyaSSL_Debugging_ON(void); /* turn logging on, only if compiled in */
|
||||||
void CyaSSL_Debugging_OFF(void); /* turn logging off */
|
void CyaSSL_Debugging_OFF(void); /* turn logging off */
|
||||||
|
|
||||||
|
int CyaSSL_negotiate(SSL* ssl); /* do accept or connect depedning on side */
|
||||||
int CyaSSL_set_compression(SSL* ssl); /* turn on CyaSSL data compression */
|
int CyaSSL_set_compression(SSL* ssl); /* turn on CyaSSL data compression */
|
||||||
|
|
||||||
int CyaSSL_CTX_use_NTRUPrivateKey_file(SSL_CTX*, const char*); /* load NTRU
|
int CyaSSL_CTX_use_NTRUPrivateKey_file(SSL_CTX*, const char*); /* load NTRU
|
||||||
@ -633,14 +634,12 @@ int CyaSSL_X509_get_serial_number(X509*, unsigned char*);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NO_FILESYSTEM) || defined(MICRIUM)
|
|
||||||
|
|
||||||
int CyaSSL_CTX_load_verify_buffer(SSL_CTX*, const unsigned char*, long, int);
|
int CyaSSL_CTX_load_verify_buffer(SSL_CTX*, const unsigned char*, long, int);
|
||||||
int CyaSSL_CTX_use_certificate_buffer(SSL_CTX*, const unsigned char*, long,int);
|
int CyaSSL_CTX_use_certificate_buffer(SSL_CTX*, const unsigned char*, long,int);
|
||||||
int CyaSSL_CTX_use_PrivateKey_buffer(SSL_CTX*, const unsigned char*, long, int);
|
int CyaSSL_CTX_use_PrivateKey_buffer(SSL_CTX*, const unsigned char*, long, int);
|
||||||
int CyaSSL_CTX_use_certificate_chain_buffer(SSL_CTX*,const unsigned char*,long);
|
int CyaSSL_CTX_use_certificate_chain_buffer(SSL_CTX*,const unsigned char*,long);
|
||||||
|
|
||||||
#endif /* NO_FILESYSTEM || MICRIUM */
|
|
||||||
|
|
||||||
|
|
||||||
/* I/O callbacks */
|
/* I/O callbacks */
|
||||||
|
@ -704,7 +704,7 @@ int InitSSL(SSL* ssl, SSL_CTX* ctx)
|
|||||||
ssl->peerCert.issuer.sz = 0;
|
ssl->peerCert.issuer.sz = 0;
|
||||||
ssl->peerCert.subject.sz = 0;
|
ssl->peerCert.subject.sz = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* make sure server has cert and key unless using PSK */
|
/* make sure server has cert and key unless using PSK */
|
||||||
if (ssl->options.side == SERVER_END && !havePSK)
|
if (ssl->options.side == SERVER_END && !havePSK)
|
||||||
if (!ssl->buffers.certificate.buffer || !ssl->buffers.key.buffer)
|
if (!ssl->buffers.certificate.buffer || !ssl->buffers.key.buffer)
|
||||||
|
13
src/ssl.c
13
src/ssl.c
@ -63,24 +63,29 @@
|
|||||||
|
|
||||||
SSL_CTX* SSL_CTX_new(SSL_METHOD* method)
|
SSL_CTX* SSL_CTX_new(SSL_METHOD* method)
|
||||||
{
|
{
|
||||||
|
CYASSL_ENTER("SSL_CTX_new");
|
||||||
SSL_CTX* ctx = (SSL_CTX*) XMALLOC(sizeof(SSL_CTX), 0, DYNAMIC_TYPE_CTX);
|
SSL_CTX* ctx = (SSL_CTX*) XMALLOC(sizeof(SSL_CTX), 0, DYNAMIC_TYPE_CTX);
|
||||||
if (ctx)
|
if (ctx)
|
||||||
InitSSL_Ctx(ctx, method);
|
InitSSL_Ctx(ctx, method);
|
||||||
|
|
||||||
|
CYASSL_LEAVE("SSL_CTX_new", 0);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SSL_CTX_free(SSL_CTX* ctx)
|
void SSL_CTX_free(SSL_CTX* ctx)
|
||||||
{
|
{
|
||||||
|
CYASSL_ENTER("SSL_CTX_free");
|
||||||
if (ctx)
|
if (ctx)
|
||||||
FreeSSL_Ctx(ctx);
|
FreeSSL_Ctx(ctx);
|
||||||
|
CYASSL_LEAVE("SSL_CTX_free", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SSL* SSL_new(SSL_CTX* ctx)
|
SSL* SSL_new(SSL_CTX* ctx)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CYASSL_ENTER("SSL_new");
|
||||||
SSL* ssl = (SSL*) XMALLOC(sizeof(SSL), ctx->heap, DYNAMIC_TYPE_SSL);
|
SSL* ssl = (SSL*) XMALLOC(sizeof(SSL), ctx->heap, DYNAMIC_TYPE_SSL);
|
||||||
if (ssl)
|
if (ssl)
|
||||||
if (InitSSL(ssl, ctx) < 0) {
|
if (InitSSL(ssl, ctx) < 0) {
|
||||||
@ -88,6 +93,7 @@ SSL* SSL_new(SSL_CTX* ctx)
|
|||||||
ssl = 0;
|
ssl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CYASSL_LEAVE("SSL_new", 0);
|
||||||
return ssl;
|
return ssl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +129,7 @@ int CyaSSL_negotiate(SSL* ssl)
|
|||||||
{
|
{
|
||||||
int err = -1;
|
int err = -1;
|
||||||
|
|
||||||
|
CYASSL_ENTER("CyaSSL_negotiate()");
|
||||||
#ifndef NO_CYASSL_SERVER
|
#ifndef NO_CYASSL_SERVER
|
||||||
if (ssl->options.side == SERVER_END)
|
if (ssl->options.side == SERVER_END)
|
||||||
err = SSL_accept(ssl);
|
err = SSL_accept(ssl);
|
||||||
@ -133,6 +140,8 @@ int CyaSSL_negotiate(SSL* ssl)
|
|||||||
err = SSL_connect(ssl);
|
err = SSL_connect(ssl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CYASSL_LEAVE("CyaSSL_negotiate()", err);
|
||||||
|
|
||||||
if (err == SSL_SUCCESS)
|
if (err == SSL_SUCCESS)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
@ -1867,7 +1876,7 @@ int CyaSSL_set_compression(SSL* ssl)
|
|||||||
#endif /* NO_PSK */
|
#endif /* NO_PSK */
|
||||||
|
|
||||||
|
|
||||||
#if defined(NO_FILESYSTEM) || defined(MICRIUM)
|
/* used to be defined on NO_FILESYSTEM only, but are generally useful */
|
||||||
|
|
||||||
/* CyaSSL extension allows DER files to be loaded from buffers as well */
|
/* CyaSSL extension allows DER files to be loaded from buffers as well */
|
||||||
int CyaSSL_CTX_load_verify_buffer(SSL_CTX* ctx, const unsigned char* buffer,
|
int CyaSSL_CTX_load_verify_buffer(SSL_CTX* ctx, const unsigned char* buffer,
|
||||||
@ -1898,7 +1907,7 @@ int CyaSSL_set_compression(SSL* ssl)
|
|||||||
return ProcessBuffer(ctx, buffer, sz, SSL_FILETYPE_PEM, CA_TYPE);
|
return ProcessBuffer(ctx, buffer, sz, SSL_FILETYPE_PEM, CA_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* NO_FILESYSTEM || MICRIUM */
|
/* old NO_FILESYSTEM end */
|
||||||
|
|
||||||
|
|
||||||
#if defined(OPENSSL_EXTRA) || defined(GOAHEAD_WS)
|
#if defined(OPENSSL_EXTRA) || defined(GOAHEAD_WS)
|
||||||
|
Reference in New Issue
Block a user