Source file src/crypto/internal/fips140/ecdh/order_test.go

     1  // Copyright 2024 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ecdh
     6  
     7  import (
     8  	"bytes"
     9  	"crypto/elliptic"
    10  	"testing"
    11  )
    12  
    13  func TestOrders(t *testing.T) {
    14  	if !bytes.Equal(elliptic.P224().Params().N.Bytes(), P224().N) {
    15  		t.Errorf("P-224 order mismatch")
    16  	}
    17  	if !bytes.Equal(elliptic.P256().Params().N.Bytes(), P256().N) {
    18  		t.Errorf("P-256 order mismatch")
    19  	}
    20  	if !bytes.Equal(elliptic.P384().Params().N.Bytes(), P384().N) {
    21  		t.Errorf("P-384 order mismatch")
    22  	}
    23  	if !bytes.Equal(elliptic.P521().Params().N.Bytes(), P521().N) {
    24  		t.Errorf("P-521 order mismatch")
    25  	}
    26  }
    27  

View as plain text