space monkey internal commit export

[katamari commit: ec10a16bdc8a55c53af32481120946fa49570b30]
This commit is contained in:
Andrew Harding
2014-03-10 16:59:30 -06:00
parent b713c0097b
commit 420209b5b2
4 changed files with 161 additions and 29 deletions

View File

@@ -291,12 +291,28 @@ func StdlibConstructor(t testing.TB, server_conn, client_conn net.Conn) (
return server, client
}
func passThruVerify(t testing.TB) func(bool, *CertificateStoreCtx) bool {
x := func(ok bool, store *CertificateStoreCtx) bool {
cert := store.GetCurrentCert()
if cert == nil {
t.Fatalf("Could not obtain cert from store\n")
}
sn := cert.GetSerialNumberHex()
if len(sn) == 0 {
t.Fatalf("Could not obtain serial number from cert")
}
return ok
}
return x
}
func OpenSSLConstructor(t testing.TB, server_conn, client_conn net.Conn) (
server, client HandshakingConn) {
ctx, err := NewCtx()
if err != nil {
t.Fatal(err)
}
ctx.SetVerify(VerifyNone, passThruVerify(t))
key, err := LoadPrivateKey(keyBytes)
if err != nil {
t.Fatal(err)