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 }