C++ compat
This commit is contained in:
parent
a29fcf90a6
commit
c57b3c58b3
@ -24,11 +24,11 @@ crypto_box_easy(unsigned char *c, const unsigned char *m,
|
|||||||
(void) sizeof(char[crypto_box_ZEROBYTES >=
|
(void) sizeof(char[crypto_box_ZEROBYTES >=
|
||||||
crypto_box_BOXZEROBYTES ? 1 : -1]);
|
crypto_box_BOXZEROBYTES ? 1 : -1]);
|
||||||
m_boxed_len = (size_t) mlen + crypto_box_ZEROBYTES;
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
c_boxed_len = (size_t) mlen + crypto_box_ZEROBYTES;
|
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);
|
free(m_boxed);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -65,13 +65,13 @@ crypto_box_open_easy(unsigned char *m, const unsigned char *c,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
c_boxed_len = clen + crypto_box_BOXZEROBYTES;
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(c_boxed, 0, crypto_box_BOXZEROBYTES);
|
memset(c_boxed, 0, crypto_box_BOXZEROBYTES);
|
||||||
memcpy(c_boxed + crypto_box_BOXZEROBYTES, c, clen);
|
memcpy(c_boxed + crypto_box_BOXZEROBYTES, c, clen);
|
||||||
m_boxed_len = c_boxed_len + crypto_box_MACBYTES;
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
rc = crypto_box_open(m_boxed, c_boxed,
|
rc = crypto_box_open(m_boxed, c_boxed,
|
||||||
|
Loading…
Reference in New Issue
Block a user