From 49c139154467c1d92596dc432d30101cb4077343 Mon Sep 17 00:00:00 2001 From: jsing Date: Mon, 14 Jul 2014 00:00:44 +0000 Subject: [PATCH] Update regress test to work with ressl API changes. --- regress/lib/libressl/goressl/ressl.go | 26 +++++++++++++--------- regress/lib/libressl/goressl/ressl_test.go | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/regress/lib/libressl/goressl/ressl.go b/regress/lib/libressl/goressl/ressl.go index b27a193814b..32508618845 100644 --- a/regress/lib/libressl/goressl/ressl.go +++ b/regress/lib/libressl/goressl/ressl.go @@ -6,7 +6,7 @@ package ressl #include -#include +#include typedef void *ressl; */ @@ -55,17 +55,17 @@ func (c *ResslConfig) SetCAFile(filename string) { C.free(unsafe.Pointer(c.caFile)) } c.caFile = C.CString(filename) - C.ressl_config_ca_file(c.resslCfg, c.caFile) + C.ressl_config_set_ca_file(c.resslCfg, c.caFile) } // SetInsecure disables verification for the connection. -func (c *ResslConfig) SetInsecure() { - C.ressl_config_insecure(c.resslCfg) +func (c *ResslConfig) InsecureNoVerify() { + C.ressl_config_insecure_no_verify(c.resslCfg) } // SetSecure enables verification for the connection. -func (c *ResslConfig) SetSecure() { - C.ressl_config_secure(c.resslCfg) +func (c *ResslConfig) SetVerify() { + C.ressl_config_verify(c.resslCfg) } // Free frees resources associated with the ressl configuration. @@ -77,16 +77,20 @@ func (c *ResslConfig) Free() { c.resslCfg = nil } -// New returns a new ressl context, using the optional configuration. If no -// configuration is specified the defaults will be used. -func New(config *ResslConfig) (*Ressl, error) { +// NewClient returns a new ressl client context, using the optional +// configuration. If no configuration is specified the default configuration +// will be used. +func NewClient(config *ResslConfig) (*Ressl, error) { var sslCfg *C.struct_ressl_config if config != nil { sslCfg = config.resslCfg } - ctx := C.ressl_new(sslCfg) + ctx := C.ressl_client() if ctx == nil { - return nil, errors.New("ressl new failed") + return nil, errors.New("ressl client failed") + } + if C.ressl_configure(ctx, sslCfg) != 0 { + return nil, errors.New("ressl configure failed") } return &Ressl{ cfg: config, diff --git a/regress/lib/libressl/goressl/ressl_test.go b/regress/lib/libressl/goressl/ressl_test.go index 665d4e0cefb..a2d1a04a5bc 100644 --- a/regress/lib/libressl/goressl/ressl_test.go +++ b/regress/lib/libressl/goressl/ressl_test.go @@ -64,7 +64,7 @@ func TestResslBasic(t *testing.T) { defer cfg.Free() cfg.SetCAFile(caFile) - ssl, err := New(cfg) + ssl, err := NewClient(cfg) if err != nil { t.Fatal(err) } -- 2.20.1