Add more debug to tlep

This commit is contained in:
qowevisa 2024-06-12 23:38:21 +03:00
parent 36c7f93c0c
commit 02b56273e2

View File

@ -53,6 +53,9 @@ func InitTLEP(name string) (*TLEP, error) {
cbes := chaos.CreateNewChaosSystem() cbes := chaos.CreateNewChaosSystem()
t.CBES = cbes t.CBES = cbes
t.SLLevel = TLEP_LEVEL_NO_CONNECTION t.SLLevel = TLEP_LEVEL_NO_CONNECTION
if t.Debug {
log.Printf("TLEP initiated")
}
return &t, nil return &t, nil
} }
@ -60,6 +63,9 @@ func (t *TLEP) ECDHGetPublicKey() ([]byte, error) {
if t.ECDHConnection == nil { if t.ECDHConnection == nil {
return nil, gmyerr.WrapPrefix("t.ECDHConnection", IS_NIL) return nil, gmyerr.WrapPrefix("t.ECDHConnection", IS_NIL)
} }
if t.Debug {
log.Printf("TLEP uses GetMyPublicKeyBytes")
}
ar := t.ECDHConnection.GetMyPublicKeyBytes() ar := t.ECDHConnection.GetMyPublicKeyBytes()
return ar, nil return ar, nil
} }
@ -73,6 +79,9 @@ func (t *TLEP) ECDHApplyOtherKeyBytes(otherKey []byte) error {
return gmyerr.WrapPrefix("t.ECDHConnection.AcceptOtherPubKeyBytes", err) return gmyerr.WrapPrefix("t.ECDHConnection.AcceptOtherPubKeyBytes", err)
} }
t.SLLevel = TLEP_LEVEL_ECDH t.SLLevel = TLEP_LEVEL_ECDH
if t.Debug {
log.Printf("TLEP is upgraded to ECDH level")
}
return nil return nil
} }
@ -85,6 +94,9 @@ func (t *TLEP) CBESInitRandom() error {
return gmyerr.WrapPrefix("t.CBES.InitRandom", IS_NIL) return gmyerr.WrapPrefix("t.CBES.InitRandom", IS_NIL)
} }
t.SLLevel = TLEP_LEVEL_ECDH_CBES t.SLLevel = TLEP_LEVEL_ECDH_CBES
if t.Debug {
log.Printf("TLEP is upgraded to ECDH_CBES level")
}
return nil return nil
} }
@ -102,6 +114,9 @@ func (t *TLEP) CBESSetFromBytes(bytes []byte) error {
} }
t.CBES = newCBES t.CBES = newCBES
t.SLLevel = TLEP_LEVEL_ECDH_CBES t.SLLevel = TLEP_LEVEL_ECDH_CBES
if t.Debug {
log.Printf("TLEP is upgraded to ECDH_CBES level")
}
return nil return nil
} }