Blame SOURCES/jss-fix-algorithm-identifier-encode-decode.patch

daca20
From 7c7a97f60c1b3400b921981a3cd9e9aae4f28987 Mon Sep 17 00:00:00 2001
daca20
From: Christina Fu <cfu@redhat.com>
daca20
Date: Tue, 26 Jun 2018 17:59:28 -0700
daca20
Subject: [PATCH] Ticket 12 AlgorithmIdentifier decode/encode process alters
daca20
 original data
daca20
daca20
This patch provides fix to ensure that the encoding and decoding of an AlgorithmIdentifier
daca20
structure would not alter the data.
daca20
daca20
credit: original fix suggestion provided by david.k.stutzman2.ctr@mail.mil
daca20
daca20
fixes https://pagure.io/jss/issue/12
daca20
---
daca20
 org/mozilla/jss/pkix/primitive/AlgorithmIdentifier.java | 13 +------------
daca20
 1 file changed, 1 insertion(+), 12 deletions(-)
daca20
daca20
diff --git a/org/mozilla/jss/pkix/primitive/AlgorithmIdentifier.java b/org/mozilla/jss/pkix/primitive/AlgorithmIdentifier.java
daca20
index 0662f76..3487707 100644
91a7bc
--- a/jss/org/mozilla/jss/pkix/primitive/AlgorithmIdentifier.java
91a7bc
+++ b/jss/org/mozilla/jss/pkix/primitive/AlgorithmIdentifier.java
daca20
@@ -103,19 +103,8 @@ public static class Template implements ASN1Template {
daca20
         Assert._assert( seq.size() == 2 );
daca20
 
daca20
         OBJECT_IDENTIFIER algOID = (OBJECT_IDENTIFIER)seq.elementAt(0);
daca20
-        boolean allowParams = true;
daca20
-        try {
daca20
-            if (algOID.equals(SignatureAlgorithm.ECSignatureWithSHA256Digest.toOID()) ||
daca20
-                algOID.equals(SignatureAlgorithm.ECSignatureWithSHA384Digest.toOID()) ||
daca20
-                algOID.equals(SignatureAlgorithm.ECSignatureWithSHA512Digest.toOID())) {
daca20
-                allowParams = false;
daca20
-            }
daca20
-        } catch (NoSuchAlgorithmException e) {
daca20
-            // System.out.println("JSS: AlgorithmIdentifier:decode: " + e.toString());
daca20
-            // unlikely to happen; swallow it. treat it as allowParams;
daca20
-        }
daca20
 
daca20
-        if (!allowParams) {
daca20
+        if (seq.elementAt(1) == null) {
daca20
             return new AlgorithmIdentifier(
daca20
                 algOID  // OID
daca20
             );
daca20
-- 
91a7bc
2.14.4
daca20