summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-08-04 13:24:11 -0400
committerPeter Jones <pjones@redhat.com>2021-09-07 17:05:04 -0400
commite13ac7386ea425c9222e05a2f9879d5af5cb91f6 (patch)
treeb4a9ee9785709a1ac74f1d8c3f431b481e8e960f
parent0837d010a6ee140ff3cc770aadc89fbb015a7ca2 (diff)
downloadefi-boot-shim-e13ac7386ea425c9222e05a2f9879d5af5cb91f6.tar.gz
efi-boot-shim-e13ac7386ea425c9222e05a2f9879d5af5cb91f6.zip
Make CopyMem() work with EFI's declaration
EFI_BOOT_SERVICES includes CopyMem() and SetMem() functions which are marked EFIAPI, and in the case of CopyMem() does not mark the source argument as CONST. This patch makes all our invocations work with that, so (once gnu-efi's implementation is fixed to match) we can use the existing implementation as the implementation in a mock EFI_BOOT_SERVICES. Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--Cryptlib/Hash/CryptMd5.c2
-rw-r--r--Cryptlib/Hash/CryptSha1.c2
-rw-r--r--Cryptlib/Hash/CryptSha256.c2
-rw-r--r--Cryptlib/Hash/CryptSha512.c4
-rw-r--r--Cryptlib/Include/OpenSslSupport.h4
-rw-r--r--Cryptlib/Pk/CryptPkcs7Verify.c2
-rw-r--r--httpboot.c6
-rw-r--r--lib/variables.c6
8 files changed, 14 insertions, 14 deletions
diff --git a/Cryptlib/Hash/CryptMd5.c b/Cryptlib/Hash/CryptMd5.c
index ccf6ad00..b389f0e1 100644
--- a/Cryptlib/Hash/CryptMd5.c
+++ b/Cryptlib/Hash/CryptMd5.c
@@ -93,7 +93,7 @@ Md5Duplicate (
return FALSE;
}
- CopyMem (NewMd5Context, Md5Context, sizeof (MD5_CTX));
+ CopyMem (NewMd5Context, (void *)Md5Context, sizeof (MD5_CTX));
return TRUE;
}
diff --git a/Cryptlib/Hash/CryptSha1.c b/Cryptlib/Hash/CryptSha1.c
index 42cfd08a..3e67a805 100644
--- a/Cryptlib/Hash/CryptSha1.c
+++ b/Cryptlib/Hash/CryptSha1.c
@@ -92,7 +92,7 @@ Sha1Duplicate (
return FALSE;
}
- CopyMem (NewSha1Context, Sha1Context, sizeof (SHA_CTX));
+ CopyMem (NewSha1Context, (void *)Sha1Context, sizeof (SHA_CTX));
return TRUE;
}
diff --git a/Cryptlib/Hash/CryptSha256.c b/Cryptlib/Hash/CryptSha256.c
index 06ecb2e9..05bc6b0a 100644
--- a/Cryptlib/Hash/CryptSha256.c
+++ b/Cryptlib/Hash/CryptSha256.c
@@ -91,7 +91,7 @@ Sha256Duplicate (
return FALSE;
}
- CopyMem (NewSha256Context, Sha256Context, sizeof (SHA256_CTX));
+ CopyMem (NewSha256Context, (void *)Sha256Context, sizeof (SHA256_CTX));
return TRUE;
}
diff --git a/Cryptlib/Hash/CryptSha512.c b/Cryptlib/Hash/CryptSha512.c
index 3ce372a0..16063b23 100644
--- a/Cryptlib/Hash/CryptSha512.c
+++ b/Cryptlib/Hash/CryptSha512.c
@@ -93,7 +93,7 @@ Sha384Duplicate (
return FALSE;
}
- CopyMem (NewSha384Context, Sha384Context, sizeof (SHA512_CTX));
+ CopyMem (NewSha384Context, (void *)Sha384Context, sizeof (SHA512_CTX));
return TRUE;
}
@@ -308,7 +308,7 @@ Sha512Duplicate (
return FALSE;
}
- CopyMem (NewSha512Context, Sha512Context, sizeof (SHA512_CTX));
+ CopyMem (NewSha512Context, (void *)Sha512Context, sizeof (SHA512_CTX));
return TRUE;
}
diff --git a/Cryptlib/Include/OpenSslSupport.h b/Cryptlib/Include/OpenSslSupport.h
index b97149e2..0c2fb8b0 100644
--- a/Cryptlib/Include/OpenSslSupport.h
+++ b/Cryptlib/Include/OpenSslSupport.h
@@ -262,11 +262,11 @@ extern FILE *stdout;
//
// Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions
//
-#define memcpy(dest,source,count) ( {CopyMem(dest,source,(UINTN)(count)); dest; })
+#define memcpy(dest,source,count) ( {CopyMem(dest,(void *)source,(UINTN)(count)); dest; })
#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
#define memchr(buf,ch,count) ScanMem8((CHAR8 *)buf,(UINTN)(count),ch)
#define memcmp(buf1,buf2,count) (int)(CompareMem(buf1,buf2,(UINTN)(count)))
-#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
+#define memmove(dest,source,count) CopyMem(dest,(void *)source,(UINTN)(count))
#define localtime(timer) NULL
#define assert(expression)
#define atoi(nptr) AsciiStrDecimalToUintn((const CHAR8 *)nptr)
diff --git a/Cryptlib/Pk/CryptPkcs7Verify.c b/Cryptlib/Pk/CryptPkcs7Verify.c
index 09895d8c..c1893848 100644
--- a/Cryptlib/Pk/CryptPkcs7Verify.c
+++ b/Cryptlib/Pk/CryptPkcs7Verify.c
@@ -216,7 +216,7 @@ WrapPkcs7Data (
//
// Part7: P7Data.
//
- CopyMem (SignedData + 19, P7Data, P7Length);
+ CopyMem (SignedData + 19, (void *)P7Data, P7Length);
}
*WrapFlag = Wrapped;
diff --git a/httpboot.c b/httpboot.c
index 5d16bc1e..3340a7f9 100644
--- a/httpboot.c
+++ b/httpboot.c
@@ -179,8 +179,8 @@ generate_next_uri (CONST CHAR8 *current_uri, CONST CHAR8 *next_loader,
if (!*uri)
return EFI_OUT_OF_RESOURCES;
- CopyMem(*uri, current_uri, path_len);
- CopyMem(*uri + path_len, next_loader, next_len);
+ CopyMem(*uri, (void *)current_uri, path_len);
+ CopyMem(*uri + path_len, (void *)next_loader, next_len);
(*uri)[path_len + next_len] = '\0';
return EFI_SUCCESS;
@@ -209,7 +209,7 @@ extract_hostname (CONST CHAR8 *url, CHAR8 **hostname)
if (!*hostname)
return EFI_OUT_OF_RESOURCES;
- CopyMem(*hostname, start, host_len);
+ CopyMem(*hostname, (void *)start, host_len);
(*hostname)[host_len] = '\0';
return EFI_SUCCESS;
diff --git a/lib/variables.c b/lib/variables.c
index ff61d0e2..3ec05478 100644
--- a/lib/variables.c
+++ b/lib/variables.c
@@ -49,7 +49,7 @@ fill_esl(const EFI_SIGNATURE_DATA *first_sig, const size_t howmany,
sl->SignatureListSize = needed;
sd = (EFI_SIGNATURE_DATA *)(out + sizeof(EFI_SIGNATURE_LIST));
- CopyMem(sd, first_sig, data_len);
+ CopyMem(sd, (void *)first_sig, data_len);
return EFI_SUCCESS;
}
@@ -69,8 +69,8 @@ fill_esl_with_one_signature(const uint8_t *data, const uint32_t data_len,
if (out) {
sd = AllocateZeroPool(sig_size);
if (owner)
- CopyMem(sd, owner, sizeof(EFI_GUID));
- CopyMem(sd->SignatureData, data, data_len);
+ CopyMem(sd, (void *)owner, sizeof(EFI_GUID));
+ CopyMem(sd->SignatureData, (void *)data, data_len);
}
efi_status = fill_esl(sd, 1, type, sig_size, out, outlen);