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

This commit is contained in:
Evan Hunt
2014-01-21 10:08:01 -08:00
parent 3040b45515
commit 1b255a0c4e
8 changed files with 146 additions and 172 deletions
+24 -23
View File
@@ -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:
+34 -44
View File
@@ -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:
+24 -28
View File
@@ -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);
+12 -14
View File
@@ -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);
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);
+36 -47
View File
@@ -121,9 +121,8 @@ pkcs11rsa_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_PUBLIC_EXPONENT:
@@ -132,9 +131,8 @@ pkcs11rsa_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_PRIVATE_EXPONENT:
@@ -143,9 +141,8 @@ pkcs11rsa_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_PRIME_1:
@@ -154,9 +151,8 @@ pkcs11rsa_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;
case CKA_PRIME_2:
@@ -165,9 +161,8 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[10].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[10].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[10].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[10].ulValueLen = attr->ulValueLen;
break;
case CKA_EXPONENT_1:
@@ -176,9 +171,8 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[11].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[11].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[11].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[11].ulValueLen = attr->ulValueLen;
break;
case CKA_EXPONENT_2:
@@ -187,9 +181,8 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[12].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[12].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[12].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[12].ulValueLen = attr->ulValueLen;
break;
case CKA_COEFFICIENT:
@@ -198,9 +191,8 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
attr->ulValueLen);
if (keyTemplate[13].pValue == NULL)
DST_RET(ISC_R_NOMEMORY);
memcpy(keyTemplate[13].pValue,
attr->pValue,
attr->ulValueLen);
memmove(keyTemplate[13].pValue, attr->pValue,
attr->ulValueLen);
keyTemplate[13].ulValueLen = attr->ulValueLen;
break;
}
@@ -319,9 +311,8 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits,
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_PUBLIC_EXPONENT:
@@ -330,9 +321,8 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits,
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;
if (pk11_numbits(attr->pValue,
attr->ulValueLen) > maxbits &&
@@ -785,9 +775,9 @@ pkcs11rsa_todns(const dst_key_t *key, isc_buffer_t *data) {
if (r.length < e_bytes + mod_bytes)
return (ISC_R_NOSPACE);
memcpy(r.base, exponent, e_bytes);
memmove(r.base, exponent, e_bytes);
isc_region_consume(&r, e_bytes);
memcpy(r.base, modulus, mod_bytes);
memmove(r.base, modulus, mod_bytes);
isc_buffer_add(data, e_bytes + mod_bytes);
@@ -855,13 +845,13 @@ pkcs11rsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
attr[0].pValue = isc_mem_get(key->mctx, mod_bytes);
if (attr[0].pValue == NULL)
goto nomemory;
memcpy(attr[0].pValue, modulus, mod_bytes);
memmove(attr[0].pValue, modulus, mod_bytes);
attr[0].ulValueLen = (CK_ULONG) mod_bytes;
attr[1].type = CKA_PUBLIC_EXPONENT;
attr[1].pValue = isc_mem_get(key->mctx, e_bytes);
if (attr[1].pValue == NULL)
goto nomemory;
memcpy(attr[1].pValue, exponent, e_bytes);
memmove(attr[1].pValue, exponent, e_bytes);
attr[1].ulValueLen = (CK_ULONG) e_bytes;
key->keydata.pkey = rsa;
@@ -963,20 +953,20 @@ pkcs11rsa_tofile(const dst_key_t *key, const char *directory) {
priv.elements[i].tag = TAG_RSA_MODULUS;
priv.elements[i].length = (unsigned short) modulus->ulValueLen;
memcpy(bufs[i], modulus->pValue, modulus->ulValueLen);
memmove(bufs[i], modulus->pValue, modulus->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
priv.elements[i].tag = TAG_RSA_PUBLICEXPONENT;
priv.elements[i].length = (unsigned short) exponent->ulValueLen;
memcpy(bufs[i], exponent->pValue, exponent->ulValueLen);
memmove(bufs[i], exponent->pValue, exponent->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
if (d != NULL) {
priv.elements[i].tag = TAG_RSA_PRIVATEEXPONENT;
priv.elements[i].length = (unsigned short) d->ulValueLen;
memcpy(bufs[i], d->pValue, d->ulValueLen);
memmove(bufs[i], d->pValue, d->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
}
@@ -984,7 +974,7 @@ pkcs11rsa_tofile(const dst_key_t *key, const char *directory) {
if (p != NULL) {
priv.elements[i].tag = TAG_RSA_PRIME1;
priv.elements[i].length = (unsigned short) p->ulValueLen;
memcpy(bufs[i], p->pValue, p->ulValueLen);
memmove(bufs[i], p->pValue, p->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
}
@@ -992,7 +982,7 @@ pkcs11rsa_tofile(const dst_key_t *key, const char *directory) {
if (q != NULL) {
priv.elements[i].tag = TAG_RSA_PRIME2;
priv.elements[i].length = (unsigned short) q->ulValueLen;
memcpy(bufs[i], q->pValue, q->ulValueLen);
memmove(bufs[i], q->pValue, q->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
}
@@ -1000,7 +990,7 @@ pkcs11rsa_tofile(const dst_key_t *key, const char *directory) {
if (dmp1 != NULL) {
priv.elements[i].tag = TAG_RSA_EXPONENT1;
priv.elements[i].length = (unsigned short) dmp1->ulValueLen;
memcpy(bufs[i], dmp1->pValue, dmp1->ulValueLen);
memmove(bufs[i], dmp1->pValue, dmp1->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
}
@@ -1008,7 +998,7 @@ pkcs11rsa_tofile(const dst_key_t *key, const char *directory) {
if (dmq1 != NULL) {
priv.elements[i].tag = TAG_RSA_EXPONENT2;
priv.elements[i].length = (unsigned short) dmq1->ulValueLen;
memcpy(bufs[i], dmq1->pValue, dmq1->ulValueLen);
memmove(bufs[i], dmq1->pValue, dmq1->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
}
@@ -1016,7 +1006,7 @@ pkcs11rsa_tofile(const dst_key_t *key, const char *directory) {
if (iqmp != NULL) {
priv.elements[i].tag = TAG_RSA_COEFFICIENT;
priv.elements[i].length = (unsigned short) iqmp->ulValueLen;
memcpy(bufs[i], iqmp->pValue, iqmp->ulValueLen);
memmove(bufs[i], iqmp->pValue, iqmp->ulValueLen);
priv.elements[i].data = bufs[i];
i++;
}
@@ -1090,7 +1080,7 @@ pkcs11rsa_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++;
@@ -1099,7 +1089,7 @@ pkcs11rsa_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(rsa, label, key->mctx, OP_RSA);
@@ -1302,9 +1292,8 @@ pkcs11rsa_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) {
+1 -1
View File
@@ -169,7 +169,7 @@ isc_hmacmd5_init(isc_hmacmd5_t *ctx, const unsigned char *key,
PK11_FATALCHECK(pkcs_C_DigestFinal,
(ctx->session, (CK_BYTE_PTR) ctx->key, &kl));
} else
memcpy(ctx->key, key, len);
memmove(ctx->key, key, len);
PK11_FATALCHECK(pkcs_C_DigestInit, (ctx->session, &mech));
memset(ipad, IPAD, PADLEN);
for (i = 0; i < PADLEN; i++)
+5 -5
View File
@@ -269,7 +269,7 @@ isc_hmacsha1_sign(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len) {
(void) pkcs_C_DestroyObject(ctx->session, ctx->object);
ctx->object = CK_INVALID_HANDLE;
pk11_return_session(ctx);
memcpy(digest, newdigest, len);
memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest));
}
@@ -342,7 +342,7 @@ isc_hmacsha224_sign(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len) {
(void) pkcs_C_DestroyObject(ctx->session, ctx->object);
ctx->object = CK_INVALID_HANDLE;
pk11_return_session(ctx);
memcpy(digest, newdigest, len);
memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest));
}
@@ -415,7 +415,7 @@ isc_hmacsha256_sign(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len) {
(void) pkcs_C_DestroyObject(ctx->session, ctx->object);
ctx->object = CK_INVALID_HANDLE;
pk11_return_session(ctx);
memcpy(digest, newdigest, len);
memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest));
}
@@ -488,7 +488,7 @@ isc_hmacsha384_sign(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len) {
(void) pkcs_C_DestroyObject(ctx->session, ctx->object);
ctx->object = CK_INVALID_HANDLE;
pk11_return_session(ctx);
memcpy(digest, newdigest, len);
memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest));
}
@@ -561,7 +561,7 @@ isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len) {
(void) pkcs_C_DestroyObject(ctx->session, ctx->object);
ctx->object = CK_INVALID_HANDLE;
pk11_return_session(ctx);
memcpy(digest, newdigest, len);
memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest));
}
+10 -10
View File
@@ -642,10 +642,10 @@ choose_slots(void) {
token->slotid = slot;
ISC_LINK_INIT(token, link);
ISC_LIST_INIT(token->sessions);
memcpy(token->name, tokenInfo.label, 32);
memcpy(token->manuf, tokenInfo.manufacturerID, 32);
memcpy(token->model, tokenInfo.model, 16);
memcpy(token->serial, tokenInfo.serialNumber, 16);
memmove(token->name, tokenInfo.label, 32);
memmove(token->manuf, tokenInfo.manufacturerID, 32);
memmove(token->model, tokenInfo.model, 16);
memmove(token->serial, tokenInfo.serialNumber, 16);
ISC_LIST_APPEND(tokens, token, link);
if ((tokenInfo.flags & CKF_RNG) == 0)
goto try_rsa;
@@ -1002,7 +1002,7 @@ pk11strcmp(const char *x, size_t lenx, const char *y, size_t leny) {
memset(buf, ' ', 32);
if (lenx > leny)
lenx = leny;
memcpy(buf, x, lenx);
memmove(buf, x, lenx);
return (ISC_TF(memcmp(buf, y, leny) == 0));
}
@@ -1018,7 +1018,7 @@ push_attribute(iscpk11_object_t *obj, isc_mem_t *mctx, size_t len) {
return (NULL);
}
memset(obj->repr, 0, (cnt + 1) * sizeof(*attr));
memcpy(obj->repr, old, cnt * sizeof(*attr));
memmove(obj->repr, old, cnt * sizeof(*attr));
attr = obj->repr + cnt;
attr->ulValueLen = (CK_ULONG) len;
attr->pValue = isc_mem_get(mctx, len);
@@ -1057,7 +1057,7 @@ pk11_parse_uri(iscpk11_object_t *obj, const char *label,
uri = isc_mem_get(mctx, len);
if (uri == NULL)
return (ISC_R_NOMEMORY);
memcpy(uri, label, len);
memmove(uri, label, len);
/* get the URI scheme */
p = strchr(uri, ':');
@@ -1097,7 +1097,7 @@ pk11_parse_uri(iscpk11_object_t *obj, const char *label,
if (attr == NULL)
DST_RET(ISC_R_NOMEMORY);
attr->type = CKA_LABEL;
memcpy(attr->pValue, v, l);
memmove(attr->pValue, v, l);
} else if (strcmp(a, "token") == 0) {
/* token: CK_TOKEN_INFO label */
if (token == NULL)
@@ -1150,7 +1150,7 @@ pk11_parse_uri(iscpk11_object_t *obj, const char *label,
if (attr == NULL)
DST_RET(ISC_R_NOMEMORY);
attr->type = CKA_ID;
memcpy(attr->pValue, v, l);
memmove(attr->pValue, v, l);
} else if (strcmp(a, "pin-source") == 0) {
/* pin-source: PIN */
ret = isc_stdio_open(v, "r", &stream);
@@ -1187,7 +1187,7 @@ pk11_parse_uri(iscpk11_object_t *obj, const char *label,
DST_RET(ISC_R_NOTFOUND);
obj->slot = token->slotid;
if (gotpin) {
memcpy(token->pin, pin, PINLEN);
memmove(token->pin, pin, PINLEN);
obj->reqlogon = ISC_TRUE;
}