bootutil/includes/enc_key: move public part to enc_key_public.h
Part of defines which are needed for bootutil_public.c compilation
were moved to separate file, so the bootutil_public library doesn't
need to include cryptographic libraries headers anymore.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
diff --git a/boot/bootutil/include/bootutil/enc_key.h b/boot/bootutil/include/bootutil/enc_key.h
index bcbe897..779b0d4 100644
--- a/boot/bootutil/include/bootutil/enc_key.h
+++ b/boot/bootutil/include/bootutil/enc_key.h
@@ -32,29 +32,14 @@
#include <flash_map_backend/flash_map_backend.h>
#include "bootutil/crypto/aes_ctr.h"
#include "bootutil/image.h"
+#include "bootutil/enc_key_public.h"
#ifdef __cplusplus
extern "C" {
#endif
-#define BOOT_ENC_KEY_SIZE 16
#define BOOT_ENC_KEY_SIZE_BITS (BOOT_ENC_KEY_SIZE * 8)
-#define TLV_ENC_RSA_SZ 256
-#define TLV_ENC_KW_SZ 24
-#define TLV_ENC_EC256_SZ (65 + 32 + 16)
-#define TLV_ENC_X25519_SZ (32 + 32 + 16)
-
-#if defined(MCUBOOT_ENCRYPT_RSA)
-#define BOOT_ENC_TLV_SIZE TLV_ENC_RSA_SZ
-#elif defined(MCUBOOT_ENCRYPT_EC256)
-#define BOOT_ENC_TLV_SIZE TLV_ENC_EC256_SZ
-#elif defined(MCUBOOT_ENCRYPT_X25519)
-#define BOOT_ENC_TLV_SIZE TLV_ENC_X25519_SZ
-#else
-#define BOOT_ENC_TLV_SIZE TLV_ENC_KW_SZ
-#endif
-
#define BOOT_ENC_TLV_ALIGN_SIZE \
((((BOOT_ENC_TLV_SIZE - 1) / BOOT_MAX_ALIGN) + 1) * BOOT_MAX_ALIGN)
diff --git a/boot/bootutil/include/bootutil/enc_key_public.h b/boot/bootutil/include/bootutil/enc_key_public.h
new file mode 100644
index 0000000..634f842
--- /dev/null
+++ b/boot/bootutil/include/bootutil/enc_key_public.h
@@ -0,0 +1,56 @@
+/*
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Copyright (c) 2018-2019 JUUL Labs
+ * Copyright (c) 2019 Arm Limited
+ * Copyright (c) 2021 Nordic Semiconductor ASA
+ *
+ * Original license:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef BOOTUTIL_ENC_KEY_PUBLIC_H
+#define BOOTUTIL_ENC_KEY_PUBLIC_H
+#include <mcuboot_config/mcuboot_config.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define BOOT_ENC_KEY_SIZE 16
+
+#define TLV_ENC_RSA_SZ 256
+#define TLV_ENC_KW_SZ 24
+#define TLV_ENC_EC256_SZ (65 + 32 + 16)
+#define TLV_ENC_X25519_SZ (32 + 32 + 16)
+
+#if defined(MCUBOOT_ENCRYPT_RSA)
+#define BOOT_ENC_TLV_SIZE TLV_ENC_RSA_SZ
+#elif defined(MCUBOOT_ENCRYPT_EC256)
+#define BOOT_ENC_TLV_SIZE TLV_ENC_EC256_SZ
+#elif defined(MCUBOOT_ENCRYPT_X25519)
+#define BOOT_ENC_TLV_SIZE TLV_ENC_X25519_SZ
+#else
+#define BOOT_ENC_TLV_SIZE TLV_ENC_KW_SZ
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOOTUTIL_ENC_KEY_PUBLIC_H */
\ No newline at end of file
diff --git a/boot/bootutil/src/bootutil_public.c b/boot/bootutil/src/bootutil_public.c
index 9891aea..5afe305 100644
--- a/boot/bootutil/src/bootutil_public.c
+++ b/boot/bootutil/src/bootutil_public.c
@@ -47,7 +47,7 @@
#include "bootutil/bootutil_public.h"
#include "bootutil/bootutil_log.h"
#ifdef MCUBOOT_ENC_IMAGES
-#include "bootutil/enc_key.h"
+#include "bootutil/enc_key_public.h"
#endif
#ifdef CONFIG_MCUBOOT