@@ -847,7 +847,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data)
channel_data_t *channel_data = (channel_data_t *)data;
if (channel_data->usessl) {
- memset(channel_data->sha1hash, 0x0, SHA_DIGEST_LENGTH * 2 + 1);
+ memset(channel_data->sha1hash, 0x0, SWUPDATE_SHA_DIGEST_LENGTH * 2 + 1);
channel_data->dgst = swupdate_HASH_init("sha1");
if (!channel_data->dgst) {
result = CHANNEL_EINIT;
@@ -1000,7 +1000,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data)
}
if (channel_data->usessl) {
- unsigned char sha1hash[SHA_DIGEST_LENGTH];
+ unsigned char sha1hash[SWUPDATE_SHA_DIGEST_LENGTH];
unsigned int md_len;
(void)md_len;
if (swupdate_HASH_final(channel_data->dgst, sha1hash, &md_len) != 1) {
@@ -1009,7 +1009,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data)
}
char sha1hexchar[3];
- for (int i = 0; i < SHA_DIGEST_LENGTH; i++) {
+ for (int i = 0; i < SWUPDATE_SHA_DIGEST_LENGTH; i++) {
sprintf(sha1hexchar, "%02x", sha1hash[i]);
strcat(channel_data->sha1hash, sha1hexchar);
}
@@ -19,7 +19,6 @@
#include "handler.h"
#include "flash.h"
#include "util.h"
-#include "sslapi.h"
void ubi_handler(void);
@@ -11,7 +11,6 @@
#endif
#include <stdio.h>
#include <stdbool.h>
-#include "sslapi.h"
#include "swupdate_status.h"
/* Curl Channel Implementation Private Header File.
@@ -63,7 +62,7 @@ typedef struct {
bool nofollow;
int (*checkdwl)(void);
struct swupdate_digest *dgst;
- char sha1hash[SHA_DIGEST_LENGTH * 2 + 1];
+ char sha1hash[SWUPDATE_SHA_DIGEST_LENGTH * 2 + 1];
sourcetype source;
struct dict *headers;
} channel_data_t;
@@ -141,13 +141,6 @@ void swupdate_DECRYPT_cleanup(struct swupdate_digest *dgst);
#define swupdate_DECRYPT_cleanup(p)
#endif
-/*
- * if openSSL is not selected
- */
-#ifndef SHA_DIGEST_LENGTH
-#define SHA_DIGEST_LENGTH 20
-#endif
-
#ifndef SSL_PURPOSE_DEFAULT
#define SSL_PURPOSE_EMAIL_PROT -1
#define SSL_PURPOSE_CODE_SIGN -1
@@ -20,6 +20,9 @@
#define NOTIFY_BUF_SIZE 2048
#define ENOMEM_ASPRINTF -1
+#define SWUPDATE_SHA_DIGEST_LENGTH 20
+#define AES_BLOCK_SIZE 16
+
extern int loglevel;
typedef enum {
@@ -1046,7 +1046,7 @@ server_op_res_t server_process_update_artifact(int action_id,
#ifdef CONFIG_SURICATTA_SSL
if (strncmp((char *)&channel_data.sha1hash,
json_object_get_string(json_data_artifact_sha1hash),
- SHA_DIGEST_LENGTH) != 0) {
+ SWUPDATE_SHA_DIGEST_LENGTH) != 0) {
ERROR(
"Checksum does not match: Should be '%s', but "
"actually is '%s'.\n",
@@ -93,7 +93,7 @@ channel_op_res_t __wrap_channel_get_file(channel_t *this, void *data, int file_h
#ifdef CONFIG_SURICATTA_SSL
channel_data_t *channel_data = (channel_data_t *)data;
strncpy(channel_data->sha1hash, mock_type(char *),
- SHA_DIGEST_LENGTH * 2 + 1);
+ SWUPDATE_SHA_DIGEST_LENGTH * 2 + 1);
#else
(void)data;
#endif
Just a few files require to include headers from openSSL. Because openSSL requires a License Exception, the license for these file must be adjusted to take care that openSSL code is used. Patch tries to limit the number of files requiring this. Signed-off-by: Stefano Babic <sbabic@denx.de> --- corelib/channel_curl.c | 6 +++--- handlers/ubivol_handler.c | 1 - include/channel_curl.h | 3 +-- include/sslapi.h | 7 ------- include/util.h | 3 +++ suricatta/server_hawkbit.c | 2 +- suricatta/test/test_server_hawkbit.c | 2 +- 7 files changed, 9 insertions(+), 15 deletions(-)