Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
db4e48ec
Commit
db4e48ec
authored
Nov 06, 2009
by
Adam Langley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
big: fix carry error, add test case.
crypto/x509: reenable tests. R=gri CC=go-dev
http://go/go-review/1026004
parent
56eca9da
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
17 deletions
+31
-17
src/pkg/big/arith.go
src/pkg/big/arith.go
+0
-3
src/pkg/big/arith_test.go
src/pkg/big/arith_test.go
+2
-1
src/pkg/big/int_test.go
src/pkg/big/int_test.go
+29
-0
src/pkg/crypto/x509/x509_test.go
src/pkg/crypto/x509/x509_test.go
+0
-13
No files found.
src/pkg/big/arith.go
View file @
db4e48ec
...
...
@@ -82,9 +82,6 @@ func mulWW_g(x, y Word) (z1, z0 Word) {
// z = z[1]*_B + z[0] = x*y
z0
=
t1
<<
_W2
+
t0
;
z1
=
(
t1
+
t0
>>
_W2
)
>>
_W2
;
if
z0
<
t0
{
z1
++
;
}
return
;
}
...
...
src/pkg/big/arith_test.go
View file @
db4e48ec
...
...
@@ -278,10 +278,11 @@ type mulWWTest struct {
var
mulWWTests
=
[]
mulWWTest
{
mulWWTest
{
_M
,
_M
,
_M
-
1
,
1
},
// 32 bit only: mulWWTest{0xc47dfa8c, 50911, 0x98a4, 0x998587f4},
}
func
TestMulWW
W
(
t
*
testing
.
T
)
{
func
TestMulWW
(
t
*
testing
.
T
)
{
for
i
,
test
:=
range
mulWWTests
{
q
,
r
:=
mulWW_g
(
test
.
x
,
test
.
y
);
if
q
!=
test
.
q
||
r
!=
test
.
r
{
...
...
src/pkg/big/int_test.go
View file @
db4e48ec
...
...
@@ -263,11 +263,40 @@ func checkDiv(x, y []byte) bool {
}
type
divTest
struct
{
x
,
y
string
;
q
,
r
string
;
}
var
divTests
=
[]
divTest
{
divTest
{
"476217953993950760840509444250624797097991362735329973741718102894495832294430498335824897858659711275234906400899559094370964723884706254265559534144986498357"
,
"9353930466774385905609975137998169297361893554149986716853295022578535724979483772383667534691121982974895531435241089241440253066816724367338287092081996"
,
"50911"
,
"1"
,
},
}
func
TestDiv
(
t
*
testing
.
T
)
{
err
:=
quick
.
Check
(
checkDiv
,
nil
);
if
err
!=
nil
{
t
.
Error
(
err
);
}
for
i
,
test
:=
range
divTests
{
x
,
_
:=
new
(
Int
)
.
SetString
(
test
.
x
,
10
);
y
,
_
:=
new
(
Int
)
.
SetString
(
test
.
y
,
10
);
expectedQ
,
_
:=
new
(
Int
)
.
SetString
(
test
.
q
,
10
);
expectedR
,
_
:=
new
(
Int
)
.
SetString
(
test
.
r
,
10
);
q
,
r
:=
new
(
Int
)
.
Div
(
x
,
y
);
if
CmpInt
(
q
,
expectedQ
)
!=
0
||
CmpInt
(
r
,
expectedR
)
!=
0
{
t
.
Errorf
(
"#%d got (%s, %s) want (%s, %s)"
,
i
,
q
,
r
,
expectedQ
,
expectedR
);
}
}
}
...
...
src/pkg/crypto/x509/x509_test.go
View file @
db4e48ec
...
...
@@ -4,17 +4,6 @@
package
x509
import
"testing"
func
TestToKeepGoTestHappy
(
t
*
testing
.
T
)
{
}
/*
Div is broken for this key in 32-bit mode.
TODO(agl): reenabled when Div is fixed.
import
(
"big"
;
"crypto/rsa"
;
...
...
@@ -61,5 +50,3 @@ var rsaPrivateKey = &rsa.PrivateKey{
P
:
bigFromString
(
"98920366548084643601728869055592650835572950932266967461790948584315647051443"
),
Q
:
bigFromString
(
"94560208308847015747498523884063394671606671904944666360068158221458669711639"
),
}
*/
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment