NSS: Collect additional info when public_slot is null

One of the theories why NSS might fail to open the
public slot is if something is wrong with the filesystem.
Add additional debug code for diagnosing the issue and move
the CHECK closer to where the problem actually occurs.

Example output:
Check failed: false. Public slot is invalid.
NSS path: /home/chronos/u-3a3b35f75b9fff436fe702dbd010ff696ee069dc/.pki/nssdb
Public slot database files:
pkcs11.txt, 100644, 500 bytes, readable
cert9.db, 100444, 28672 bytes, readable
key4.db, 100644, 36864 bytes, readable
Enumerate error code: 0
nssdb, 40750
Enumerate error code: 0
.pki, 40750
Enumerate error code: 0
NSS path exists.

Bug: 1163303
Test: Manual
Change-Id: I133ce2b743827aa5ffe2b9d4059af8b5228bfc3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3592993
Auto-Submit: Michael Ershov <miersh@google.com>
Reviewed-by: David Benjamin <davidben@chromium.org>
Commit-Queue: David Benjamin <davidben@chromium.org>
Cr-Commit-Position: refs/heads/main@{#994444}
NOKEYCHECK=True
GitOrigin-RevId: 0d751203a84df5a4f26f169dc71b24ae86ff2dbe
3 files changed
tree: e709e1accf4ba61f84f56ec4d2fd1f2228ebb0d1
  1. aead.cc
  2. aead.h
  3. aead_unittest.cc
  4. apple_keychain.h
  5. apple_keychain_ios.mm
  6. apple_keychain_mac.cc
  7. BUILD.gn
  8. capi_util.cc
  9. capi_util.h
  10. chaps_support.cc
  11. chaps_support.h
  12. crypto_export.h
  13. DEPS
  14. DIR_METADATA
  15. ec_private_key.cc
  16. ec_private_key.h
  17. ec_private_key_unittest.cc
  18. ec_signature_creator.cc
  19. ec_signature_creator.h
  20. ec_signature_creator_impl.cc
  21. ec_signature_creator_impl.h
  22. ec_signature_creator_unittest.cc
  23. encryptor.cc
  24. encryptor.h
  25. encryptor_unittest.cc
  26. features.gni
  27. hkdf.cc
  28. hkdf.h
  29. hmac.cc
  30. hmac.h
  31. hmac_unittest.cc
  32. mac_security_services_lock.cc
  33. mac_security_services_lock.h
  34. mock_apple_keychain.cc
  35. mock_apple_keychain.h
  36. mock_apple_keychain_ios.cc
  37. mock_apple_keychain_mac.cc
  38. nss_crypto_module_delegate.h
  39. nss_key_util.cc
  40. nss_key_util.h
  41. nss_key_util_unittest.cc
  42. nss_util.cc
  43. nss_util.h
  44. nss_util_chromeos.cc
  45. nss_util_internal.h
  46. nss_util_unittest.cc
  47. openssl_util.cc
  48. openssl_util.h
  49. OWNERS
  50. p224_spake.cc
  51. p224_spake.h
  52. p224_spake_unittest.cc
  53. random.cc
  54. random.h
  55. random_unittest.cc
  56. rsa_private_key.cc
  57. rsa_private_key.h
  58. rsa_private_key_unittest.cc
  59. scoped_capi_types.h
  60. scoped_mock_unexportable_key_provider.cc
  61. scoped_mock_unexportable_key_provider.h
  62. scoped_nss_types.h
  63. scoped_test_nss_chromeos_user.cc
  64. scoped_test_nss_chromeos_user.h
  65. scoped_test_nss_db.cc
  66. scoped_test_nss_db.h
  67. scoped_test_system_nss_key_slot.cc
  68. scoped_test_system_nss_key_slot.h
  69. secure_hash.cc
  70. secure_hash.h
  71. secure_hash_unittest.cc
  72. secure_util.cc
  73. secure_util.h
  74. sha2.cc
  75. sha2.h
  76. sha2_unittest.cc
  77. signature_creator.cc
  78. signature_creator.h
  79. signature_creator_unittest.cc
  80. signature_verifier.cc
  81. signature_verifier.h
  82. signature_verifier_unittest.cc
  83. symmetric_key.cc
  84. symmetric_key.h
  85. symmetric_key_unittest.cc
  86. unexportable_key.cc
  87. unexportable_key.h
  88. unexportable_key_unittest.cc
  89. unexportable_key_win.cc