]> Cypherpunks.ru repositories - gocheese.git/blobdiff - main.go
Use bytes.Equal() instead of bytes.Compare()==0
[gocheese.git] / main.go
diff --git a/main.go b/main.go
index 5131e585a168738d2f16d4cf220f2a9450bcd632..e0670d7a8211ebfbc14e2aae43cdfa012d175f68 100644 (file)
--- a/main.go
+++ b/main.go
@@ -1,7 +1,7 @@
 /*
 GoCheese -- Python private package repository and caching proxy
-Copyright (C) 2019-2022 Sergey Matveev <stargrave@stargrave.org>
-              2019-2022 Elena Balakhonova <balakhonova_e@riseup.net>
+Copyright (C) 2019-2023 Sergey Matveev <stargrave@stargrave.org>
+              2019-2023 Elena Balakhonova <balakhonova_e@riseup.net>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -236,7 +236,7 @@ func main() {
                tlsConfig.VerifyConnection = func(s tls.ConnectionState) error {
                        spki := s.VerifiedChains[0][0].RawSubjectPublicKeyInfo
                        theirDgst := sha256.Sum256(spki)
-                       if bytes.Compare(ourDgst, theirDgst[:]) != 0 {
+                       if !bytes.Equal(ourDgst, theirDgst[:]) {
                                return errors.New("certificate's SPKI digest mismatch")
                        }
                        return nil