Lines Matching defs:attr

166 	CK_ATTRIBUTE *attr;
203 for (attr = pk11_attribute_first(ec);
204 attr != NULL;
205 attr = pk11_attribute_next(ec, attr))
206 switch (attr->type) {
208 INSIST(keyTemplate[5].type == attr->type);
210 attr->ulValueLen);
213 memmove(keyTemplate[5].pValue, attr->pValue,
214 attr->ulValueLen);
215 keyTemplate[5].ulValueLen = attr->ulValueLen;
218 INSIST(keyTemplate[6].type == attr->type);
220 attr->ulValueLen);
223 memmove(keyTemplate[6].pValue, attr->pValue,
224 attr->ulValueLen);
225 keyTemplate[6].ulValueLen = attr->ulValueLen;
288 CK_ATTRIBUTE *attr;
310 for (attr = pk11_attribute_first(ec);
311 attr != NULL;
312 attr = pk11_attribute_next(ec, attr))
313 switch (attr->type) {
315 INSIST(keyTemplate[5].type == attr->type);
317 attr->ulValueLen);
320 memmove(keyTemplate[5].pValue, attr->pValue,
321 attr->ulValueLen);
322 keyTemplate[5].ulValueLen = attr->ulValueLen;
325 INSIST(keyTemplate[6].type == attr->type);
327 attr->ulValueLen);
330 memmove(keyTemplate[6].pValue, attr->pValue,
331 attr->ulValueLen);
332 keyTemplate[6].ulValueLen = attr->ulValueLen;
426 attr->pValue = isc_mem_get(key->mctx, \
428 if (attr->pValue == NULL) \
430 memmove(attr->pValue, \
432 attr->ulValueLen = sizeof(pk11_ecc_prime256v1); \
434 attr->pValue = isc_mem_get(key->mctx, \
436 if (attr->pValue == NULL) \
438 memmove(attr->pValue, \
440 attr->ulValueLen = sizeof(pk11_ecc_secp384r1); \
444 if (attr->pValue != NULL) { \
445 memset(attr->pValue, 0, attr->ulValueLen); \
446 isc_mem_put(key->mctx, attr->pValue, attr->ulValueLen); \
447 attr->pValue = NULL; \
478 CK_ATTRIBUTE *attr;
502 ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 3);
505 memset(ec->repr, 0, sizeof(*attr) * 3);
508 attr = ec->repr;
509 attr[0].type = CKA_EC_PARAMS;
510 attr[1].type = CKA_EC_POINT;
511 attr[2].type = CKA_VALUE;
513 attr = &pubTemplate[5];
523 attr = &pubTemplate[5];
526 attr = ec->repr;
529 attr++;
531 (pk11_ctx->session, pub, attr, 1),
533 attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
534 if (attr->pValue == NULL)
536 memset(attr->pValue, 0, attr->ulValueLen);
538 (pk11_ctx->session, pub, attr, 1),
541 attr++;
543 (pk11_ctx->session, priv, attr, 1),
545 attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
546 if (attr->pValue == NULL)
548 memset(attr->pValue, 0, attr->ulValueLen);
550 (pk11_ctx->session, priv, attr, 1),
582 CK_ATTRIBUTE *attr;
586 attr = pk11_attribute_bytype(ec, CKA_VALUE);
587 return (ISC_TF((attr != NULL) || ec->ontoken));
593 CK_ATTRIBUTE *attr;
600 for (attr = pk11_attribute_first(ec);
601 attr != NULL;
602 attr = pk11_attribute_next(ec, attr))
603 switch (attr->type) {
613 memset(ec->repr, 0, ec->attrcnt * sizeof(*attr));
616 ec->attrcnt * sizeof(*attr));
628 CK_ATTRIBUTE *attr;
638 attr = pk11_attribute_bytype(ec, CKA_EC_POINT);
639 if ((attr == NULL) ||
640 (attr->ulValueLen != len + 3) ||
641 (((CK_BYTE_PTR) attr->pValue)[0] != TAG_OCTECT_STRING) ||
642 (((CK_BYTE_PTR) attr->pValue)[1] != len + 1) ||
643 (((CK_BYTE_PTR) attr->pValue)[2] != UNCOMPRESSED))
649 memmove(r.base, (CK_BYTE_PTR) attr->pValue + 3, len);
660 CK_ATTRIBUTE *attr;
680 ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
685 attr = ec->repr;
686 attr->type = CKA_EC_PARAMS;
688 attr->pValue =
690 if (attr->pValue == NULL)
692 memmove(attr->pValue,
694 attr->ulValueLen = sizeof(pk11_ecc_prime256v1);
696 attr->pValue =
698 if (attr->pValue == NULL)
700 memmove(attr->pValue,
702 attr->ulValueLen = sizeof(pk11_ecc_secp384r1);
705 attr++;
706 attr->type = CKA_EC_POINT;
707 attr->pValue = isc_mem_get(key->mctx, len + 3);
708 if (attr->pValue == NULL)
710 ((CK_BYTE_PTR) attr->pValue)[0] = TAG_OCTECT_STRING;
711 ((CK_BYTE_PTR) attr->pValue)[1] = len + 1;
712 ((CK_BYTE_PTR) attr->pValue)[2] = UNCOMPRESSED;
713 memmove((CK_BYTE_PTR) attr->pValue + 3, r.base, len);
714 attr->ulValueLen = len + 3;
722 for (attr = pk11_attribute_first(ec);
723 attr != NULL;
724 attr = pk11_attribute_next(ec, attr))
725 switch (attr->type) {
732 memset(ec->repr, 0, ec->attrcnt * sizeof(*attr));
735 ec->attrcnt * sizeof(*attr));
749 CK_ATTRIBUTE *attr;
760 attr = pk11_attribute_bytype(ec, CKA_VALUE);
761 if (attr != NULL) {
762 buf = isc_mem_get(key->mctx, attr->ulValueLen);
766 priv.elements[i].length = (unsigned short) attr->ulValueLen;
767 memmove(buf, attr->pValue, attr->ulValueLen);
790 memset(buf, 0, attr->ulValueLen);
791 isc_mem_put(key->mctx, buf, attr->ulValueLen);
811 CK_ATTRIBUTE *attr;
827 ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
830 memset(ec->repr, 0, sizeof(*attr) * 2);
832 attr = ec->repr;
834 attr->type = CKA_EC_PARAMS;
836 attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
837 if (attr->pValue == NULL)
839 memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
840 attr->ulValueLen = pubattr->ulValueLen;
841 attr++;
843 attr->type = CKA_EC_POINT;
845 attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
846 if (attr->pValue == NULL)
848 memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
849 attr->ulValueLen = pubattr->ulValueLen;
864 attr = pk11_attribute_bytype(ec, CKA_LABEL);
865 if (attr == NULL) {
866 attr = pk11_attribute_bytype(ec, CKA_ID);
867 INSIST(attr != NULL);
870 searchTemplate[3].pValue = attr->pValue;
871 searchTemplate[3].ulValueLen = attr->ulValueLen;
914 CK_ATTRIBUTE *attr, *pattr;
972 ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 3);
975 memset(ec->repr, 0, sizeof(*attr) * 3);
978 attr = ec->repr;
979 attr->type = CKA_EC_PARAMS;
982 attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
983 if (attr->pValue == NULL)
985 memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
986 attr->ulValueLen = pattr->ulValueLen;
988 attr++;
989 attr->type = CKA_EC_POINT;
992 attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
993 if (attr->pValue == NULL)
995 memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
996 attr->ulValueLen = pattr->ulValueLen;
998 attr++;
999 attr->type = CKA_VALUE;
1000 attr->pValue = isc_mem_get(key->mctx, priv.elements[0].length);
1001 if (attr->pValue == NULL)
1003 memmove(attr->pValue, priv.elements[0].data, priv.elements[0].length);
1004 attr->ulValueLen = priv.elements[0].length;
1038 CK_ATTRIBUTE *attr;
1055 ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
1058 memset(ec->repr, 0, sizeof(*attr) * 2);
1060 attr = ec->repr;
1061 attr[0].type = CKA_EC_PARAMS;
1062 attr[1].type = CKA_EC_POINT;
1077 attr = pk11_attribute_bytype(ec, CKA_LABEL);
1078 if (attr == NULL) {
1079 attr = pk11_attribute_bytype(ec, CKA_ID);
1080 INSIST(attr != NULL);
1083 searchTemplate[3].pValue = attr->pValue;
1084 searchTemplate[3].ulValueLen = attr->ulValueLen;
1098 attr = ec->repr;
1100 (pk11_ctx->session, hKey, attr, 2),
1103 attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
1104 if (attr[i].pValue == NULL)
1106 memset(attr[i].pValue, 0, attr[i].ulValueLen);
1109 (pk11_ctx->session, hKey, attr, 2),