Skip to content

Commit

Permalink
Add more tests for SMP calculations for message 1 in OTRv3
Browse files Browse the repository at this point in the history
  • Loading branch information
olabini committed Mar 14, 2023
1 parent 99d17a0 commit 86897a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions smp_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func fixtureMessage1v3() smp1Message {
return smp1Message{
g2a: bnFromHex("ff4fb16e465739dff9297312090c2a0271d0579e5871746311b4b4b1cecb4404512f21936268f9903bf7b9ec21f9f68151ece99c892c3adbbccf4511e6d3ddba25f11cf15d140f5db7a2a8b1e4c17d4681ac9466e84c3e518e80c3c1a16c109951e9a4adf2818e7a6ccd6df9d1759065c6a43bb34c0692081619865dec358dba5a2e17cb7f69d998259f26965c794d013b15606e8503968836b284be3929438e46b845b19c0c724e8aee2aff162bbbd95a8195f83f4245f3281ce3a1d7872c92"),
g3a: bnFromHex("39eaa0273de38f9a16078890a51c37bfce0f113ba445ef54c0f1e72c667a3cbe8d2f4587c3eaad9630027f56543f58f0f0633250287ef6de17c7313e5b8516eace4bddb1d9cdfa7729a48db9255e073f6f82ab37684843a839d785d330295322d75208093566fbec4bd01e8f462ee71e393af34de8688a5244b8aaf5fae2019308b3abd790c5b1eb971bf4505d376af071413389d56332cfe5b98fb30b77f72ddf2a629275b68c364de8f76137aa953ce9b3746d2c919a9827459f08ead78c71"),
c2: bnFromHex("59546ed0c65131c7e22b189bc691de7244c5967541cf4010b661bae2c0b167bc"),
d2: bnFromHex("04e90a36d4c559b8fa132b314a1157448dda12d4fa2120b21155d29379101085fc91fca8cfa0aa583e475fb4dd7adf1c88dbfc6adc3dbb4174cabc60bbb2e4f100aa9c452c7f2768d9249234872f413a6d30937c24f7bd422fc4b7d04c5044439c4dfb65b0a2452dfbc13e536d0ab7f38f38d3cc713647c458dd83a7783b807c3f41721e7742b505ae65957332a9d0c5b39a4311177a53853fdd282ed17223d42ec4c1803ef0d8e55df17bf673ea965ea2f8f4beb38279cbc6e727ec4fa2987b"),
c3: bnFromHex("f379724a5ab0f40c5f9e1791926c19e4654eee78f690a094c190754a08038bdf"),
d3: bnFromHex("321cb850903ef002db66376a9aaa15293dacdac793c51063f970d2275d6334122428454c24aac2d049f20df53ab56ef4680c3097a37e4d0b2a3d570ffebaa7a6bdde7308667e68398fa1edd2b8cd49523a01911e25cbc5c836fb6095507ae23209dd3ad6fd0177f0e1288fb3e0334545fe85c55f8ea69b82477be1a5fc21d81db6cbfd27e12963ee8fd58d7d499b482d27f37004d8a1bb1c5e4bbdc9245230ba0b840b76aba57bc636b3da1240f491d35c75d98698ea1ef2ff209863b0735c0c"),
}
}

Expand Down
14 changes: 14 additions & 0 deletions smp_msg1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ func Test_computesC3AndD3CorrectlyForOtrV2(t *testing.T) {
assertDeepEquals(t, smp.msg.d3, fixtureMessage1().d3)
}

func Test_computesC2AndD2CorrectlyForOtrV3(t *testing.T) {
otr := newConversation(otrV3{}, fixtureRand())
smp, _ := otr.generateSMP1()
assertDeepEquals(t, smp.msg.c2, fixtureMessage1v3().c2)
assertDeepEquals(t, smp.msg.d2, fixtureMessage1v3().d2)
}

func Test_computesC3AndD3CorrectlyForOtrV3(t *testing.T) {
otr := newConversation(otrV3{}, fixtureRand())
smp, _ := otr.generateSMP1()
assertDeepEquals(t, smp.msg.c3, fixtureMessage1v3().c3)
assertDeepEquals(t, smp.msg.d3, fixtureMessage1v3().d3)
}

func Test_thatVerifySMPStartParametersCheckG2AForOtrV3(t *testing.T) {
c := newConversation(otrV3{}, fixtureRand())
err := c.verifySMP1(smp1Message{g2a: new(big.Int).SetInt64(1)})
Expand Down

0 comments on commit 86897a2

Please sign in to comment.