From f530de063ae91b6af22518cb3e2761aa9fc505a8 Mon Sep 17 00:00:00 2001 From: Kris Kwiatkowski Date: Wed, 22 Aug 2018 14:20:11 +0100 Subject: [PATCH] Fixes --- src/runner.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/runner.go b/src/runner.go index 955a6ac..418217d 100644 --- a/src/runner.go +++ b/src/runner.go @@ -21,14 +21,18 @@ const ( ) // Helpers for byte convertion +// ------------------------------ + +// cBytes must be initialized to proper size func convBytesGoToC(goBytes []byte, cBytes []C.uchar) { for i,v:=range(goBytes) { cBytes[i] = C.uchar(v) } } +// goBytes must be initialized to proper size func convBytesCToGo(cBytes []C.uchar, goBytes []byte) { - goBytes=C.GoBytes(unsafe.Pointer(&cBytes[0]), GSKsz) + copy(goBytes, C.GoBytes(unsafe.Pointer(&cBytes[0]), C.int(len(cBytes)))) } // Helpers for key generation @@ -154,9 +158,6 @@ func test_cfK_msrE_cfD() { for i,_:=range(gSS) { if gSS[i] != byte(cSS[i]) { - fmt.Printf("LEN=%d %X\n", len(gSS), gSS) - fmt.Printf("LEN=%d %X\n", len(cSS), cSS) - fmt.Printf("LEN=%d %X\n", len(gCT), gCT) fmt.Println("ERR: shared secrets differ") break }