Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef121b9d authored by Hung-ying Tyan's avatar Hung-ying Tyan Committed by android-build-merger
Browse files

Fix free() in keymaster VTS

am: 79db3ec8

Change-Id: I07a2ccc665ef96d0a746ec36eaa152ec2705665f
parents 1dfb0580 79db3ec8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <iostream>

#include <openssl/evp.h>
#include <openssl/mem.h>
#include <openssl/x509.h>

#include <android/hardware/keymaster/3.0/IKeymasterDevice.h>
@@ -322,11 +323,11 @@ bool verify_chain(const hidl_vec<hidl_vec<uint8_t>>& chain) {
            char* cert_sub = X509_NAME_oneline(X509_get_subject_name(key_cert.get()), nullptr, 0);
            EXPECT_STREQ("/CN=Android Keystore Key", cert_sub)
                << "Cert " << i << " has wrong subject.  (Possibly b/38394614)";
            free(cert_sub);
            OPENSSL_free(cert_sub);
        }

        free(cert_issuer);
        free(signer_subj);
        OPENSSL_free(cert_issuer);
        OPENSSL_free(signer_subj);

        if (dump_Attestations) std::cout << bin2hex(chain[i]) << std::endl;
    }
+4 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <iostream>

#include <openssl/evp.h>
#include <openssl/mem.h>
#include <openssl/x509.h>

#include <cutils/properties.h>
@@ -208,11 +209,11 @@ bool verify_chain(const hidl_vec<hidl_vec<uint8_t>>& chain) {
            char* cert_sub = X509_NAME_oneline(X509_get_subject_name(key_cert.get()), nullptr, 0);
            EXPECT_STREQ("/CN=Android Keystore Key", cert_sub)
                << "Cert " << i << " has wrong subject.";
            free(cert_sub);
            OPENSSL_free(cert_sub);
        }

        free(cert_issuer);
        free(signer_subj);
        OPENSSL_free(cert_issuer);
        OPENSSL_free(signer_subj);

        if (dump_Attestations) std::cout << bin2hex(chain[i]) << std::endl;
    }