Commit 1b255a0c authored by Evan Hunt's avatar Evan Hunt
Browse files

[master] overlooked some memcpy->memmove changes with pkcs11 merge

parent 3040b455
......@@ -114,7 +114,7 @@ pkcs11dh_loadpriv(const dst_key_t *key,
keyTemplate[6].pValue = isc_mem_get(key->mctx, attr->ulValueLen);
if (keyTemplate[6].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[6].pValue, attr->pValue, attr->ulValueLen);
memmove(keyTemplate[6].pValue, attr->pValue, attr->ulValueLen);
keyTemplate[6].ulValueLen = attr->ulValueLen;
attr = pk11_attribute_bytype(priv, CKA_BASE);
......@@ -123,7 +123,7 @@ pkcs11dh_loadpriv(const dst_key_t *key,
keyTemplate[7].pValue = isc_mem_get(key->mctx, attr->ulValueLen);
if (keyTemplate[7].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[7].pValue, attr->pValue, attr->ulValueLen);
memmove(keyTemplate[7].pValue, attr->pValue, attr->ulValueLen);
keyTemplate[7].ulValueLen = attr->ulValueLen;
attr = pk11_attribute_bytype(priv, CKA_VALUE2);
......@@ -132,7 +132,7 @@ pkcs11dh_loadpriv(const dst_key_t *key,
keyTemplate[8].pValue = isc_mem_get(key->mctx, attr->ulValueLen);
if (keyTemplate[8].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[8].pValue, attr->pValue, attr->ulValueLen);
memmove(keyTemplate[8].pValue, attr->pValue, attr->ulValueLen);
keyTemplate[8].ulValueLen = attr->ulValueLen;
PK11_CALL(pkcs_C_CreateObject,
......@@ -205,7 +205,7 @@ pkcs11dh_computesecret(const dst_key_t *pub, const dst_key_t *priv,
mech.pParameter = isc_mem_get(pub->mctx, mech.ulParameterLen);
if (mech.pParameter == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(mech.pParameter, attr->pValue, mech.ulParameterLen);
memmove(mech.pParameter, attr->pValue, mech.ulParameterLen);
ret = pkcs11dh_loadpriv(priv, ctx.session, &hKey);
if (ret != ISC_R_SUCCESS)
......@@ -236,7 +236,7 @@ pkcs11dh_computesecret(const dst_key_t *pub, const dst_key_t *priv,
isc_buffer_availableregion(secret, &r);
if (r.length < attr->ulValueLen - i)
DST_RET(ISC_R_NOSPACE);
memcpy(r.base, secValue + i, attr->ulValueLen - i);
memmove(r.base, secValue + i, attr->ulValueLen - i);
isc_buffer_add(secret, attr->ulValueLen - i);
ret = ISC_R_SUCCESS;
......@@ -418,31 +418,32 @@ pkcs11dh_generate(dst_key_t *key, int generator, void (*callback)(int)) {
isc_mem_get(key->mctx, sizeof(pk11_dh_bn768));
if (pubTemplate[4].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(pubTemplate[4].pValue,
pk11_dh_bn768, sizeof(pk11_dh_bn768));
memmove(pubTemplate[4].pValue,
pk11_dh_bn768, sizeof(pk11_dh_bn768));
pubTemplate[4].ulValueLen = sizeof(pk11_dh_bn768);
} else if (bits == 1024) {
pubTemplate[4].pValue =
isc_mem_get(key->mctx, sizeof(pk11_dh_bn1024));
if (pubTemplate[4].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(pubTemplate[4].pValue,
pk11_dh_bn1024, sizeof(pk11_dh_bn1024));
memmove(pubTemplate[4].pValue,
pk11_dh_bn1024, sizeof(pk11_dh_bn1024));
pubTemplate[4].ulValueLen = sizeof(pk11_dh_bn1024);
} else {
pubTemplate[4].pValue =
isc_mem_get(key->mctx, sizeof(pk11_dh_bn1536));
if (pubTemplate[4].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(pubTemplate[4].pValue,
pk11_dh_bn1536, sizeof(pk11_dh_bn1536));
memmove(pubTemplate[4].pValue,
pk11_dh_bn1536, sizeof(pk11_dh_bn1536));
pubTemplate[4].ulValueLen = sizeof(pk11_dh_bn1536);
}
pubTemplate[5].pValue = isc_mem_get(key->mctx,
sizeof(pk11_dh_bn2));
if (pubTemplate[5].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(pubTemplate[5].pValue, pk11_dh_bn2, sizeof(pk11_dh_bn2));
memmove(pubTemplate[5].pValue, pk11_dh_bn2,
sizeof(pk11_dh_bn2));
pubTemplate[5].ulValueLen = sizeof(pk11_dh_bn2);
} else {
PK11_RET(pkcs_C_GenerateKey,
......@@ -706,16 +707,16 @@ pkcs11dh_todns(const dst_key_t *key, isc_buffer_t *data) {
*r.base = 3;
}
else
memcpy(r.base, prime, plen);
memmove(r.base, prime, plen);
r.base += plen;
uint16_toregion(glen, &r);
if (glen > 0)
memcpy(r.base, base, glen);
memmove(r.base, base, glen);
r.base += glen;
uint16_toregion(publen, &r);
memcpy(r.base, pub, publen);
memmove(r.base, pub, publen);
r.base += publen;
isc_buffer_add(data, dnslen);
......@@ -863,21 +864,21 @@ pkcs11dh_fromdns(dst_key_t *key, isc_buffer_t *data) {
attr[0].pValue = isc_mem_get(key->mctx, plen_);
if (attr[0].pValue == NULL)
goto nomemory;
memcpy(attr[0].pValue, prime, plen_);
memmove(attr[0].pValue, prime, plen_);
attr[0].ulValueLen = (CK_ULONG) plen_;
attr[1].type = CKA_BASE;
attr[1].pValue = isc_mem_get(key->mctx, glen_);
if (attr[1].pValue == NULL)
goto nomemory;
memcpy(attr[1].pValue, base, glen_);
memmove(attr[1].pValue, base, glen_);
attr[1].ulValueLen = (CK_ULONG) glen_;
attr[2].type = CKA_VALUE;
attr[2].pValue = isc_mem_get(key->mctx, publen);
if (attr[2].pValue == NULL)
goto nomemory;
memcpy(attr[2].pValue, pub, publen);
memmove(attr[2].pValue, pub, publen);
attr[2].ulValueLen = (CK_ULONG) publen;
isc_buffer_forward(data, plen + glen + publen + 6);
......@@ -961,25 +962,25 @@ pkcs11dh_tofile(const dst_key_t *key, const char *directory) {
priv.elements[i].tag = TAG_DH_PRIME;
priv.elements[i].length = (unsigned short) prime->ulValueLen;
memcpy(bufs[i], prime->pValue, prime->ulValueLen);
memmove(bufs[i], prime->pValue, prime->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
priv.elements[i].tag = TAG_DH_GENERATOR;
priv.elements[i].length = (unsigned short) base->ulValueLen;
memcpy(bufs[i], base->pValue, base->ulValueLen);
memmove(bufs[i], base->pValue, base->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
priv.elements[i].tag = TAG_DH_PRIVATE;
priv.elements[i].length = (unsigned short) prv->ulValueLen;
memcpy(bufs[i], prv->pValue, prv->ulValueLen);
memmove(bufs[i], prv->pValue, prv->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
priv.elements[i].tag = TAG_DH_PUBLIC;
priv.elements[i].length = (unsigned short) pub->ulValueLen;
memcpy(bufs[i], pub->pValue, pub->ulValueLen);
memmove(bufs[i], pub->pValue, pub->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
......@@ -1034,7 +1035,7 @@ pkcs11dh_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
bn = isc_mem_get(key->mctx, priv.elements[i].length);
if (bn == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(bn, priv.elements[i].data, priv.elements[i].length);
memmove(bn, priv.elements[i].data, priv.elements[i].length);
switch (priv.elements[i].tag) {
case TAG_DH_PRIME:
......
......@@ -126,9 +126,8 @@ pkcs11dsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[6].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[6].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[6].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[6].ulValueLen = attr->ulValueLen;
break;
case CKA_SUBPRIME:
......@@ -137,9 +136,8 @@ pkcs11dsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[7].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[7].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[7].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[7].ulValueLen = attr->ulValueLen;
break;
case CKA_BASE:
......@@ -148,9 +146,8 @@ pkcs11dsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[8].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[8].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[8].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[8].ulValueLen = attr->ulValueLen;
break;
case CKA_VALUE2:
......@@ -159,9 +156,8 @@ pkcs11dsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[9].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[9].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[9].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[9].ulValueLen = attr->ulValueLen;
break;
}
......@@ -260,9 +256,8 @@ pkcs11dsa_createctx_verify(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[5].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[5].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[5].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[5].ulValueLen = attr->ulValueLen;
break;
case CKA_SUBPRIME:
......@@ -271,9 +266,8 @@ pkcs11dsa_createctx_verify(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[6].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[6].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[6].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[6].ulValueLen = attr->ulValueLen;
break;
case CKA_BASE:
......@@ -282,9 +276,8 @@ pkcs11dsa_createctx_verify(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[7].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[7].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[7].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[7].ulValueLen = attr->ulValueLen;
break;
case CKA_VALUE:
......@@ -293,9 +286,8 @@ pkcs11dsa_createctx_verify(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[8].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[8].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[8].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[8].ulValueLen = attr->ulValueLen;
break;
}
......@@ -754,20 +746,20 @@ pkcs11dsa_todns(const dst_key_t *key, isc_buffer_t *data) {
memset(r.base, 0, dnslen);
*r.base++ = t;
cp = (CK_BYTE *) subprime->pValue;
memcpy(r.base + ISC_SHA1_DIGESTLENGTH - subprime->ulValueLen,
cp, subprime->ulValueLen);
memmove(r.base + ISC_SHA1_DIGESTLENGTH - subprime->ulValueLen,
cp, subprime->ulValueLen);
r.base += ISC_SHA1_DIGESTLENGTH;
cp = (CK_BYTE *) prime->pValue;
memcpy(r.base + key->key_size/8 - prime->ulValueLen,
cp, prime->ulValueLen);
memmove(r.base + key->key_size/8 - prime->ulValueLen,
cp, prime->ulValueLen);
r.base += p_bytes;
cp = (CK_BYTE *) base->pValue;
memcpy(r.base + key->key_size/8 - base->ulValueLen,
cp, base->ulValueLen);
memmove(r.base + key->key_size/8 - base->ulValueLen,
cp, base->ulValueLen);
r.base += p_bytes;
cp = (CK_BYTE *) pub_key->pValue;
memcpy(r.base + key->key_size/8 - pub_key->ulValueLen,
cp, pub_key->ulValueLen);
memmove(r.base + key->key_size/8 - pub_key->ulValueLen,
cp, pub_key->ulValueLen);
r.base += p_bytes;
isc_buffer_add(data, dnslen);
......@@ -833,28 +825,28 @@ pkcs11dsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
attr[0].pValue = isc_mem_get(key->mctx, p_bytes);
if (attr[0].pValue == NULL)
goto nomemory;
memcpy(attr[0].pValue, prime, p_bytes);
memmove(attr[0].pValue, prime, p_bytes);
attr[0].ulValueLen = p_bytes;
attr[1].type = CKA_SUBPRIME;
attr[1].pValue = isc_mem_get(key->mctx, ISC_SHA1_DIGESTLENGTH);
if (attr[1].pValue == NULL)
goto nomemory;
memcpy(attr[1].pValue, subprime, ISC_SHA1_DIGESTLENGTH);
memmove(attr[1].pValue, subprime, ISC_SHA1_DIGESTLENGTH);
attr[1].ulValueLen = ISC_SHA1_DIGESTLENGTH;
attr[2].type = CKA_BASE;
attr[2].pValue = isc_mem_get(key->mctx, p_bytes);
if (attr[2].pValue == NULL)
goto nomemory;
memcpy(attr[2].pValue, base, p_bytes);
memmove(attr[2].pValue, base, p_bytes);
attr[2].ulValueLen = p_bytes;
attr[3].type = CKA_VALUE;
attr[3].pValue = isc_mem_get(key->mctx, p_bytes);
if (attr[3].pValue == NULL)
goto nomemory;
memcpy(attr[3].pValue, pub_key, p_bytes);
memmove(attr[3].pValue, pub_key, p_bytes);
attr[3].ulValueLen = p_bytes;
key->keydata.pkey = dsa;
......@@ -935,31 +927,31 @@ pkcs11dsa_tofile(const dst_key_t *key, const char *directory) {
priv.elements[cnt].tag = TAG_DSA_PRIME;
priv.elements[cnt].length = (unsigned short) prime->ulValueLen;
memcpy(bufs[cnt], prime->pValue, prime->ulValueLen);
memmove(bufs[cnt], prime->pValue, prime->ulValueLen);
priv.elements[cnt].data = bufs[cnt];
cnt++;
priv.elements[cnt].tag = TAG_DSA_SUBPRIME;
priv.elements[cnt].length = (unsigned short) subprime->ulValueLen;
memcpy(bufs[cnt], subprime->pValue, subprime->ulValueLen);
memmove(bufs[cnt], subprime->pValue, subprime->ulValueLen);
priv.elements[cnt].data = bufs[cnt];
cnt++;
priv.elements[cnt].tag = TAG_DSA_BASE;
priv.elements[cnt].length = (unsigned short) base->ulValueLen;
memcpy(bufs[cnt], base->pValue, base->ulValueLen);
memmove(bufs[cnt], base->pValue, base->ulValueLen);
priv.elements[cnt].data = bufs[cnt];
cnt++;
priv.elements[cnt].tag = TAG_DSA_PRIVATE;
priv.elements[cnt].length = (unsigned short) priv_key->ulValueLen;
memcpy(bufs[cnt], priv_key->pValue, priv_key->ulValueLen);
memmove(bufs[cnt], priv_key->pValue, priv_key->ulValueLen);
priv.elements[cnt].data = bufs[cnt];
cnt++;
priv.elements[cnt].tag = TAG_DSA_PUBLIC;
priv.elements[cnt].length = (unsigned short) pub_key->ulValueLen;
memcpy(bufs[cnt], pub_key->pValue, pub_key->ulValueLen);
memmove(bufs[cnt], pub_key->pValue, pub_key->ulValueLen);
priv.elements[cnt].data = bufs[cnt];
cnt++;
......@@ -1009,9 +1001,7 @@ pkcs11dsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
bn = isc_mem_get(key->mctx, priv.elements[i].length);
if (bn == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(bn,
priv.elements[i].data,
priv.elements[i].length);
memmove(bn, priv.elements[i].data, priv.elements[i].length);
switch (priv.elements[i].tag) {
case TAG_DSA_PRIME:
......
......@@ -219,9 +219,8 @@ pkcs11ecdsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
attr->ulValueLen);
if (keyTemplate[5].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[5].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[5].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[5].ulValueLen = attr->ulValueLen;
break;
case CKA_VALUE:
......@@ -230,9 +229,8 @@ pkcs11ecdsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
attr->ulValueLen);
if (keyTemplate[6].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[6].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[6].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[6].ulValueLen = attr->ulValueLen;
break;
}
......@@ -328,9 +326,8 @@ pkcs11ecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
attr->ulValueLen);
if (keyTemplate[5].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[5].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[5].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[5].ulValueLen = attr->ulValueLen;
break;
case CKA_EC_POINT:
......@@ -339,9 +336,8 @@ pkcs11ecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
attr->ulValueLen);
if (keyTemplate[6].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[6].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[6].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[6].ulValueLen = attr->ulValueLen;
break;
}
......@@ -437,16 +433,16 @@ pkcs11ecdsa_compare(const dst_key_t *key1, const dst_key_t *key2) {
sizeof(pk11_ecc_prime256v1)); \
if (attr->pValue == NULL) \
DST_RET(ISC_R_NOMEMORY); \
memcpy(attr->pValue, \
pk11_ecc_prime256v1, sizeof(pk11_ecc_prime256v1)); \
memmove(attr->pValue, \
pk11_ecc_prime256v1, sizeof(pk11_ecc_prime256v1)); \
attr->ulValueLen = sizeof(pk11_ecc_prime256v1); \
} else { \
attr->pValue = isc_mem_get(key->mctx, \
sizeof(pk11_ecc_secp384r1)); \
if (attr->pValue == NULL) \
DST_RET(ISC_R_NOMEMORY); \
memcpy(attr->pValue, \
pk11_ecc_secp384r1, sizeof(pk11_ecc_secp384r1)); \
memmove(attr->pValue, \
pk11_ecc_secp384r1, sizeof(pk11_ecc_secp384r1)); \
attr->ulValueLen = sizeof(pk11_ecc_secp384r1); \
}
......@@ -651,7 +647,7 @@ pkcs11ecdsa_todns(const dst_key_t *key, isc_buffer_t *data) {
isc_buffer_availableregion(data, &r);
if (r.length < len)
return (ISC_R_NOSPACE);
memcpy(r.base, (CK_BYTE_PTR) attr->pValue + 3, len);
memmove(r.base, (CK_BYTE_PTR) attr->pValue + 3, len);
isc_buffer_add(data, len);
return (ISC_R_SUCCESS);
......@@ -694,16 +690,16 @@ pkcs11ecdsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
isc_mem_get(key->mctx, sizeof(pk11_ecc_prime256v1));
if (attr->pValue == NULL)
goto nomemory;
memcpy(attr->pValue,
pk11_ecc_prime256v1, sizeof(pk11_ecc_prime256v1));
memmove(attr->pValue,
pk11_ecc_prime256v1, sizeof(pk11_ecc_prime256v1));
attr->ulValueLen = sizeof(pk11_ecc_prime256v1);
} else {
attr->pValue =
isc_mem_get(key->mctx, sizeof(pk11_ecc_secp384r1));
if (attr->pValue == NULL)
goto nomemory;
memcpy(attr->pValue,
pk11_ecc_secp384r1, sizeof(pk11_ecc_secp384r1));
memmove(attr->pValue,
pk11_ecc_secp384r1, sizeof(pk11_ecc_secp384r1));
attr->ulValueLen = sizeof(pk11_ecc_secp384r1);
}
......@@ -715,7 +711,7 @@ pkcs11ecdsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
((CK_BYTE_PTR) attr->pValue)[0] = TAG_OCTECT_STRING;
((CK_BYTE_PTR) attr->pValue)[1] = len + 1;
((CK_BYTE_PTR) attr->pValue)[2] = UNCOMPRESSED;
memcpy((CK_BYTE_PTR) attr->pValue + 3, r.base, len);
memmove((CK_BYTE_PTR) attr->pValue + 3, r.base, len);
attr->ulValueLen = len + 3;
isc_buffer_forward(data, len);
......@@ -768,7 +764,7 @@ pkcs11ecdsa_tofile(const dst_key_t *key, const char *directory) {
return (ISC_R_NOMEMORY);
priv.elements[i].tag = TAG_ECDSA_PRIVATEKEY;
priv.elements[i].length = (unsigned short) attr->ulValueLen;
memcpy(buf, attr->pValue, attr->ulValueLen);
memmove(buf, attr->pValue, attr->ulValueLen);
priv.elements[i].data = buf;
i++;
}
......@@ -840,7 +836,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
if (attr->pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
attr->ulValueLen = pubattr->ulValueLen;
attr++;
......@@ -849,7 +845,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
if (attr->pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
attr->ulValueLen = pubattr->ulValueLen;
ret = pk11_parse_uri(ec, label, key->mctx, OP_EC);
......@@ -973,7 +969,7 @@ pkcs11ecdsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
if (attr->pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(attr->pValue, pattr->pValue, pattr->ulValueLen);
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
attr->ulValueLen = pattr->ulValueLen;
attr++;
......@@ -983,7 +979,7 @@ pkcs11ecdsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
if (attr->pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(attr->pValue, pattr->pValue, pattr->ulValueLen);
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
attr->ulValueLen = pattr->ulValueLen;
attr++;
......@@ -991,7 +987,7 @@ pkcs11ecdsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
attr->pValue = isc_mem_get(key->mctx, priv.elements[0].length);
if (attr->pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(attr->pValue, priv.elements[0].data, priv.elements[0].length);
memmove(attr->pValue, priv.elements[0].data, priv.elements[0].length);
attr->ulValueLen = priv.elements[0].length;
dst__privstruct_free(&priv, mctx);
......
......@@ -189,9 +189,8 @@ pkcs11gost_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[6].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[6].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[6].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[6].ulValueLen = attr->ulValueLen;
break;
}
......@@ -291,9 +290,8 @@ pkcs11gost_createctx_verify(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[5].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[5].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[5].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[5].ulValueLen = attr->ulValueLen;
break;
}
......@@ -644,7 +642,7 @@ pkcs11gost_todns(const dst_key_t *key, isc_buffer_t *data) {
isc_buffer_availableregion(data, &r);
if (r.length < ISC_GOST_PUBKEYLENGTH)
return (ISC_R_NOSPACE);
memcpy(r.base, (CK_BYTE_PTR) attr->pValue, ISC_GOST_PUBKEYLENGTH);
memmove(r.base, (CK_BYTE_PTR) attr->pValue, ISC_GOST_PUBKEYLENGTH);
isc_buffer_add(data, ISC_GOST_PUBKEYLENGTH);
return (ISC_R_SUCCESS);
......@@ -676,7 +674,7 @@ pkcs11gost_fromdns(dst_key_t *key, isc_buffer_t *data) {
attr->pValue = isc_mem_get(key->mctx, ISC_GOST_PUBKEYLENGTH);
if (attr->pValue == NULL)
goto nomemory;
memcpy((CK_BYTE_PTR) attr->pValue, r.base, ISC_GOST_PUBKEYLENGTH);
memmove((CK_BYTE_PTR) attr->pValue, r.base, ISC_GOST_PUBKEYLENGTH);
attr->ulValueLen = ISC_GOST_PUBKEYLENGTH;
isc_buffer_forward(data, ISC_GOST_PUBKEYLENGTH);
......@@ -745,8 +743,8 @@ pkcs11gost_tofile(const dst_key_t *key, const char *directory) {
priv.elements[i].tag = TAG_GOST_PRIVASN1;
priv.elements[i].length =
(unsigned short) attr->ulValueLen + 39;
memcpy(buf, gost_private_der, 39);
memcpy(buf +39, attr->pValue, attr->ulValueLen);
memmove(buf, gost_private_der, 39);
memmove(buf +39, attr->pValue, attr->ulValueLen);
adj = (int) attr->ulValueLen - 32;
if (adj != 0) {
buf[1] += adj;
......@@ -795,7 +793,7 @@ pkcs11gost_tofile(const dst_key_t *key, const char *directory) {
return (ISC_R_NOMEMORY);
priv.elements[i].tag = TAG_GOST_PRIVRAW;
priv.elements[i].length = (unsigned short) attr->ulValueLen;
memcpy(buf, attr->pValue, attr->ulValueLen);
memmove(buf, attr->pValue, attr->ulValueLen);
priv.elements[i].data = buf;
i++;
} else
......@@ -836,7 +834,7 @@ pkcs11gost_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
if ((adj > 0) || (adj < -31))
DST_RET(DST_R_INVALIDPRIVATEKEY);
memcpy(buf, gost_private_der, 39);
memmove(buf, gost_private_der, 39);
if (adj != 0) {
buf[1] += adj;
buf[36] += adj;
......@@ -871,7 +869,7 @@ pkcs11gost_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
if (attr->pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(attr->pValue, pattr->pValue, pattr->ulValueLen);
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
attr->ulValueLen = pattr->ulValueLen;
attr++;
......@@ -879,7 +877,7 @@ pkcs11gost_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
attr->pValue = isc_mem_get(key->mctx, priv.elements[0].length);