skip security checkes on smartcard scp02 algorithm using des

This commit is contained in:
Andrea Franz 2018-10-08 11:43:53 +02:00
parent f10e19e4c2
commit bb9fddd181
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
1 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,8 @@ package crypto
import (
"bytes"
"crypto/cipher"
/* #nosec */
"crypto/des"
)
@ -23,6 +25,7 @@ func DeriveKey(cardKey []byte, seq []byte, purpose []byte) ([]byte, error) {
copy(derivation, purpose[:2])
copy(derivation[2:], seq[:2])
/* #nosec */
block, err := des.NewTripleDESCipher(key24)
if err != nil {
return nil, err
@ -54,11 +57,13 @@ func VerifyCryptogram(encKey, hostChallenge, cardChallenge, cardCryptogram []byt
func MacFull3DES(key, data, iv []byte) ([]byte, error) {
data = AppendDESPadding(data)
/* #nosec */
desBlock, err := des.NewCipher(resizeKey8(key))
if err != nil {
return nil, err
}
/* #nosec */
des3Block, err := des.NewTripleDESCipher(resizeKey24(key))
if err != nil {
return nil, err
@ -85,6 +90,7 @@ func MacFull3DES(key, data, iv []byte) ([]byte, error) {
// EncryptICV encrypts an ICV with the specified macKey.
// The ICV is usually the mac of the previous command sent in the current session.
func EncryptICV(macKey, icv []byte) ([]byte, error) {
/* #nosec */
block, err := des.NewCipher(resizeKey8(macKey))
if err != nil {
return nil, err
@ -101,6 +107,7 @@ func EncryptICV(macKey, icv []byte) ([]byte, error) {
func Mac3DES(key, data, iv []byte) ([]byte, error) {
key24 := resizeKey24(key)
/* #nosec */
block, err := des.NewTripleDESCipher(key24)
if err != nil {
return nil, err