summaryrefslogtreecommitdiffstats
path: root/challenge
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-11-11 12:18:47 -0500
committersiddharth ravikumar <s@ricketyspace.net>2022-11-11 12:18:47 -0500
commit23b6e50fbdab5d2b3625c35421b9e60a20ea87fd (patch)
treea2b78d944ddc850a0f64483bfe49b2c4755e0347 /challenge
parent7fc0eea5e7cba009f3f2b2359f4ecb9ee0002b88 (diff)
challenge: fix go vet warnings
Diffstat (limited to 'challenge')
-rw-r--r--challenge/c27.go2
-rw-r--r--challenge/c34.go16
-rw-r--r--challenge/c35.go22
-rw-r--r--challenge/c37.go2
4 files changed, 21 insertions, 21 deletions
diff --git a/challenge/c27.go b/challenge/c27.go
index 9de3415..3ee2cbe 100644
--- a/challenge/c27.go
+++ b/challenge/c27.go
@@ -55,7 +55,7 @@ func C27() {
// Check if `plain` high ASCII
for _, p := range plain {
if p >= 128 {
- return plain, lib.CPError{"Has high ASCII values"}
+ return plain, lib.CPError{Err: "Has high ASCII values"}
}
}
diff --git a/challenge/c34.go b/challenge/c34.go
index 7377e20..5a209bb 100644
--- a/challenge/c34.go
+++ b/challenge/c34.go
@@ -128,18 +128,18 @@ func C34(args []string) {
// Try to read DH paramters from packet.
params := lib.StrSplitAt('+', packet)
if len(params) != 3 {
- return nil, lib.CPError{"DH paramters invalid"}
+ return nil, lib.CPError{Err: "DH paramters invalid"}
}
// Try make DH for this client connection.
dh, ok := lib.NewDH(params[0], params[1])
if !ok {
- return nil, lib.CPError{"DH initialization failed"}
+ return nil, lib.CPError{Err: "DH initialization failed"}
}
// Parse client's DH public key.
cPub, ok := new(big.Int).SetString(lib.StripSpaceChars(params[2]), 10)
if !ok {
- return nil, lib.CPError{"DH public key invalid"}
+ return nil, lib.CPError{Err: "DH public key invalid"}
}
// Send server's DH public key for this connection.
@@ -237,7 +237,7 @@ func C34(args []string) {
g := "2"
dh, ok := lib.NewDH(p, g)
if !ok {
- return conn, nil, lib.CPError{"DH initialization failed"}
+ return conn, nil, lib.CPError{Err: "DH initialization failed"}
}
// Make DH packet: p+g+pub.
@@ -257,7 +257,7 @@ func C34(args []string) {
// Parse server's DH public key.
sPub, ok := new(big.Int).SetString(lib.StripSpaceChars(spacket), 10)
if !ok {
- return conn, nil, lib.CPError{"Server's DH key invalid"}
+ return conn, nil, lib.CPError{Err: "Server's DH key invalid"}
}
// Return server connection and DH session key.
@@ -330,13 +330,13 @@ func C34(args []string) {
// Try to read DH paramters from packet.
params := lib.StrSplitAt('+', packet)
if len(params) != 3 {
- return []string{}, lib.CPError{"DH paramters invalid"}
+ return []string{}, lib.CPError{Err: "DH paramters invalid"}
}
// Try make a DH from params.
_, ok := lib.NewDH(params[0], params[1])
if !ok {
- return []string{}, lib.CPError{"DH initialization failed"}
+ return []string{}, lib.CPError{Err: "DH initialization failed"}
}
return params, nil
}
@@ -353,7 +353,7 @@ func C34(args []string) {
// Make DH packet: p+g+p
pub, ok := new(big.Int).SetString(lib.StripSpaceChars(p), 16)
if !ok {
- return conn, lib.CPError{"Unable to parse p"}
+ return conn, lib.CPError{Err: "Unable to parse p"}
}
packet := fmt.Sprintf("%v+%v+%v", p, g, pub)
diff --git a/challenge/c35.go b/challenge/c35.go
index a99b4c0..9710e7e 100644
--- a/challenge/c35.go
+++ b/challenge/c35.go
@@ -135,13 +135,13 @@ func C35(args []string) {
// Try to read DH paramters from packet.
params := lib.StrSplitAt('+', packet)
if len(params) != 2 {
- return nil, lib.CPError{"DH paramters invalid"}
+ return nil, lib.CPError{Err: "DH paramters invalid"}
}
// Try make DH for this client connection.
dh, ok := lib.NewDH(params[0], params[1])
if !ok {
- return nil, lib.CPError{"DH initialization failed"}
+ return nil, lib.CPError{Err: "DH initialization failed"}
}
// Send ACK to client.
@@ -158,7 +158,7 @@ func C35(args []string) {
// Parse client's DH public key.
cPub, ok := new(big.Int).SetString(lib.StripSpaceChars(packet), 10)
if !ok {
- return nil, lib.CPError{"DH public key invalid"}
+ return nil, lib.CPError{Err: "DH public key invalid"}
}
// Send server's DH public key for this connection.
@@ -256,7 +256,7 @@ func C35(args []string) {
g := "2"
dh, ok := lib.NewDH(p, g)
if !ok {
- return conn, nil, lib.CPError{"DH initialization failed"}
+ return conn, nil, lib.CPError{Err: "DH initialization failed"}
}
// Make DH packet: p+g
@@ -273,7 +273,7 @@ func C35(args []string) {
// Remove newline character.
spacket = spacket[:len(spacket)-1]
if spacket != "ACK" {
- return conn, nil, lib.CPError{"ACK failed"}
+ return conn, nil, lib.CPError{Err: "ACK failed"}
}
// Send DH public key to server.
@@ -290,7 +290,7 @@ func C35(args []string) {
// Parse server's DH public key.
sPub, ok := new(big.Int).SetString(lib.StripSpaceChars(spacket), 10)
if !ok {
- return conn, nil, lib.CPError{"Server's DH key invalid"}
+ return conn, nil, lib.CPError{Err: "Server's DH key invalid"}
}
// Return server connection and DH session key.
@@ -363,13 +363,13 @@ func C35(args []string) {
// Try to read DH paramters from packet.
params := lib.StrSplitAt('+', packet)
if len(params) != 2 {
- return []string{}, lib.CPError{"DH paramters invalid"}
+ return []string{}, lib.CPError{Err: "DH paramters invalid"}
}
// Try make a DH from params.
_, ok := lib.NewDH(params[0], params[1])
if !ok {
- return []string{}, lib.CPError{"DH initialization failed"}
+ return []string{}, lib.CPError{Err: "DH initialization failed"}
}
return params, nil
}
@@ -410,7 +410,7 @@ func C35(args []string) {
// Initialize DH.
dh, ok := lib.NewDH(p, g)
if !ok {
- return conn, nil, lib.CPError{"DH initialization failed"}
+ return conn, nil, lib.CPError{Err: "DH initialization failed"}
}
// Make DH packet: p+g
@@ -427,7 +427,7 @@ func C35(args []string) {
// Remove newline character.
spacket = spacket[:len(spacket)-1]
if spacket != "ACK" {
- return conn, nil, lib.CPError{"ACK failed"}
+ return conn, nil, lib.CPError{Err: "ACK failed"}
}
// Send DH public key to server.
@@ -444,7 +444,7 @@ func C35(args []string) {
// Parse server's DH public key.
sPub, ok := new(big.Int).SetString(lib.StripSpaceChars(spacket), 10)
if !ok {
- return conn, nil, lib.CPError{"Server's DH key invalid"}
+ return conn, nil, lib.CPError{Err: "Server's DH key invalid"}
}
// Return server connection and server's DH public key.
diff --git a/challenge/c37.go b/challenge/c37.go
index 4ff10e8..ffcfe93 100644
--- a/challenge/c37.go
+++ b/challenge/c37.go
@@ -70,7 +70,7 @@ func C37(args []string) {
16,
)
if !ok {
- fmt.Errorf("unable to process pub key")
+ fmt.Printf("unable to process pub key")
return
}
if pow == 1 {