mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
update: macaron cores,gzip,session (#10522)
Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
694f44660f
commit
8d2059a201
47 changed files with 2154 additions and 349 deletions
3
vendor/golang.org/x/crypto/chacha20/chacha_arm64.go
generated
vendored
3
vendor/golang.org/x/crypto/chacha20/chacha_arm64.go
generated
vendored
|
@ -2,8 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.11
|
||||
// +build !gccgo,!appengine
|
||||
// +build go1.11,!gccgo,!purego
|
||||
|
||||
package chacha20
|
||||
|
||||
|
|
3
vendor/golang.org/x/crypto/chacha20/chacha_arm64.s
generated
vendored
3
vendor/golang.org/x/crypto/chacha20/chacha_arm64.s
generated
vendored
|
@ -2,8 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.11
|
||||
// +build !gccgo,!appengine
|
||||
// +build go1.11,!gccgo,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
|
27
vendor/golang.org/x/crypto/chacha20/chacha_generic.go
generated
vendored
27
vendor/golang.org/x/crypto/chacha20/chacha_generic.go
generated
vendored
|
@ -136,6 +136,33 @@ func quarterRound(a, b, c, d uint32) (uint32, uint32, uint32, uint32) {
|
|||
return a, b, c, d
|
||||
}
|
||||
|
||||
// SetCounter sets the Cipher counter. The next invocation of XORKeyStream will
|
||||
// behave as if (64 * counter) bytes had been encrypted so far.
|
||||
//
|
||||
// To prevent accidental counter reuse, SetCounter panics if counter is
|
||||
// less than the current value.
|
||||
func (s *Cipher) SetCounter(counter uint32) {
|
||||
// Internally, s may buffer multiple blocks, which complicates this
|
||||
// implementation slightly. When checking whether the counter has rolled
|
||||
// back, we must use both s.counter and s.len to determine how many blocks
|
||||
// we have already output.
|
||||
outputCounter := s.counter - uint32(s.len)/blockSize
|
||||
if counter < outputCounter {
|
||||
panic("chacha20: SetCounter attempted to rollback counter")
|
||||
}
|
||||
|
||||
// In the general case, we set the new counter value and reset s.len to 0,
|
||||
// causing the next call to XORKeyStream to refill the buffer. However, if
|
||||
// we're advancing within the existing buffer, we can save work by simply
|
||||
// setting s.len.
|
||||
if counter < s.counter {
|
||||
s.len = int(s.counter-counter) * blockSize
|
||||
} else {
|
||||
s.counter = counter
|
||||
s.len = 0
|
||||
}
|
||||
}
|
||||
|
||||
// XORKeyStream XORs each byte in the given slice with a byte from the
|
||||
// cipher's key stream. Dst and src must overlap entirely or not at all.
|
||||
//
|
||||
|
|
2
vendor/golang.org/x/crypto/chacha20/chacha_noasm.go
generated
vendored
2
vendor/golang.org/x/crypto/chacha20/chacha_noasm.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !arm64,!s390x,!ppc64le arm64,!go1.11 gccgo appengine
|
||||
// +build !arm64,!s390x,!ppc64le arm64,!go1.11 gccgo purego
|
||||
|
||||
package chacha20
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go
generated
vendored
2
vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo,!appengine
|
||||
// +build !gccgo,!purego
|
||||
|
||||
package chacha20
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s
generated
vendored
2
vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s
generated
vendored
|
@ -19,7 +19,7 @@
|
|||
// The differences in this and the original implementation are
|
||||
// due to the calling conventions and initialization of constants.
|
||||
|
||||
// +build !gccgo,!appengine
|
||||
// +build !gccgo,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/chacha20/chacha_s390x.go
generated
vendored
2
vendor/golang.org/x/crypto/chacha20/chacha_s390x.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo,!appengine
|
||||
// +build !gccgo,!purego
|
||||
|
||||
package chacha20
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/chacha20/chacha_s390x.s
generated
vendored
2
vendor/golang.org/x/crypto/chacha20/chacha_s390x.s
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo,!appengine
|
||||
// +build !gccgo,!purego
|
||||
|
||||
#include "go_asm.h"
|
||||
#include "textflag.h"
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/mac_noasm.go
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/mac_noasm.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !amd64,!ppc64le gccgo appengine
|
||||
// +build !amd64,!ppc64le gccgo purego
|
||||
|
||||
package poly1305
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/sum_amd64.go
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/sum_amd64.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build amd64,!gccgo,!appengine
|
||||
// +build !gccgo,!purego
|
||||
|
||||
package poly1305
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/sum_amd64.s
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/sum_amd64.s
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build amd64,!gccgo,!appengine
|
||||
// +build !gccgo,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/sum_noasm.go
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/sum_noasm.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build s390x,!go1.11 !amd64,!s390x,!ppc64le gccgo appengine nacl
|
||||
// +build s390x,!go1.11 !amd64,!s390x,!ppc64le gccgo purego
|
||||
|
||||
package poly1305
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build ppc64le,!gccgo,!appengine
|
||||
// +build !gccgo,!purego
|
||||
|
||||
package poly1305
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build ppc64le,!gccgo,!appengine
|
||||
// +build !gccgo,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/sum_s390x.go
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/sum_s390x.go
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build s390x,go1.11,!gccgo,!appengine
|
||||
// +build go1.11,!gccgo,!purego
|
||||
|
||||
package poly1305
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/sum_s390x.s
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/sum_s390x.s
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build s390x,go1.11,!gccgo,!appengine
|
||||
// +build go1.11,!gccgo,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
|
2
vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s
generated
vendored
2
vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build s390x,go1.11,!gccgo,!appengine
|
||||
// +build go1.11,!gccgo,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
|
28
vendor/golang.org/x/crypto/ssh/keys.go
generated
vendored
28
vendor/golang.org/x/crypto/ssh/keys.go
generated
vendored
|
@ -562,9 +562,11 @@ func parseED25519(in []byte) (out PublicKey, rest []byte, err error) {
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
key := ed25519.PublicKey(w.KeyBytes)
|
||||
if l := len(w.KeyBytes); l != ed25519.PublicKeySize {
|
||||
return nil, nil, fmt.Errorf("invalid size %d for Ed25519 public key", l)
|
||||
}
|
||||
|
||||
return (ed25519PublicKey)(key), w.Rest, nil
|
||||
return ed25519PublicKey(w.KeyBytes), w.Rest, nil
|
||||
}
|
||||
|
||||
func (k ed25519PublicKey) Marshal() []byte {
|
||||
|
@ -582,9 +584,11 @@ func (k ed25519PublicKey) Verify(b []byte, sig *Signature) error {
|
|||
if sig.Format != k.Type() {
|
||||
return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
|
||||
}
|
||||
if l := len(k); l != ed25519.PublicKeySize {
|
||||
return fmt.Errorf("ssh: invalid size %d for Ed25519 public key", l)
|
||||
}
|
||||
|
||||
edKey := (ed25519.PublicKey)(k)
|
||||
if ok := ed25519.Verify(edKey, b, sig.Blob); !ok {
|
||||
if ok := ed25519.Verify(ed25519.PublicKey(k), b, sig.Blob); !ok {
|
||||
return errors.New("ssh: signature did not verify")
|
||||
}
|
||||
|
||||
|
@ -838,6 +842,10 @@ func parseSKEd25519(in []byte) (out PublicKey, rest []byte, err error) {
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
if l := len(w.KeyBytes); l != ed25519.PublicKeySize {
|
||||
return nil, nil, fmt.Errorf("invalid size %d for Ed25519 public key", l)
|
||||
}
|
||||
|
||||
key := new(skEd25519PublicKey)
|
||||
key.application = w.Application
|
||||
key.PublicKey = ed25519.PublicKey(w.KeyBytes)
|
||||
|
@ -862,6 +870,9 @@ func (k *skEd25519PublicKey) Verify(data []byte, sig *Signature) error {
|
|||
if sig.Format != k.Type() {
|
||||
return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
|
||||
}
|
||||
if l := len(k.PublicKey); l != ed25519.PublicKeySize {
|
||||
return fmt.Errorf("invalid size %d for Ed25519 public key", l)
|
||||
}
|
||||
|
||||
h := sha256.New()
|
||||
h.Write([]byte(k.application))
|
||||
|
@ -898,8 +909,7 @@ func (k *skEd25519PublicKey) Verify(data []byte, sig *Signature) error {
|
|||
|
||||
original := Marshal(blob)
|
||||
|
||||
edKey := (ed25519.PublicKey)(k.PublicKey)
|
||||
if ok := ed25519.Verify(edKey, original, edSig.Signature); !ok {
|
||||
if ok := ed25519.Verify(k.PublicKey, original, edSig.Signature); !ok {
|
||||
return errors.New("ssh: signature did not verify")
|
||||
}
|
||||
|
||||
|
@ -1051,7 +1061,10 @@ func NewPublicKey(key interface{}) (PublicKey, error) {
|
|||
case *dsa.PublicKey:
|
||||
return (*dsaPublicKey)(key), nil
|
||||
case ed25519.PublicKey:
|
||||
return (ed25519PublicKey)(key), nil
|
||||
if l := len(key); l != ed25519.PublicKeySize {
|
||||
return nil, fmt.Errorf("ssh: invalid size %d for Ed25519 public key", l)
|
||||
}
|
||||
return ed25519PublicKey(key), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("ssh: unsupported key type %T", key)
|
||||
}
|
||||
|
@ -1304,7 +1317,6 @@ func parseOpenSSHPrivateKey(key []byte, decrypt openSSHDecryptFunc) (crypto.Priv
|
|||
return nil, errors.New("ssh: malformed OpenSSH key")
|
||||
}
|
||||
|
||||
// we only handle ed25519 and rsa keys currently
|
||||
switch pk1.Keytype {
|
||||
case KeyAlgoRSA:
|
||||
// https://github.com/openssh/openssh-portable/blob/master/sshkey.c#L2760-L2773
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue