C++ compat

This commit is contained in:
Frank Denis 2013-12-31 15:36:10 +01:00
parent a29fcf90a6
commit c57b3c58b3

View File

@ -24,11 +24,11 @@ crypto_box_easy(unsigned char *c, const unsigned char *m,
(void) sizeof(char[crypto_box_ZEROBYTES >=
crypto_box_BOXZEROBYTES ? 1 : -1]);
m_boxed_len = (size_t) mlen + crypto_box_ZEROBYTES;
if ((m_boxed = malloc((size_t) m_boxed_len)) == NULL) {
if ((m_boxed = (unsigned char *) malloc((size_t) m_boxed_len)) == NULL) {
return -1;
}
c_boxed_len = (size_t) mlen + crypto_box_ZEROBYTES;
if ((c_boxed = malloc(c_boxed_len)) == NULL) {
if ((c_boxed = (unsigned char *) malloc(c_boxed_len)) == NULL) {
free(m_boxed);
return -1;
}
@ -65,13 +65,13 @@ crypto_box_open_easy(unsigned char *m, const unsigned char *c,
return -1;
}
c_boxed_len = clen + crypto_box_BOXZEROBYTES;
if ((c_boxed = malloc(c_boxed_len)) == NULL) {
if ((c_boxed = (unsigned char *) malloc(c_boxed_len)) == NULL) {
return -1;
}
memset(c_boxed, 0, crypto_box_BOXZEROBYTES);
memcpy(c_boxed + crypto_box_BOXZEROBYTES, c, clen);
m_boxed_len = c_boxed_len + crypto_box_MACBYTES;
if ((m_boxed = malloc(m_boxed_len)) == NULL) {
if ((m_boxed = (unsigned char *) malloc(m_boxed_len)) == NULL) {
return -1;
}
rc = crypto_box_open(m_boxed, c_boxed,