openssl/lk: Enable signed boot img check

This uses openssl to check the boot image prior
to jumping to kernel to see if it is a signed
kernel image.

Change-Id: I92927fd9317a0f701dab395cc6d39929c64340c1
diff --git a/platform/init.c b/platform/init.c
index 11bcb8b..49e6e75 100644
--- a/platform/init.c
+++ b/platform/init.c
@@ -60,3 +60,11 @@
 __WEAK void platform_uninit(void)
 {
 }
+
+__WEAK int image_verify(unsigned char * image_ptr,
+			unsigned char * signature_ptr,
+			unsigned int image_size,
+			unsigned hash_type)
+{
+	return 0;
+}
diff --git a/platform/msm_shared/certificate.c b/platform/msm_shared/certificate.c
new file mode 100644
index 0000000..81d3746
--- /dev/null
+++ b/platform/msm_shared/certificate.c
@@ -0,0 +1,122 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <certificate.h>
+
+const char certBuffer [CERTIFICATE_SIZE] ={
+0x30, 0x82, 0x02, 0xd0, 0x30, 0x82, 0x01, 0xb8, 0x02, 0x01, 0x05, 0x30, 0x0d,
+ 0x06, 0x09, 0x2a,
+0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x2f, 0x31,
+ 0x0b, 0x30, 0x09,
+0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09,
+ 0x06, 0x03, 0x55,
+0x04, 0x08, 0x0c, 0x02, 0x43, 0x41, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55,
+ 0x04, 0x0a, 0x0c,
+0x0a, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x20, 0x4c, 0x4b, 0x30, 0x1e,
+ 0x17, 0x0d, 0x31,
+0x31, 0x30, 0x38, 0x30, 0x31, 0x31, 0x34, 0x35, 0x35, 0x33, 0x35, 0x5a, 0x17,
+ 0x0d, 0x33, 0x32,
+0x30, 0x32, 0x31, 0x32, 0x31, 0x34, 0x35, 0x35, 0x33, 0x35, 0x5a, 0x30, 0x2f,
+ 0x31, 0x0b, 0x30,
+0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30,
+ 0x09, 0x06, 0x03,
+0x55, 0x04, 0x08, 0x0c, 0x02, 0x43, 0x41, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
+ 0x55, 0x04, 0x0a,
+0x0c, 0x0a, 0x41, 0x6e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, 0x54, 0xa4, 0xfd, 0xb0,
+ 0x8d, 0xe4, 0xf7,
+0x40, 0xe1, 0x41, 0xdc, 0xf7, 0x98, 0x65, 0x3d, 0x9f, 0xd1, 0x28, 0x23, 0x03,
+ 0x91, 0x6b, 0xab,
+0x52, 0x04, 0x3b, 0xe1, 0x4e, 0x64, 0xea, 0x3b, 0xea, 0x6f, 0x30, 0xad, 0x2c,
+ 0x4a, 0x0e, 0xe2,
+0x79, 0x9c, 0xd3, 0x83};
diff --git a/platform/msm_shared/image_verify.c b/platform/msm_shared/image_verify.c
new file mode 100644
index 0000000..0458c76
--- /dev/null
+++ b/platform/msm_shared/image_verify.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <x509.h>
+#include <certificate.h>
+#include <crypto_hash.h>
+#include "image_verify.h"
+
+/*
+ * Returns -1 if decryption failed otherwise size of plain_text in bytes
+ */
+static int image_decrypt_signature(unsigned char * signature_ptr,
+					unsigned char * plain_text){
+	/*
+	 * Extract Public Key and Decrypt Signature
+	 */
+	int ret = -1;
+	X509 *x509_certificate = NULL;
+	unsigned char *cert_ptr = certBuffer;
+	unsigned int cert_size = sizeof(certBuffer);
+	EVP_PKEY *pub_key = NULL;
+	RSA* rsa_key = NULL;
+
+	/*
+	 * Get Pubkey and Convert the internal EVP_PKEY to RSA internal struct
+	 */
+	if ((x509_certificate = d2i_X509(NULL, &cert_ptr, cert_size)) == NULL){
+		dprintf(CRITICAL,
+			"ERROR: Image Invalid, X509_Certificate is NULL!\n");
+		goto cleanup;
+	}
+	pub_key = X509_get_pubkey(x509_certificate);
+	rsa_key = EVP_PKEY_get1_RSA(pub_key);
+	if (rsa_key == NULL){
+		dprintf(CRITICAL,
+			"ERROR: Boot Invalid, RSA_KEY is NULL!\n");
+		goto cleanup;
+	}
+
+	ret = RSA_public_decrypt(SIGNATURE_SIZE, signature_ptr, plain_text,
+				rsa_key, RSA_PKCS1_PADDING);
+	dprintf(SPEW,
+		"DEBUG openssl: Return of RSA_public_decrypt = %d\n", ret);
+
+cleanup:
+	if (rsa_key != NULL)
+		RSA_free(rsa_key);
+	if (x509_certificate != NULL)
+		X509_free(x509_certificate);
+	if (pub_key != NULL)
+		EVP_PKEY_free(pub_key);
+	return ret;
+}
+
+/*
+ * Returns 1 when image is signed and authorized.
+ * Returns 0 when image is unauthorized.
+ * Expects a pointer to the start of image and pointer to start of sig
+ */
+int image_verify(unsigned char * image_ptr,
+			unsigned char * signature_ptr,
+			unsigned int image_size,
+			unsigned hash_type){
+
+	int ret = -1;
+	int auth = 0;
+	unsigned char * plain_text = NULL;
+	unsigned int digest[8];
+	unsigned int hash_size;
+
+	plain_text = (unsigned char*) calloc(sizeof(char), SIGNATURE_SIZE);
+	if (plain_text == NULL){
+		dprintf(CRITICAL, "ERROR: Calloc failed during verification\n");
+		goto cleanup;
+	}
+
+	ret = image_decrypt_signature(signature_ptr, plain_text);
+	if (ret == -1){
+		dprintf(CRITICAL, "ERROR: Image Invalid! Decryption failed!\n");
+		goto cleanup;
+	}
+
+	/*
+	 * Calculate hash of image for comparison
+	 */
+	hash_size = (hash_type == CRYPTO_AUTH_ALG_SHA256) ?
+						SHA256_SIZE : SHA1_SIZE;
+	hash_find(image_ptr, image_size,
+		(unsigned char*)&digest, hash_type);
+	if(memcmp(plain_text, digest, hash_size) != 0)
+	{
+		dprintf(CRITICAL,
+			"ERROR: Image Invalid! Please use another image!\n");
+		ret = -1;
+		goto cleanup;
+	}
+	else
+	{
+		/* Authorized image */
+		auth = 1;
+	}
+
+	/* Cleanup after complete usage of openssl - cached data and objects */
+cleanup:
+	if (plain_text != NULL)
+		free(plain_text);
+	EVP_cleanup();
+	CRYPTO_cleanup_all_ex_data();
+	ERR_remove_thread_state(NULL);
+	return auth;
+}
diff --git a/platform/msm_shared/include/certificate.h b/platform/msm_shared/include/certificate.h
new file mode 100644
index 0000000..7dde655
--- /dev/null
+++ b/platform/msm_shared/include/certificate.h
@@ -0,0 +1,31 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define CERTIFICATE_SIZE 724
+
+extern const char certBuffer [CERTIFICATE_SIZE];
diff --git a/platform/msm_shared/include/image_verify.h b/platform/msm_shared/include/image_verify.h
new file mode 100644
index 0000000..96ab127
--- /dev/null
+++ b/platform/msm_shared/include/image_verify.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef __IMAGE_VERIFY_H
+#define __IMAGE_VERIFY_H
+
+#define SHA1_SIZE      16
+#define SHA256_SIZE    32
+/* For keys of length 2048 bits */
+#define SIGNATURE_SIZE 256
+
+static int image_decrypt_signature(unsigned char * signature_ptr,
+				unsigned char * plain_text);
+int image_verify(unsigned char * image_ptr,
+			unsigned char * signature_ptr,
+			unsigned int image_size,
+			unsigned hash_type);
+#endif
diff --git a/platform/msm_shared/rules.mk b/platform/msm_shared/rules.mk
index 1181c36..7887a8f 100644
--- a/platform/msm_shared/rules.mk
+++ b/platform/msm_shared/rules.mk
@@ -28,7 +28,9 @@
 			$(LOCAL_DIR)/lcdc.o \
 			$(LOCAL_DIR)/mddi.o \
 			$(LOCAL_DIR)/qgic.o \
-			$(LOCAL_DIR)/mdp4.o
+			$(LOCAL_DIR)/mdp4.o \
+			$(LOCAL_DIR)/certificate.o \
+			$(LOCAL_DIR)/image_verify.o
 endif
 
 ifeq ($(PLATFORM),apq8064)
@@ -43,7 +45,9 @@
 			$(LOCAL_DIR)/qgic.o \
 			$(LOCAL_DIR)/mdp4.o \
 			$(LOCAL_DIR)/crypto4_eng.o \
-			$(LOCAL_DIR)/crypto_hash.o
+			$(LOCAL_DIR)/crypto_hash.o \
+			$(LOCAL_DIR)/certificate.o \
+			$(LOCAL_DIR)/image_verify.o
 endif
 
 ifeq ($(PLATFORM),msm7x27a)
@@ -67,5 +71,7 @@
 			$(LOCAL_DIR)/uart.o \
 			$(LOCAL_DIR)/proc_comm.o \
 			$(LOCAL_DIR)/lcdc.o \
-			$(LOCAL_DIR)/mddi.o
+			$(LOCAL_DIR)/mddi.o \
+			$(LOCAL_DIR)/certificate.o \
+			$(LOCAL_DIR)/image_verify.o
 endif