Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tfn18001 committed Apr 26, 2022
2 parents 7f5ef6c + 21c579a commit e066203
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CTng/gossip/accusation_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ type Accusation_POM struct {
Signature_TH crypto.ThresholdSig
}

//Written By Jie
//verification for PoM due to enough number of accusations happens during the PoM generation
//we are not sending the entire PoM generated by enough number of accusations as gossip object
//therefore, we will verify the combined parital signature at the local level

//This function will be invoked in the Process_accusation function in accusations.go when the number of accusations accumulated after receiving a new one exceeds the threshold
func generate_accusation_pom_from_accused_entity(Ea EntityAccusations, c *crypto.CryptoConfig) *Accusation_POM {
pom_sig, _ := c.ThresholdAggregate(Ea.Partial_sigs)
new_Pom02 := new(Accusation_POM)
Expand All @@ -21,6 +22,8 @@ func generate_accusation_pom_from_accused_entity(Ea EntityAccusations, c *crypto
return new_Pom02
}

//Written by Jie
//This function is invoked in Process_accusation function in accusations.go after invoking generate_accusation_pom_from_accused_entity to check the validity of the new generated PoM
func verify_accusation_pom(candidatepom Accusation_POM, c *crypto.CryptoConfig) error {
//generate the msg and verify the signature
return c.ThresholdVerify(candidatepom.Entity_URL, candidatepom.Signature_TH)
Expand Down
9 changes: 5 additions & 4 deletions CTng/gossip/accusations.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"fmt"
)

/*This file mainly deals with Proof of Misbehavior generated after receiving threshold number of accusations (as part of the process accusations).
This file also contains the process accusations function for the gossiper to invoke.
*/

//Written by Jie, reviewed and edited by Finn
//This function is invoked when the gossiper receives an accusation
//It will store all the non-duplicate accusations
//it will deal with PoM generation due to threshold number of accusations by invoking generate_accusation_pom_from_accused_entity from accusation_validation.go
//if a PoM due to threshold number of accusations is generated, the PoM will be returned as a gossip_object to be sent to the monitor
func Process_Accusation(new_acc Gossip_object, accs *AccusationDB, c *crypto.CryptoConfig) (*Gossip_object, bool, error) {
// Convert signature string
p_sig, err := crypto.SigFragmentFromString(new_acc.Signature[0])
Expand Down
6 changes: 5 additions & 1 deletion CTng/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ func QueryAuthorities(c *MonitorContext) {

}

//Written by Jie
//This function accuses the entity if the damain name is provided
//It is called when the gossip object received is not valid, or the monitor didn't get response when querying the logger or the CA
//Accused = Domain name of the accused entity (logger etc.)
//should be a monitor functionality
func AccuseEntity(c *MonitorContext, Accused string) {
// this should be a method for the monitor
// verify we havent accused during this MMD
Expand Down Expand Up @@ -119,6 +121,8 @@ func AccuseEntity(c *MonitorContext, Accused string) {
Send_to_gossiper(c, accusation)
}

//Written by Jie
//Send the input gossip object to its gossiper
func Send_to_gossiper(c *MonitorContext, g gossip.Gossip_object) {
// Convert gossip object to JSON
msg, err := json.Marshal(g)
Expand Down
4 changes: 3 additions & 1 deletion CTng/monitor/monitor_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (
"time"
)

//Need to discuss about this ******************************************************
//Written by Jie, reviewed by Finn
//This function is called by handle_gossip in monitor_server.go under the server folder
//It will be called if the gossip object is validated
func Process_valid_object(c *MonitorContext, g gossip.Gossip_object) {
//if the valid object is from the logger in the monitor config logger URL list
//This handles the STHS
Expand Down
4 changes: 4 additions & 0 deletions CTng/server/Monitor_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ func getPOM(c *monitor.MonitorContext, w http.ResponseWriter, r *http.Request) {
// if POM found, send to requester
}

//Written by Jie
//This function handles gossip object received by the monitor
//Note: This function does not handle inactive loggers/CAs
//see monitor folder for handling inactive loggers/CAs
func handle_gossip(c *monitor.MonitorContext, w http.ResponseWriter, r *http.Request) {
// Parse sent object.
// Converts JSON passed in the body of a POST to a Gossip_object.
Expand Down
1 change: 1 addition & 0 deletions CTng/util/IO.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"
)

//Written By Jie
//This read function reads from a Json file as a byte array and returns it.
//This function will be called for all the reading from json functions

Expand Down

0 comments on commit e066203

Please sign in to comment.