prov.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. // SPDX-License-Identifier: LGPL-2.1-or-later
  2. /*
  3. *
  4. * BlueZ - Bluetooth protocol stack for Linux
  5. *
  6. * Copyright (C) 2017 Intel Corporation. All rights reserved.
  7. *
  8. *
  9. */
  10. #ifdef HAVE_CONFIG_H
  11. #include <config.h>
  12. #endif
  13. #include <stdio.h>
  14. #include <errno.h>
  15. #include <unistd.h>
  16. #include <stdlib.h>
  17. #include <stdbool.h>
  18. #include <sys/uio.h>
  19. #include <wordexp.h>
  20. #include <readline/readline.h>
  21. #include <readline/history.h>
  22. #include <glib.h>
  23. #include "src/shared/util.h"
  24. #include "src/shared/ecc.h"
  25. #include "src/shared/shell.h"
  26. #include "gdbus/gdbus.h"
  27. #include "tools/mesh/agent.h"
  28. #include "tools/mesh-gatt/node.h"
  29. #include "tools/mesh-gatt/gatt.h"
  30. #include "tools/mesh-gatt/crypto.h"
  31. #include "tools/mesh-gatt/mesh-net.h"
  32. #include "tools/mesh-gatt/util.h"
  33. #include "tools/mesh-gatt/prov.h"
  34. #include "tools/mesh-gatt/net.h"
  35. /* Provisioning Security Levels */
  36. #define MESH_PROV_SEC_HIGH 2
  37. #define MESH_PROV_SEC_MED 1
  38. #define MESH_PROV_SEC_LOW 0
  39. #define PROV_INVITE 0x00
  40. #define PROV_CAPS 0x01
  41. #define PROV_START 0x02
  42. #define PROV_PUB_KEY 0x03
  43. #define PROV_INP_CMPLT 0x04
  44. #define PROV_CONFIRM 0x05
  45. #define PROV_RANDOM 0x06
  46. #define PROV_DATA 0x07
  47. #define PROV_COMPLETE 0x08
  48. #define PROV_FAILED 0x09
  49. #define PROV_NO_OOB 0
  50. #define PROV_STATIC_OOB 1
  51. #define PROV_OUTPUT_OOB 2
  52. #define PROV_INPUT_OOB 3
  53. #define PROV_ERR_INVALID_PDU 0x01
  54. #define PROV_ERR_INVALID_FORMAT 0x02
  55. #define PROV_ERR_UNEXPECTED_PDU 0x03
  56. #define PROV_ERR_CONFIRM_FAILED 0x04
  57. #define PROV_ERR_INSUF_RESOURCE 0x05
  58. #define PROV_ERR_DECRYPT_FAILED 0x06
  59. #define PROV_ERR_UNEXPECTED_ERR 0x07
  60. #define PROV_ERR_CANT_ASSIGN_ADDR 0x08
  61. /* For Deployment, Security levels below HIGH are *not* recomended */
  62. static uint8_t prov_sec_level = MESH_PROV_SEC_MED;
  63. /* Expected Provisioning PDU sizes */
  64. static const uint16_t expected_pdu_size[] = {
  65. 1 + 1, /* PROV_INVITE */
  66. 1 + 1 + 2 + 1 + 1 + 1 + 2 + 1 + 2, /* PROV_CAPS */
  67. 1 + 1 + 1 + 1 + 1 + 1, /* PROV_START */
  68. 1 + 64, /* PROV_PUB_KEY */
  69. 1, /* PROV_INP_CMPLT */
  70. 1 + 16, /* PROV_CONFIRM */
  71. 1 + 16, /* PROV_RANDOM */
  72. 1 + 16 + 2 + 1 + 4 + 2 + 8, /* PROV_DATA */
  73. 1, /* PROV_COMPLETE */
  74. 1 + 1, /* PROV_FAILED */
  75. };
  76. typedef struct __packed {
  77. uint8_t attention;
  78. } __attribute__ ((packed)) prov_invite;
  79. typedef struct {
  80. uint8_t num_ele;
  81. uint16_t algorithms;
  82. uint8_t pub_type;
  83. uint8_t static_type;
  84. uint8_t output_size;
  85. uint16_t output_action;
  86. uint8_t input_size;
  87. uint16_t input_action;
  88. } __attribute__ ((packed)) prov_caps;
  89. typedef struct {
  90. uint8_t algorithm;
  91. uint8_t pub_key;
  92. uint8_t auth_method;
  93. uint8_t auth_action;
  94. uint8_t auth_size;
  95. } __attribute__ ((packed)) prov_start;
  96. typedef struct {
  97. prov_invite invite;
  98. prov_caps caps;
  99. prov_start start;
  100. uint8_t prv_pub_key[64];
  101. uint8_t dev_pub_key[64];
  102. } __attribute__ ((packed)) conf_input;
  103. struct prov_data {
  104. GDBusProxy *prov_in;
  105. provision_done_cb prov_done;
  106. void *user_data;
  107. uint16_t net_idx;
  108. uint16_t new_addr;
  109. uint8_t state;
  110. uint8_t eph_priv_key[32];
  111. uint8_t ecdh_secret[32];
  112. conf_input conf_in;
  113. uint8_t rand_auth[32];
  114. uint8_t salt[16];
  115. uint8_t conf_key[16];
  116. uint8_t mesh_conf[16];
  117. uint8_t dev_key[16];
  118. };
  119. static uint8_t u16_highest_bit(uint16_t mask)
  120. {
  121. uint8_t cnt = 0;
  122. if (!mask) return 0xff;
  123. while (mask & 0xfffe) {
  124. cnt++;
  125. mask >>= 1;
  126. }
  127. return cnt;
  128. }
  129. bool prov_open(struct mesh_node *node, GDBusProxy *prov_in, uint16_t net_idx,
  130. provision_done_cb cb, void *user_data)
  131. {
  132. uint8_t invite[] = { PROXY_PROVISIONING_PDU, PROV_INVITE, 0x10 };
  133. struct prov_data *prov = node_get_prov(node);
  134. if (prov) return false;
  135. prov = g_new0(struct prov_data, 1);
  136. prov->prov_in = prov_in;
  137. prov->net_idx = net_idx;
  138. prov->prov_done = cb;
  139. prov->user_data = user_data;
  140. node_set_prov(node, prov);
  141. prov->conf_in.invite.attention = invite[2];
  142. prov->state = PROV_INVITE;
  143. bt_shell_printf("Open-Node: %p\n", node);
  144. bt_shell_printf("Open-Prov: %p\n", prov);
  145. bt_shell_printf("Open-Prov: proxy %p\n", prov_in);
  146. return mesh_gatt_write(prov_in, invite, sizeof(invite), NULL, node);
  147. }
  148. static bool prov_send_prov_data(void *node)
  149. {
  150. struct prov_data *prov = node_get_prov(node);
  151. uint8_t out[35] = { PROXY_PROVISIONING_PDU, PROV_DATA };
  152. uint8_t key[16];
  153. uint8_t nonce[13];
  154. uint64_t mic;
  155. if (prov == NULL) return false;
  156. mesh_crypto_session_key(prov->ecdh_secret, prov->salt, key);
  157. mesh_crypto_nonce(prov->ecdh_secret, prov->salt, nonce);
  158. mesh_crypto_device_key(prov->ecdh_secret, prov->salt, prov->dev_key);
  159. print_byte_array("S-Key\t", key, sizeof(key));
  160. print_byte_array("S-Nonce\t", nonce, sizeof(nonce));
  161. print_byte_array("DevKey\t", prov->dev_key, sizeof(prov->dev_key));
  162. if (!net_get_key(prov->net_idx, out + 2))
  163. return false;
  164. put_be16(prov->net_idx, out + 2 + 16);
  165. net_get_flags(prov->net_idx, out + 2 + 16 + 2);
  166. put_be32(net_get_iv_index(NULL), out + 2 + 16 + 2 + 1);
  167. put_be16(prov->new_addr, out + 2 + 16 + 2 + 1 + 4);
  168. print_byte_array("Data\t", out + 2, 16 + 2 + 1 + 4 + 2);
  169. mesh_crypto_aes_ccm_encrypt(nonce, key,
  170. NULL, 0,
  171. out + 2,
  172. sizeof(out) - 2 - sizeof(mic),
  173. out + 2,
  174. &mic, sizeof(mic));
  175. print_byte_array("DataEncrypted + mic\t", out + 2, sizeof(out) - 2);
  176. prov->state = PROV_DATA;
  177. return mesh_gatt_write(prov->prov_in, out, sizeof(out), NULL, node);
  178. }
  179. static bool prov_send_confirm(void *node)
  180. {
  181. struct prov_data *prov = node_get_prov(node);
  182. uint8_t out[18] = { PROXY_PROVISIONING_PDU, PROV_CONFIRM };
  183. if (prov == NULL) return false;
  184. mesh_get_random_bytes(prov->rand_auth, 16);
  185. mesh_crypto_aes_cmac(prov->conf_key, prov->rand_auth,
  186. sizeof(prov->rand_auth), out + 2);
  187. prov->state = PROV_CONFIRM;
  188. return mesh_gatt_write(prov->prov_in, out, sizeof(out), NULL, node);
  189. }
  190. static void prov_out_oob_done(oob_type_t type, void *buf, uint16_t len,
  191. void *node)
  192. {
  193. struct prov_data *prov = node_get_prov(node);
  194. if (prov == NULL) return;
  195. switch (type) {
  196. default:
  197. case NONE:
  198. case OUTPUT:
  199. prov_complete(node, PROV_ERR_INVALID_PDU);
  200. return;
  201. case ASCII:
  202. case HEXADECIMAL:
  203. if (len > 16)
  204. prov_complete(node, PROV_ERR_INVALID_PDU);
  205. memcpy(prov->rand_auth + 16, buf, len);
  206. break;
  207. case DECIMAL:
  208. if (len != 4)
  209. prov_complete(node, PROV_ERR_INVALID_PDU);
  210. memcpy(prov->rand_auth +
  211. sizeof(prov->rand_auth) -
  212. sizeof(uint32_t),
  213. buf, len);
  214. break;
  215. }
  216. prov_send_confirm(node);
  217. }
  218. static uint32_t power_ten(uint8_t power)
  219. {
  220. uint32_t ret = 1;
  221. while (power--)
  222. ret *= 10;
  223. return ret;
  224. }
  225. char *in_action[3] = {
  226. "Push",
  227. "Twist",
  228. "Enter"
  229. };
  230. static void prov_calc_ecdh(DBusMessage *message, void *node)
  231. {
  232. struct prov_data *prov = node_get_prov(node);
  233. uint8_t action = prov->conf_in.start.auth_action;
  234. uint8_t size = prov->conf_in.start.auth_size;
  235. char in_oob_display[100];
  236. uint8_t *tmp = (void *) in_oob_display;
  237. uint32_t in_oob;
  238. if (prov == NULL) return;
  239. /* Convert to Mesh byte order */
  240. memcpy(tmp, prov->conf_in.dev_pub_key, 64);
  241. swap_u256_bytes(tmp);
  242. swap_u256_bytes(tmp + 32);
  243. ecdh_shared_secret(tmp, prov->eph_priv_key, prov->ecdh_secret);
  244. /* Convert to Mesh byte order */
  245. swap_u256_bytes(prov->ecdh_secret);
  246. mesh_crypto_s1(&prov->conf_in,
  247. sizeof(prov->conf_in), prov->salt);
  248. mesh_crypto_prov_conf_key(prov->ecdh_secret,
  249. prov->salt, prov->conf_key);
  250. switch (prov->conf_in.start.auth_method) {
  251. default:
  252. prov_complete(node, PROV_ERR_INVALID_PDU);
  253. break;
  254. case 0: /* No OOB */
  255. prov_send_confirm(node);
  256. break;
  257. case 1: /* Static OOB */
  258. agent_input_request(HEXADECIMAL,
  259. 16, NULL,
  260. prov_out_oob_done, node);
  261. break;
  262. case 2: /* Output OOB */
  263. if (action <= 3)
  264. agent_input_request(DECIMAL,
  265. size, NULL,
  266. prov_out_oob_done, node);
  267. else
  268. agent_input_request(ASCII,
  269. size, NULL,
  270. prov_out_oob_done, node);
  271. break;
  272. case 3: /* Input OOB */
  273. if (action <= 2) {
  274. mesh_get_random_bytes(&in_oob, sizeof(in_oob));
  275. in_oob %= power_ten(size);
  276. sprintf(in_oob_display, "%s %d on device\n",
  277. in_action[action], in_oob);
  278. put_be32(in_oob,
  279. prov->rand_auth +
  280. sizeof(prov->rand_auth) -
  281. sizeof(uint32_t));
  282. } else {
  283. uint8_t in_ascii[9];
  284. int i = size;
  285. mesh_get_random_bytes(in_ascii, i);
  286. while (i--) {
  287. in_ascii[i] =
  288. in_ascii[i] % ((26 * 2) + 10);
  289. if (in_ascii[i] >= 10 + 26)
  290. in_ascii[i] += 'a' - (10 + 26);
  291. else if (in_ascii[i] >= 10)
  292. in_ascii[i] += 'A' - 10;
  293. else
  294. in_ascii[i] += '0';
  295. }
  296. in_ascii[size] = '\0';
  297. memcpy(prov->rand_auth + 16, in_ascii, size);
  298. sprintf(in_oob_display,
  299. "Enter %s on device\n",
  300. in_ascii);
  301. }
  302. bt_shell_printf("Agent String: %s\n", in_oob_display);
  303. agent_output_request(in_oob_display);
  304. break;
  305. }
  306. }
  307. static void prov_send_pub_key(struct mesh_node *node)
  308. {
  309. struct prov_data *prov = node_get_prov(node);
  310. uint8_t out[66] = { PROXY_PROVISIONING_PDU, PROV_PUB_KEY };
  311. GDBusReturnFunction cb = NULL;
  312. if (prov == NULL) return;
  313. if (prov->conf_in.start.pub_key)
  314. cb = prov_calc_ecdh;
  315. memcpy(out + 2, prov->conf_in.prv_pub_key, 64);
  316. prov->state = PROV_PUB_KEY;
  317. mesh_gatt_write(prov->prov_in, out, 66, cb, node);
  318. }
  319. static void prov_oob_pub_key(oob_type_t type, void *buf, uint16_t len,
  320. void *node)
  321. {
  322. struct prov_data *prov = node_get_prov(node);
  323. if (prov == NULL) return;
  324. memcpy(prov->conf_in.dev_pub_key, buf, 64);
  325. prov_send_pub_key(node);
  326. }
  327. static void prov_start_cmplt(DBusMessage *message, void *node)
  328. {
  329. struct prov_data *prov = node_get_prov(node);
  330. if (prov == NULL) return;
  331. if (prov->conf_in.start.pub_key)
  332. agent_input_request(HEXADECIMAL, 64, NULL, prov_oob_pub_key,
  333. node);
  334. else
  335. prov_send_pub_key(node);
  336. }
  337. bool prov_data_ready(struct mesh_node *node, uint8_t *buf, uint8_t len)
  338. {
  339. struct prov_data *prov = node_get_prov(node);
  340. uint8_t sec_level = MESH_PROV_SEC_HIGH;
  341. uint8_t out[35] = { PROXY_PROVISIONING_PDU };
  342. if (prov == NULL || len < 2) return false;
  343. buf++;
  344. len--;
  345. bt_shell_printf("Got provisioning data (%d bytes)\n", len);
  346. if (buf[0] > PROV_FAILED || expected_pdu_size[buf[0]] != len)
  347. return prov_complete(node, PROV_ERR_INVALID_PDU);
  348. print_byte_array("\t", buf, len);
  349. if (buf[0] == PROV_FAILED)
  350. return prov_complete(node, buf[1]);
  351. /* Check provisioning state */
  352. switch (prov->state) {
  353. default:
  354. return prov_complete(node, PROV_ERR_INVALID_PDU);
  355. case PROV_INVITE:
  356. if (buf[0] != PROV_CAPS)
  357. return prov_complete(node,
  358. PROV_ERR_INVALID_PDU);
  359. /* Normalize to beginning of packed Param struct */
  360. buf++;
  361. len--;
  362. /* Save Capability values */
  363. memcpy(&prov->conf_in.caps, buf, len);
  364. sec_level = prov_get_sec_level();
  365. if (sec_level == MESH_PROV_SEC_HIGH) {
  366. /* Enforce High Security */
  367. if (prov->conf_in.caps.pub_type != 1 &&
  368. prov->conf_in.caps.static_type != 1)
  369. return prov_complete(node,
  370. PROV_ERR_INVALID_PDU);
  371. } else if (sec_level == MESH_PROV_SEC_MED) {
  372. /* Enforce Medium Security */
  373. if (prov->conf_in.caps.pub_type != 1 &&
  374. prov->conf_in.caps.static_type != 1 &&
  375. prov->conf_in.caps.input_size == 0 &&
  376. prov->conf_in.caps.output_size == 0)
  377. return prov_complete(node,
  378. PROV_ERR_INVALID_PDU);
  379. }
  380. /* Num Elements cannot be Zero */
  381. if (prov->conf_in.caps.num_ele == 0)
  382. return prov_complete(node,
  383. PROV_ERR_INVALID_PDU);
  384. /* All nodes must support Algorithm 0x0001 */
  385. if (!(get_be16(buf + 1) & 0x0001))
  386. return prov_complete(node,
  387. PROV_ERR_INVALID_PDU);
  388. /* Pub Key and Static type may not be > 1 */
  389. if (prov->conf_in.caps.pub_type > 0x01 ||
  390. prov->conf_in.caps.static_type > 0x01)
  391. return prov_complete(node,
  392. PROV_ERR_INVALID_PDU);
  393. prov->new_addr =
  394. net_obtain_address(prov->conf_in.caps.num_ele);
  395. if (!prov->new_addr)
  396. return prov_complete(node,
  397. PROV_ERR_INVALID_PDU);
  398. out[1] = PROV_START;
  399. prov->conf_in.start.algorithm = 0;
  400. prov->conf_in.start.pub_key =
  401. prov->conf_in.caps.pub_type;
  402. /* Compose START based on most secure values */
  403. if (prov->conf_in.caps.static_type) {
  404. prov->conf_in.start.auth_method =
  405. PROV_STATIC_OOB;
  406. } else if (prov->conf_in.caps.output_size >
  407. prov->conf_in.caps.input_size) {
  408. prov->conf_in.start.auth_method =
  409. PROV_OUTPUT_OOB;
  410. prov->conf_in.start.auth_action =
  411. u16_highest_bit(get_be16(buf + 6));
  412. prov->conf_in.start.auth_size =
  413. prov->conf_in.caps.output_size;
  414. } else if (prov->conf_in.caps.input_size > 0) {
  415. prov->conf_in.start.auth_method =
  416. PROV_INPUT_OOB;
  417. prov->conf_in.start.auth_action =
  418. u16_highest_bit(get_be16(buf + 9));
  419. prov->conf_in.start.auth_size =
  420. prov->conf_in.caps.input_size;
  421. }
  422. /* Range Check START values */
  423. if (prov->conf_in.start.auth_size > 8)
  424. return prov_complete(node,
  425. PROV_ERR_INVALID_PDU);
  426. prov->state = PROV_START;
  427. memcpy(out + 2, &prov->conf_in.start, 5);
  428. ecc_make_key(prov->conf_in.prv_pub_key,
  429. prov->eph_priv_key);
  430. /* Swap public key to share into Mesh byte ordering */
  431. swap_u256_bytes(prov->conf_in.prv_pub_key);
  432. swap_u256_bytes(prov->conf_in.prv_pub_key + 32);
  433. return mesh_gatt_write(prov->prov_in, out, 7,
  434. prov_start_cmplt, node);
  435. case PROV_PUB_KEY:
  436. if (buf[0] == PROV_PUB_KEY &&
  437. !prov->conf_in.start.pub_key) {
  438. memcpy(prov->conf_in.dev_pub_key, buf + 1, 64);
  439. prov_calc_ecdh(NULL, node);
  440. return true;
  441. } else if (buf[0] == PROV_INP_CMPLT) {
  442. agent_output_request_cancel();
  443. return prov_send_confirm(node);
  444. } else
  445. return prov_complete(node,
  446. PROV_ERR_INVALID_PDU);
  447. case PROV_CONFIRM:
  448. if (buf[0] != PROV_CONFIRM)
  449. return prov_complete(node,
  450. PROV_ERR_INVALID_PDU);
  451. memcpy(prov->mesh_conf, buf + 1, 16);
  452. out[1] = PROV_RANDOM;
  453. memcpy(out + 2, prov->rand_auth, 16);
  454. prov->state = PROV_RANDOM;
  455. return mesh_gatt_write(prov->prov_in, out, 18,
  456. NULL, node);
  457. case PROV_RANDOM:
  458. if (buf[0] != PROV_RANDOM)
  459. return prov_complete(node,
  460. PROV_ERR_INVALID_PDU);
  461. /* Calculate New Salt while we still have
  462. * both random values */
  463. mesh_crypto_prov_prov_salt(prov->salt,
  464. prov->rand_auth,
  465. buf + 1,
  466. prov->salt);
  467. /* Calculate meshs Conf Value */
  468. memcpy(prov->rand_auth, buf + 1, 16);
  469. mesh_crypto_aes_cmac(prov->conf_key, prov->rand_auth,
  470. sizeof(prov->rand_auth), out + 1);
  471. /* Validate Mesh confirmation */
  472. if (memcmp(out + 1, prov->mesh_conf, 16) != 0)
  473. return prov_complete(node,
  474. PROV_ERR_INVALID_PDU);
  475. bt_shell_printf("Confirmation Validated\n");
  476. prov_send_prov_data(node);
  477. return true;
  478. case PROV_DATA:
  479. if (buf[0] != PROV_COMPLETE)
  480. return prov_complete(node,
  481. PROV_ERR_INVALID_PDU);
  482. return prov_complete(node, 0);
  483. }
  484. /* Compose appropriate reply for the prov state message */
  485. /* Send reply via mesh_gatt_write() */
  486. /* If done, call prov_done calllback and free prov housekeeping data */
  487. bt_shell_printf("Got provisioning data (%d bytes)\n", len);
  488. print_byte_array("\t", buf, len);
  489. return true;
  490. }
  491. bool prov_complete(struct mesh_node *node, uint8_t status)
  492. {
  493. struct prov_data *prov = node_get_prov(node);
  494. void *user_data;
  495. provision_done_cb cb;
  496. if (prov == NULL) return false;
  497. if (status && prov->new_addr && prov->conf_in.caps.num_ele) {
  498. net_release_address(prov->new_addr, prov->conf_in.caps.num_ele);
  499. }
  500. if (!status) {
  501. node_set_num_elements(node, prov->conf_in.caps.num_ele);
  502. node_set_primary(node, prov->new_addr);
  503. node_set_device_key(node, prov->dev_key);
  504. node_net_key_add(node, prov->net_idx);
  505. }
  506. user_data = prov->user_data;
  507. cb = prov->prov_done;
  508. g_free(prov);
  509. node_set_prov(node, NULL);
  510. if (cb) cb(user_data, status);
  511. return true;
  512. }
  513. bool prov_set_sec_level(uint8_t level)
  514. {
  515. if (level > MESH_PROV_SEC_HIGH)
  516. return false;
  517. prov_sec_level = level;
  518. return true;
  519. }
  520. uint8_t prov_get_sec_level(void)
  521. {
  522. return prov_sec_level;
  523. }