mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 15:39:07 +00:00
rainbow: memcpy -> memmove since buffers may overlap
This commit is contained in:
parent
e3db88d7e4
commit
963e87af64
@ -44,7 +44,7 @@ int PQCLEAN_RAINBOWIIICCLASSIC_CLEAN_crypto_sign_open(unsigned char *m, size_t *
|
|||||||
rc = PQCLEAN_RAINBOWIIICCLASSIC_CLEAN_rainbow_verify(digest, sm + mlen[0], (const pk_t *)pk);
|
rc = PQCLEAN_RAINBOWIIICCLASSIC_CLEAN_rainbow_verify(digest, sm + mlen[0], (const pk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
@ -46,7 +46,7 @@ int PQCLEAN_RAINBOWIIICCYCLICCOMPRESSED_CLEAN_crypto_sign_open(unsigned char *m,
|
|||||||
rc = PQCLEAN_RAINBOWIIICCYCLICCOMPRESSED_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
rc = PQCLEAN_RAINBOWIIICCYCLICCOMPRESSED_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
@ -46,7 +46,7 @@ int PQCLEAN_RAINBOWIIICCYCLIC_CLEAN_crypto_sign_open(unsigned char *m, size_t *m
|
|||||||
rc = PQCLEAN_RAINBOWIIICCYCLIC_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
rc = PQCLEAN_RAINBOWIIICCYCLIC_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
@ -44,7 +44,7 @@ int PQCLEAN_RAINBOWIACLASSIC_CLEAN_crypto_sign_open(unsigned char *m, size_t *ml
|
|||||||
rc = PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify(digest, sm + mlen[0], (const pk_t *)pk);
|
rc = PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify(digest, sm + mlen[0], (const pk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
@ -46,7 +46,7 @@ int PQCLEAN_RAINBOWIACYCLICCOMPRESSED_CLEAN_crypto_sign_open(unsigned char *m, s
|
|||||||
rc = PQCLEAN_RAINBOWIACYCLICCOMPRESSED_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
rc = PQCLEAN_RAINBOWIACYCLICCOMPRESSED_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
@ -46,7 +46,7 @@ int PQCLEAN_RAINBOWIACYCLIC_CLEAN_crypto_sign_open(unsigned char *m, size_t *mle
|
|||||||
rc = PQCLEAN_RAINBOWIACYCLIC_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
rc = PQCLEAN_RAINBOWIACYCLIC_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
@ -44,7 +44,7 @@ int PQCLEAN_RAINBOWVCCLASSIC_CLEAN_crypto_sign_open(unsigned char *m, size_t *ml
|
|||||||
rc = PQCLEAN_RAINBOWVCCLASSIC_CLEAN_rainbow_verify(digest, sm + mlen[0], (const pk_t *)pk);
|
rc = PQCLEAN_RAINBOWVCCLASSIC_CLEAN_rainbow_verify(digest, sm + mlen[0], (const pk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
@ -46,7 +46,7 @@ int PQCLEAN_RAINBOWVCCYCLICCOMPRESSED_CLEAN_crypto_sign_open(unsigned char *m, s
|
|||||||
rc = PQCLEAN_RAINBOWVCCYCLICCOMPRESSED_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
rc = PQCLEAN_RAINBOWVCCYCLICCOMPRESSED_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
@ -46,7 +46,7 @@ int PQCLEAN_RAINBOWVCCYCLIC_CLEAN_crypto_sign_open(unsigned char *m, size_t *mle
|
|||||||
rc = PQCLEAN_RAINBOWVCCYCLIC_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
rc = PQCLEAN_RAINBOWVCCYCLIC_CLEAN_rainbow_verify_cyclic(digest, sm + mlen[0], (const cpk_t *)pk);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
memcpy(m, sm, smlen - _SIGNATURE_BYTE);
|
memmove(m, sm, smlen - _SIGNATURE_BYTE);
|
||||||
} else { // bad signature
|
} else { // bad signature
|
||||||
*mlen = (size_t) -1;
|
*mlen = (size_t) -1;
|
||||||
memset(m, 0, smlen);
|
memset(m, 0, smlen);
|
||||||
|
Loading…
Reference in New Issue
Block a user