Lines Matching defs:attr

73 	CK_ATTRIBUTE *attr;
142 for (attr = pk11_attribute_first(rsa);
143 attr != NULL;
144 attr = pk11_attribute_next(rsa, attr))
145 switch (attr->type) {
147 INSIST(keyTemplate[6].type == attr->type);
149 attr->ulValueLen);
152 memmove(keyTemplate[6].pValue, attr->pValue,
153 attr->ulValueLen);
154 keyTemplate[6].ulValueLen = attr->ulValueLen;
157 INSIST(keyTemplate[7].type == attr->type);
159 attr->ulValueLen);
162 memmove(keyTemplate[7].pValue, attr->pValue,
163 attr->ulValueLen);
164 keyTemplate[7].ulValueLen = attr->ulValueLen;
167 INSIST(keyTemplate[8].type == attr->type);
169 attr->ulValueLen);
172 memmove(keyTemplate[8].pValue, attr->pValue,
173 attr->ulValueLen);
174 keyTemplate[8].ulValueLen = attr->ulValueLen;
177 INSIST(keyTemplate[9].type == attr->type);
179 attr->ulValueLen);
182 memmove(keyTemplate[9].pValue, attr->pValue,
183 attr->ulValueLen);
184 keyTemplate[9].ulValueLen = attr->ulValueLen;
187 INSIST(keyTemplate[10].type == attr->type);
189 attr->ulValueLen);
192 memmove(keyTemplate[10].pValue, attr->pValue,
193 attr->ulValueLen);
194 keyTemplate[10].ulValueLen = attr->ulValueLen;
197 INSIST(keyTemplate[11].type == attr->type);
199 attr->ulValueLen);
202 memmove(keyTemplate[11].pValue, attr->pValue,
203 attr->ulValueLen);
204 keyTemplate[11].ulValueLen = attr->ulValueLen;
207 INSIST(keyTemplate[12].type == attr->type);
209 attr->ulValueLen);
212 memmove(keyTemplate[12].pValue, attr->pValue,
213 attr->ulValueLen);
214 keyTemplate[12].ulValueLen = attr->ulValueLen;
217 INSIST(keyTemplate[13].type == attr->type);
219 attr->ulValueLen);
222 memmove(keyTemplate[13].pValue, attr->pValue,
223 attr->ulValueLen);
224 keyTemplate[13].ulValueLen = attr->ulValueLen;
310 CK_ATTRIBUTE *attr;
368 for (attr = pk11_attribute_first(rsa);
369 attr != NULL;
370 attr = pk11_attribute_next(rsa, attr))
371 switch (attr->type) {
373 INSIST(keyTemplate[5].type == attr->type);
375 attr->ulValueLen);
378 memmove(keyTemplate[5].pValue, attr->pValue,
379 attr->ulValueLen);
380 keyTemplate[5].ulValueLen = attr->ulValueLen;
383 INSIST(keyTemplate[6].type == attr->type);
385 attr->ulValueLen);
388 memmove(keyTemplate[6].pValue, attr->pValue,
389 attr->ulValueLen);
390 keyTemplate[6].ulValueLen = attr->ulValueLen;
391 if (pk11_numbits(attr->pValue,
392 attr->ulValueLen) > maxbits &&
732 CK_ATTRIBUTE *attr;
832 for (attr = pk11_attribute_first(rsa);
833 attr != NULL;
834 attr = pk11_attribute_next(rsa, attr))
835 switch (attr->type) {
837 INSIST(keyTemplate[6].type == attr->type);
839 attr->ulValueLen);
842 memmove(keyTemplate[6].pValue, attr->pValue,
843 attr->ulValueLen);
844 keyTemplate[6].ulValueLen = attr->ulValueLen;
847 INSIST(keyTemplate[7].type == attr->type);
849 attr->ulValueLen);
852 memmove(keyTemplate[7].pValue, attr->pValue,
853 attr->ulValueLen);
854 keyTemplate[7].ulValueLen = attr->ulValueLen;
857 INSIST(keyTemplate[8].type == attr->type);
859 attr->ulValueLen);
862 memmove(keyTemplate[8].pValue, attr->pValue,
863 attr->ulValueLen);
864 keyTemplate[8].ulValueLen = attr->ulValueLen;
867 INSIST(keyTemplate[9].type == attr->type);
869 attr->ulValueLen);
872 memmove(keyTemplate[9].pValue, attr->pValue,
873 attr->ulValueLen);
874 keyTemplate[9].ulValueLen = attr->ulValueLen;
877 INSIST(keyTemplate[10].type == attr->type);
879 attr->ulValueLen);
882 memmove(keyTemplate[10].pValue, attr->pValue,
883 attr->ulValueLen);
884 keyTemplate[10].ulValueLen = attr->ulValueLen;
887 INSIST(keyTemplate[11].type == attr->type);
889 attr->ulValueLen);
892 memmove(keyTemplate[11].pValue, attr->pValue,
893 attr->ulValueLen);
894 keyTemplate[11].ulValueLen = attr->ulValueLen;
897 INSIST(keyTemplate[12].type == attr->type);
899 attr->ulValueLen);
902 memmove(keyTemplate[12].pValue, attr->pValue,
903 attr->ulValueLen);
904 keyTemplate[12].ulValueLen = attr->ulValueLen;
907 INSIST(keyTemplate[13].type == attr->type);
909 attr->ulValueLen);
912 memmove(keyTemplate[13].pValue, attr->pValue,
913 attr->ulValueLen);
914 keyTemplate[13].ulValueLen = attr->ulValueLen;
985 CK_ATTRIBUTE *attr;
1046 for (attr = pk11_attribute_first(rsa);
1047 attr != NULL;
1048 attr = pk11_attribute_next(rsa, attr))
1049 switch (attr->type) {
1051 INSIST(keyTemplate[5].type == attr->type);
1053 attr->ulValueLen);
1056 memmove(keyTemplate[5].pValue, attr->pValue,
1057 attr->ulValueLen);
1058 keyTemplate[5].ulValueLen = attr->ulValueLen;
1061 INSIST(keyTemplate[6].type == attr->type);
1063 attr->ulValueLen);
1066 memmove(keyTemplate[6].pValue, attr->pValue,
1067 attr->ulValueLen);
1068 keyTemplate[6].ulValueLen = attr->ulValueLen;
1069 if (pk11_numbits(attr->pValue,
1070 attr->ulValueLen)
1195 CK_ATTRIBUTE *attr;
1268 rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 8);
1271 memset(rsa->repr, 0, sizeof(*attr) * 8);
1274 attr = rsa->repr;
1275 attr[0].type = CKA_MODULUS;
1276 attr[1].type = CKA_PUBLIC_EXPONENT;
1277 attr[2].type = CKA_PRIVATE_EXPONENT;
1278 attr[3].type = CKA_PRIME_1;
1279 attr[4].type = CKA_PRIME_2;
1280 attr[5].type = CKA_EXPONENT_1;
1281 attr[6].type = CKA_EXPONENT_2;
1282 attr[7].type = CKA_COEFFICIENT;
1285 (pk11_ctx->session, pub, attr, 2),
1288 attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
1289 if (attr[i].pValue == NULL)
1291 memset(attr[i].pValue, 0, attr[i].ulValueLen);
1294 (pk11_ctx->session, pub, attr, 2),
1297 attr += 2;
1299 (pk11_ctx->session, priv, attr, 6),
1302 attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
1303 if (attr[i].pValue == NULL)
1305 memset(attr[i].pValue, 0, attr[i].ulValueLen);
1308 (pk11_ctx->session, priv, attr, 6),
1335 CK_ATTRIBUTE *attr;
1339 attr = pk11_attribute_bytype(rsa, CKA_PRIVATE_EXPONENT);
1340 return (ISC_TF((attr != NULL) || rsa->ontoken));
1346 CK_ATTRIBUTE *attr;
1353 for (attr = pk11_attribute_first(rsa);
1354 attr != NULL;
1355 attr = pk11_attribute_next(rsa, attr))
1356 switch (attr->type) {
1367 if (attr->pValue != NULL) {
1368 isc_safe_memwipe(attr->pValue,
1369 attr->ulValueLen);
1371 attr->pValue,
1372 attr->ulValueLen);
1377 isc_safe_memwipe(rsa->repr, rsa->attrcnt * sizeof(*attr));
1380 rsa->attrcnt * sizeof(*attr));
1390 CK_ATTRIBUTE *attr;
1399 for (attr = pk11_attribute_first(rsa);
1400 attr != NULL;
1401 attr = pk11_attribute_next(rsa, attr))
1402 switch (attr->type) {
1404 exponent = (CK_BYTE *) attr->pValue;
1405 e_bytes = (unsigned int) attr->ulValueLen;
1408 modulus = (CK_BYTE *) attr->pValue;
1409 mod_bytes = (unsigned int) attr->ulValueLen;
1447 CK_ATTRIBUTE *attr;
1490 rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
1493 memset(rsa->repr, 0, sizeof(*attr) * 2);
1495 attr = rsa->repr;
1496 attr[0].type = CKA_MODULUS;
1497 attr[0].pValue = isc_mem_get(key->mctx, mod_bytes);
1498 if (attr[0].pValue == NULL)
1500 memmove(attr[0].pValue, modulus, mod_bytes);
1501 attr[0].ulValueLen = (CK_ULONG) mod_bytes;
1502 attr[1].type = CKA_PUBLIC_EXPONENT;
1503 attr[1].pValue = isc_mem_get(key->mctx, e_bytes);
1504 if (attr[1].pValue == NULL)
1506 memmove(attr[1].pValue, exponent, e_bytes);
1507 attr[1].ulValueLen = (CK_ULONG) e_bytes;
1514 for (attr = pk11_attribute_first(rsa);
1515 attr != NULL;
1516 attr = pk11_attribute_next(rsa, attr))
1517 switch (attr->type) {
1520 if (attr->pValue != NULL) {
1521 isc_safe_memwipe(attr->pValue,
1522 attr->ulValueLen);
1524 attr->pValue,
1525 attr->ulValueLen);
1531 rsa->attrcnt * sizeof(*attr));
1534 rsa->attrcnt * sizeof(*attr));
1545 CK_ATTRIBUTE *attr;
1563 for (attr = pk11_attribute_first(rsa);
1564 attr != NULL;
1565 attr = pk11_attribute_next(rsa, attr))
1566 switch (attr->type) {
1568 modulus = attr;
1571 exponent = attr;
1574 d = attr;
1577 p = attr;
1580 q = attr;
1583 dmp1 = attr;
1586 dmq1 = attr;
1589 iqmp = attr;
1711 CK_ATTRIBUTE *attr;
1727 rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
1730 memset(rsa->repr, 0, sizeof(*attr) * 2);
1732 attr = rsa->repr;
1734 attr->type = CKA_MODULUS;
1736 attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
1737 if (attr->pValue == NULL)
1739 memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
1740 attr->ulValueLen = pubattr->ulValueLen;
1741 attr++;
1743 attr->type = CKA_PUBLIC_EXPONENT;
1745 attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
1746 if (attr->pValue == NULL)
1748 memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
1749 attr->ulValueLen = pubattr->ulValueLen;
1764 attr = pk11_attribute_bytype(rsa, CKA_LABEL);
1765 if (attr == NULL) {
1766 attr = pk11_attribute_bytype(rsa, CKA_ID);
1767 INSIST(attr != NULL);
1770 searchTemplate[3].pValue = attr->pValue;
1771 searchTemplate[3].ulValueLen = attr->ulValueLen;
1799 attr = pk11_attribute_bytype(rsa, CKA_MODULUS);
1800 INSIST(attr != NULL);
1801 key->key_size = pk11_numbits(attr->pValue, attr->ulValueLen);
1884 CK_ATTRIBUTE *attr;
1937 rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 8);
1940 memset(rsa->repr, 0, sizeof(*attr) * 8);
1942 attr = rsa->repr;
1943 attr[0].type = CKA_MODULUS;
1944 attr[1].type = CKA_PUBLIC_EXPONENT;
1945 attr[2].type = CKA_PRIVATE_EXPONENT;
1946 attr[3].type = CKA_PRIME_1;
1947 attr[4].type = CKA_PRIME_2;
1948 attr[5].type = CKA_EXPONENT_1;
1949 attr[6].type = CKA_EXPONENT_2;
1950 attr[7].type = CKA_COEFFICIENT;
1970 attr = pk11_attribute_bytype(rsa, CKA_MODULUS);
1971 INSIST(attr != NULL);
1972 attr->pValue = bn;
1973 attr->ulValueLen = priv.elements[i].length;
1976 attr = pk11_attribute_bytype(rsa,
1978 INSIST(attr != NULL);
1979 attr->pValue = bn;
1980 attr->ulValueLen = priv.elements[i].length;
1983 attr = pk11_attribute_bytype(rsa,
1985 INSIST(attr != NULL);
1986 attr->pValue = bn;
1987 attr->ulValueLen = priv.elements[i].length;
1990 attr = pk11_attribute_bytype(rsa, CKA_PRIME_1);
1991 INSIST(attr != NULL);
1992 attr->pValue = bn;
1993 attr->ulValueLen = priv.elements[i].length;
1996 attr = pk11_attribute_bytype(rsa, CKA_PRIME_2);
1997 INSIST(attr != NULL);
1998 attr->pValue = bn;
1999 attr->ulValueLen = priv.elements[i].length;
2002 attr = pk11_attribute_bytype(rsa,
2004 INSIST(attr != NULL);
2005 attr->pValue = bn;
2006 attr->ulValueLen = priv.elements[i].length;
2009 attr = pk11_attribute_bytype(rsa,
2011 INSIST(attr != NULL);
2012 attr->pValue = bn;
2013 attr->ulValueLen = priv.elements[i].length;
2016 attr = pk11_attribute_bytype(rsa,
2018 INSIST(attr != NULL);
2019 attr->pValue = bn;
2020 attr->ulValueLen = priv.elements[i].length;
2028 attr = pk11_attribute_bytype(rsa, CKA_MODULUS);
2029 INSIST(attr != NULL);
2030 key->key_size = pk11_numbits(attr->pValue, attr->ulValueLen);
2032 attr = pk11_attribute_bytype(rsa, CKA_PUBLIC_EXPONENT);
2033 INSIST(attr != NULL);
2034 if (pk11_numbits(attr->pValue, attr->ulValueLen) > RSA_MAX_PUBEXP_BITS)
2065 CK_ATTRIBUTE *attr;
2082 rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
2085 memset(rsa->repr, 0, sizeof(*attr) * 2);
2087 attr = rsa->repr;
2088 attr[0].type = CKA_MODULUS;
2089 attr[1].type = CKA_PUBLIC_EXPONENT;
2104 attr = pk11_attribute_bytype(rsa, CKA_LABEL);
2105 if (attr == NULL) {
2106 attr = pk11_attribute_bytype(rsa, CKA_ID);
2107 INSIST(attr != NULL);
2110 searchTemplate[3].pValue = attr->pValue;
2111 searchTemplate[3].ulValueLen = attr->ulValueLen;
2125 attr = rsa->repr;
2127 (pk11_ctx->session, hKey, attr, 2),
2130 attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
2131 if (attr[i].pValue == NULL)
2133 memset(attr[i].pValue, 0, attr[i].ulValueLen);
2136 (pk11_ctx->session, hKey, attr, 2),
2162 attr = pk11_attribute_bytype(rsa, CKA_PUBLIC_EXPONENT);
2163 INSIST(attr != NULL);
2164 if (pk11_numbits(attr->pValue, attr->ulValueLen) > RSA_MAX_PUBEXP_BITS)
2167 attr = pk11_attribute_bytype(rsa, CKA_MODULUS);
2168 INSIST(attr != NULL);
2169 key->key_size = pk11_numbits(attr->pValue, attr->ulValueLen);