mirror of https://github.com/v2ray/v2ray-core
				
				
				
			Fix misspelling according to goreportcard result (#282)
							parent
							
								
									425b4b497d
								
							
						
					
					
						commit
						454528353d
					
				| 
						 | 
				
			
			@ -209,7 +209,7 @@ func New(ctx context.Context, config *Config) (*Server, error) {
 | 
			
		|||
						ruleIter = 0
 | 
			
		||||
						ruleCurr++
 | 
			
		||||
					}
 | 
			
		||||
				} else { // No original rule, generate one according to current domain matcher (majorly for compability with tests)
 | 
			
		||||
				} else { // No original rule, generate one according to current domain matcher (majorly for compatibility with tests)
 | 
			
		||||
					info.domainRuleIdx = uint16(len(rules))
 | 
			
		||||
					rules = append(rules, matcher.String())
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -382,11 +382,11 @@ func TestStatsChannelConcurrency(t *testing.T) {
 | 
			
		|||
			errCh <- fmt.Sprint("unexpected block from receiving data: ", 1)
 | 
			
		||||
		}
 | 
			
		||||
		// Test `b` is not closed but cannot receive data 2:
 | 
			
		||||
		// Becuase in a new round of messaging, `b` has been unsubscribed.
 | 
			
		||||
		// Because in a new round of messaging, `b` has been unsubscribed.
 | 
			
		||||
		select {
 | 
			
		||||
		case v, ok := <-b:
 | 
			
		||||
			if ok {
 | 
			
		||||
				errCh <- fmt.Sprint("unexpected receving: ", v)
 | 
			
		||||
				errCh <- fmt.Sprint("unexpected receiving: ", v)
 | 
			
		||||
			} else {
 | 
			
		||||
				errCh <- fmt.Sprint("unexpected closing of channel")
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ package generic
 | 
			
		|||
//      var GenericType generic.Type
 | 
			
		||||
type Type interface{}
 | 
			
		||||
 | 
			
		||||
// Number is the placehoder type that indiccates a generic numerical value.
 | 
			
		||||
// Number is the placeholder type that indiccates a generic numerical value.
 | 
			
		||||
// When genny is executed, variables of this type will be replaced with
 | 
			
		||||
// references to the specific types.
 | 
			
		||||
//      var GenericType generic.Number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@ func Addc64(cin, a, b uint64) (ret, cout uint64) {
 | 
			
		|||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Substracts 2 64bit digits in constant time.
 | 
			
		||||
// Subtracts 2 64bit digits in constant time.
 | 
			
		||||
// Returns result and borrow (1 or 0)
 | 
			
		||||
func Subc64(bIn, a, b uint64) (ret, bOut uint64) {
 | 
			
		||||
	var tmp1 = a - b
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -429,7 +429,7 @@ func (point *ProjectivePoint) ToAffine(c *CurveOperations) *Fp2Element {
 | 
			
		|||
 | 
			
		||||
// Cleans data in fp
 | 
			
		||||
func (fp *Fp2Element) Zeroize() {
 | 
			
		||||
	// Zeroizing in 2 seperated loops tells compiler to
 | 
			
		||||
	// Zeroizing in 2 separated loops tells compiler to
 | 
			
		||||
	// use fast runtime.memclr()
 | 
			
		||||
	for i := range fp.A {
 | 
			
		||||
		fp.A[i] = 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ func fp503MontgomeryReduce(z *FpElement, x *FpElementX2) {
 | 
			
		|||
	var uv Uint128
 | 
			
		||||
	var count int
 | 
			
		||||
 | 
			
		||||
	count = 3 // number of 0 digits in the least significat part of p503 + 1
 | 
			
		||||
	count = 3 // number of 0 digits in the least significant part of p503 + 1
 | 
			
		||||
 | 
			
		||||
	for i := 0; i < NumWords; i++ {
 | 
			
		||||
		for j := 0; j < i; j++ {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -219,7 +219,7 @@ func (dest *primeFieldElement) Pow2k(x *primeFieldElement, k uint8) *primeFieldE
 | 
			
		|||
//
 | 
			
		||||
// Returns dest to allow chaining operations.
 | 
			
		||||
func (dest *primeFieldElement) P34(x *primeFieldElement) *primeFieldElement {
 | 
			
		||||
	// Sliding-window strategy computed with etc/scripts/sliding_window_strat_calc.py
 | 
			
		||||
	// Sliding-window strategy computed with etc/scripts/sliding_window_start_calc.py
 | 
			
		||||
	//
 | 
			
		||||
	// This performs sum(powStrategy) + 1 squarings and len(lookup) + len(mulStrategy)
 | 
			
		||||
	// multiplications.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ func fp751MontgomeryReduce(z *FpElement, x *FpElementX2) {
 | 
			
		|||
	var uv Uint128
 | 
			
		||||
	var count int
 | 
			
		||||
 | 
			
		||||
	count = 5 // number of 0 digits in the least significat part of p751 + 1
 | 
			
		||||
	count = 5 // number of 0 digits in the least significant part of p751 + 1
 | 
			
		||||
 | 
			
		||||
	for i := 0; i < NumWords; i++ {
 | 
			
		||||
		for j := 0; j < i; j++ {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ package sidh
 | 
			
		|||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"io"
 | 
			
		||||
 | 
			
		||||
	. "v2ray.com/core/external/github.com/cloudflare/sidh/internal/isogeny"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +174,7 @@ func (prv *PrivateKey) Generate(rand io.Reader) error {
 | 
			
		|||
	// Private key generation takes advantage of the fact that keyspace for secret
 | 
			
		||||
	// key is (0, 2^x - 1), for some possitivite value of 'x' (see SIKE, 1.3.8).
 | 
			
		||||
	// It means that all bytes in the secret key, but the last one, can take any
 | 
			
		||||
	// value between <0x00,0xFF>. Similarily for the last byte, but generation
 | 
			
		||||
	// value between <0x00,0xFF>. Similarly for the last byte, but generation
 | 
			
		||||
	// needs to chop off some bits, to make sure generated value is an element of
 | 
			
		||||
	// a key-space.
 | 
			
		||||
	_, err = io.ReadFull(rand, prv.Scalar)
 | 
			
		||||
| 
						 | 
				
			
			@ -182,7 +183,7 @@ func (prv *PrivateKey) Generate(rand io.Reader) error {
 | 
			
		|||
	}
 | 
			
		||||
	prv.Scalar[len(prv.Scalar)-1] &= (1 << (dp.SecretBitLen % 8)) - 1
 | 
			
		||||
	// Make sure scalar is SecretBitLen long. SIKE spec says that key
 | 
			
		||||
	// space starts from 0, but I'm not confortable with having low
 | 
			
		||||
	// space starts from 0, but I'm not comfortable with having low
 | 
			
		||||
	// value scalars used for private keys. It is still secrure as per
 | 
			
		||||
	// table 5.1 in [SIKE].
 | 
			
		||||
	prv.Scalar[len(prv.Scalar)-1] |= 1 << ((dp.SecretBitLen % 8) - 1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,15 +18,15 @@ func traverseTreePublicKeyA(curve *ProjectiveCurveParameters, xR, phiP, phiQ, ph
 | 
			
		|||
 | 
			
		||||
	cparam := op.CalcCurveParamsEquiv4(curve)
 | 
			
		||||
	phi := Newisogeny4(op.Params.Op)
 | 
			
		||||
	strat := pub.params.A.IsogenyStrategy
 | 
			
		||||
	stratSz := len(strat)
 | 
			
		||||
	strategy := pub.params.A.IsogenyStrategy
 | 
			
		||||
	stratSz := len(strategy)
 | 
			
		||||
 | 
			
		||||
	for j := 1; j <= stratSz; j++ {
 | 
			
		||||
		for i <= stratSz-j {
 | 
			
		||||
			points = append(points, *xR)
 | 
			
		||||
			indices = append(indices, i)
 | 
			
		||||
 | 
			
		||||
			k := strat[sidx]
 | 
			
		||||
			k := strategy[sidx]
 | 
			
		||||
			sidx++
 | 
			
		||||
			op.Pow2k(xR, &cparam, 2*k)
 | 
			
		||||
			i += int(k)
 | 
			
		||||
| 
						 | 
				
			
			@ -57,15 +57,15 @@ func traverseTreeSharedKeyA(curve *ProjectiveCurveParameters, xR *ProjectivePoin
 | 
			
		|||
 | 
			
		||||
	cparam := op.CalcCurveParamsEquiv4(curve)
 | 
			
		||||
	phi := Newisogeny4(op.Params.Op)
 | 
			
		||||
	strat := pub.params.A.IsogenyStrategy
 | 
			
		||||
	stratSz := len(strat)
 | 
			
		||||
	strategy := pub.params.A.IsogenyStrategy
 | 
			
		||||
	stratSz := len(strategy)
 | 
			
		||||
 | 
			
		||||
	for j := 1; j <= stratSz; j++ {
 | 
			
		||||
		for i <= stratSz-j {
 | 
			
		||||
			points = append(points, *xR)
 | 
			
		||||
			indices = append(indices, i)
 | 
			
		||||
 | 
			
		||||
			k := strat[sidx]
 | 
			
		||||
			k := strategy[sidx]
 | 
			
		||||
			sidx++
 | 
			
		||||
			op.Pow2k(xR, &cparam, 2*k)
 | 
			
		||||
			i += int(k)
 | 
			
		||||
| 
						 | 
				
			
			@ -92,15 +92,15 @@ func traverseTreePublicKeyB(curve *ProjectiveCurveParameters, xR, phiP, phiQ, ph
 | 
			
		|||
 | 
			
		||||
	cparam := op.CalcCurveParamsEquiv3(curve)
 | 
			
		||||
	phi := Newisogeny3(op.Params.Op)
 | 
			
		||||
	strat := pub.params.B.IsogenyStrategy
 | 
			
		||||
	stratSz := len(strat)
 | 
			
		||||
	strategy := pub.params.B.IsogenyStrategy
 | 
			
		||||
	stratSz := len(strategy)
 | 
			
		||||
 | 
			
		||||
	for j := 1; j <= stratSz; j++ {
 | 
			
		||||
		for i <= stratSz-j {
 | 
			
		||||
			points = append(points, *xR)
 | 
			
		||||
			indices = append(indices, i)
 | 
			
		||||
 | 
			
		||||
			k := strat[sidx]
 | 
			
		||||
			k := strategy[sidx]
 | 
			
		||||
			sidx++
 | 
			
		||||
			op.Pow3k(xR, &cparam, k)
 | 
			
		||||
			i += int(k)
 | 
			
		||||
| 
						 | 
				
			
			@ -131,15 +131,15 @@ func traverseTreeSharedKeyB(curve *ProjectiveCurveParameters, xR *ProjectivePoin
 | 
			
		|||
 | 
			
		||||
	cparam := op.CalcCurveParamsEquiv3(curve)
 | 
			
		||||
	phi := Newisogeny3(op.Params.Op)
 | 
			
		||||
	strat := pub.params.B.IsogenyStrategy
 | 
			
		||||
	stratSz := len(strat)
 | 
			
		||||
	strategy := pub.params.B.IsogenyStrategy
 | 
			
		||||
	stratSz := len(strategy)
 | 
			
		||||
 | 
			
		||||
	for j := 1; j <= stratSz; j++ {
 | 
			
		||||
		for i <= stratSz-j {
 | 
			
		||||
			points = append(points, *xR)
 | 
			
		||||
			indices = append(indices, i)
 | 
			
		||||
 | 
			
		||||
			k := strat[sidx]
 | 
			
		||||
			k := strategy[sidx]
 | 
			
		||||
			sidx++
 | 
			
		||||
			op.Pow3k(xR, &cparam, k)
 | 
			
		||||
			i += int(k)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1019,7 +1019,7 @@ func (hs *clientHandshakeState) doTLS13Handshake() error {
 | 
			
		|||
	serverHandshakeSecret := hs.keySchedule.deriveSecret(secretHandshakeServer)
 | 
			
		||||
	c.in.exportKey(hs.keySchedule.suite, serverHandshakeSecret)
 | 
			
		||||
	// Already the sender key yet, when using an alternative record layer.
 | 
			
		||||
	// QUIC needs the handshake write key in order to acknowlege Handshake packets.
 | 
			
		||||
	// QUIC needs the handshake write key in order to acknowledge Handshake packets.
 | 
			
		||||
	c.out.exportKey(hs.keySchedule.suite, clientHandshakeSecret)
 | 
			
		||||
	// Do not change the sender key yet, the server must authenticate first.
 | 
			
		||||
	c.in.setKey(c.vers, hs.keySchedule.suite, serverHandshakeSecret)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue