Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(153)

Unified Diff: src/pkg/crypto/rsa/pkcs1v15.go

Issue 5625045: code review 5625045: crypto/...: more fixes for bug 2841 (Closed)
Patch Set: diff -r ab8a2146f8f1 https://go.googlecode.com/hg/ Created 13 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/crypto/rand/rand_unix.go ('k') | src/pkg/crypto/rsa/rsa.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/crypto/rsa/pkcs1v15.go
===================================================================
--- a/src/pkg/crypto/rsa/pkcs1v15.go
+++ b/src/pkg/crypto/rsa/pkcs1v15.go
@@ -21,7 +21,7 @@
func EncryptPKCS1v15(rand io.Reader, pub *PublicKey, msg []byte) (out []byte, err error) {
k := (pub.N.BitLen() + 7) / 8
if len(msg) > k-11 {
- err = MessageTooLongError{}
+ err = ErrMessageTooLong
return
}
@@ -47,7 +47,7 @@
func DecryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (out []byte, err error) {
valid, out, err := decryptPKCS1v15(rand, priv, ciphertext)
if err == nil && valid == 0 {
- err = DecryptionError{}
+ err = ErrDecryption
}
return
@@ -69,7 +69,7 @@
func DecryptPKCS1v15SessionKey(rand io.Reader, priv *PrivateKey, ciphertext []byte, key []byte) (err error) {
k := (priv.N.BitLen() + 7) / 8
if k-(len(key)+3+8) < 0 {
- err = DecryptionError{}
+ err = ErrDecryption
return
}
@@ -86,7 +86,7 @@
func decryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (valid int, msg []byte, err error) {
k := (priv.N.BitLen() + 7) / 8
if k < 11 {
- err = DecryptionError{}
+ err = ErrDecryption
return
}
@@ -170,7 +170,7 @@
tLen := len(prefix) + hashLen
k := (priv.N.BitLen() + 7) / 8
if k < tLen+11 {
- return nil, MessageTooLongError{}
+ return nil, ErrMessageTooLong
}
// EM = 0x00 || 0x01 || PS || 0x00 || T
@@ -203,7 +203,7 @@
tLen := len(prefix) + hashLen
k := (pub.N.BitLen() + 7) / 8
if k < tLen+11 {
- err = VerificationError{}
+ err = ErrVerification
return
}
@@ -223,7 +223,7 @@
}
if ok != 1 {
- return VerificationError{}
+ return ErrVerification
}
return nil
« no previous file with comments | « src/pkg/crypto/rand/rand_unix.go ('k') | src/pkg/crypto/rsa/rsa.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b