tsipa740

Untitled

Aug 25th, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 KB | None | 0 0
  1. -----------------------------------
  2. #build
  3. [[email protected] ~/local/linux] gcc -g -lcrypto /home/siudin/fbsource/fbcode/kernel/sign-file/sign-file.c
  4. /home/siudin/fbsource/fbcode/kernel/sign-file/sign-file.c: In function ‘main’:
  5. /home/siudin/fbsource/fbcode/kernel/sign-file/sign-file.c:284:7: warning: implicit declaration of function ‘asprintf’; did you mean ‘vsprintf’? [-Wimplicit-function-declaration]
  6. ERR(asprintf(&dest_name, "%s.~signed~", module_name) < 0,
  7. ^~~~~~~~
  8. /home/siudin/fbsource/fbcode/kernel/sign-file/sign-file.c:106:18: note: in definition of macro ‘ERR’
  9. bool __cond = (cond); \
  10. ^~~~
  11. ---------------------------------
  12. #prepare module for experiments
  13. [[email protected] ~/local/linux] cp /lib/modules/5.2.9-229_fbk15_hardened_4185_g357f49b36602/kernel/net/sched/cls_tcindex.ko mods/
  14. [[email protected] ~/local/linux] modinfo mods/cls_tcindex.ko
  15. filename: /home/siudin/local/linux/mods/cls_tcindex.ko
  16. license: GPL
  17. srcversion: A95839E67E14DB82E6A8670
  18. depends:
  19. retpoline: Y
  20. intree: Y
  21. name: cls_tcindex
  22. vermagic: 5.2.9-229_fbk15_hardened_4185_g357f49b36602 SMP mod_unload modversions
  23.  
  24. ---------------------------------
  25. #try to feed valid path via rfc7512-compliant URI
  26. [[email protected] ~/local/linux] ./a.out sha512 'pkcs11:module-path=/usr/local/lib64/libgoop11-hsm_backend.so' x509 ./mods/cls_tcindex.ko
  27. Failed to enumerate slots
  28. Failed to enumerate slots
  29. PKCS11_get_private_key returned NULL
  30. At main.c:162:
  31. - SSL error:FFFFFFFF80067065:pkcs11 engine:ctx_load_privkey:object not found: eng_back.c:975
  32. - SSL error:26096080:engine routines:ENGINE_load_private_key:failed loading private key: crypto/engine/eng_pkey.c:78
  33. a.out: pkcs11:module-path=/usr/local/lib64/libgoop11-hsm_backend.so: No such file or directory
  34. [[email protected] ~/local/linux] modinfo mods/cls_tcindex.ko
  35. filename: /home/siudin/local/linux/mods/cls_tcindex.ko
  36. license: GPL
  37. srcversion: A95839E67E14DB82E6A8670
  38. depends:
  39. retpoline: Y
  40. intree: Y
  41. name: cls_tcindex
  42. vermagic: 5.2.9-229_fbk15_hardened_4185_g357f49b36602 SMP mod_unload modversions
  43.  
  44. ---------------------------------
  45. #try to feed bogus path via URI
  46. [[email protected] ~/local/linux] ./a.out sha512 'pkcs11:module-path=/obviously-broken-path.so' x509 ./mods/cls_tcindex.ko
  47. Failed to enumerate slots
  48. Failed to enumerate slots
  49. PKCS11_get_private_key returned NULL
  50. At main.c:160:
  51. - SSL error:FFFFFFFF80067065:pkcs11 engine:ctx_load_privkey:object not found: eng_back.c:975
  52. - SSL error:26096080:engine routines:ENGINE_load_private_key:failed loading private key: crypto/engine/eng_pkey.c:78
  53. a.out: pkcs11:module-path=/obviously-broken-path.so: No such file or directory
  54. [[email protected] ~/local/linux] modinfo mods/cls_tcindex.ko
  55. filename: /home/siudin/local/linux/mods/cls_tcindex.ko
  56. license: GPL
  57. srcversion: A95839E67E14DB82E6A8670
  58. depends:
  59. retpoline: Y
  60. intree: Y
  61. name: cls_tcindex
  62. vermagic: 5.2.9-229_fbk15_hardened_4185_g357f49b36602 SMP mod_unload modversions
  63.  
  64.  
  65. ---------------------------------
  66. #try to feed bogus module explicitly via ENGINE_ctrl_cmd_string(e, "MODULE_PATH",
  67. [[email protected] ~/local/linux] KBUILD_PKCS11_MODULE=/usr/local/lib64/obviously-wrong.so ./a.out sha512 'pkcs11:' x509 mods/cls_tcindex.ko
  68. /usr/local/lib64/obviously-wrong.so: cannot open shared object file: No such file or directory
  69. Unable to load module /usr/local/lib64/obviously-wrong.so
  70. /usr/local/lib64/obviously-wrong.so: cannot open shared object file: No such file or directory
  71. Unable to load module /usr/local/lib64/obviously-wrong.so
  72. PKCS11_get_private_key returned NULL
  73. At main.c:160:
  74. - SSL error:FFFFFFFF81065401:libp11:pkcs11_CTX_load:Unable to load PKCS#11 module: p11_load.c:79
  75. - SSL error:26096080:engine routines:ENGINE_load_private_key:failed loading private key: crypto/engine/eng_pkey.c:78
  76. a.out: pkcs11:: No such file or directory
  77. [[email protected] ~/local/linux] modinfo mods/cls_tcindex.ko
  78. filename: /home/siudin/local/linux/mods/cls_tcindex.ko
  79. license: GPL
  80. srcversion: A95839E67E14DB82E6A8670
  81. depends:
  82. retpoline: Y
  83. intree: Y
  84. name: cls_tcindex
  85. vermagic: 5.2.9-229_fbk15_hardened_4185_g357f49b36602 SMP mod_unload modversions
  86.  
  87.  
  88. ---------------------------------
  89. # try to feed correct module explicitly
  90. [[email protected] ~/local/linux] KBUILD_PKCS11_MODULE=/usr/local/lib64/libgoop11-hsm_backend.so ./a.out sha512 'pkcs11:' x509 mods/cls_tcindex.ko
  91. V0824 17:42:10.555155 1696387 crypto_impl.go:46] Client: &{<nil> 0xc0001987c8}
  92. V0824 17:42:10.558873 1696387 crypto_impl.go:46] Client: &{<nil> 0xc0001987c8}
  93. V0824 17:42:10.563652 1696387 crypto_impl.go:46] Client: &{<nil> 0xc0001987c8}
  94. V0824 17:42:10.564741 1696387 crypto_impl.go:46] Client: &{<nil> 0xc0001987c8}
  95. V0824 17:42:10.572171 1696387 crypto_impl.go:46] Client: &{<nil> 0xc0001987c8}
  96. [[email protected] ~/local/linux] modinfo mods/cls_tcindex.ko
  97. filename: /home/siudin/local/linux/mods/cls_tcindex.ko
  98. license: GPL
  99. srcversion: A95839E67E14DB82E6A8670
  100. depends:
  101. retpoline: Y
  102. intree: Y
  103. name: cls_tcindex
  104. vermagic: 5.2.9-229_fbk15_hardened_4185_g357f49b36602 SMP mod_unload modversions
  105. sig_id: PKCS#7
  106. signer: HSM TestOrg
  107. sig_key: 5F:98:4C:C0:51:DC:7C:7C
  108. sig_hashalgo: sha512
  109. signature: 30:B3:08:A2:E0:F0:5C:B6:17:3C:B3:D0:CB:64:2A:3A:54:A8:0A:9D:
  110. ED:ED:04:91:91:3C:B5:D8:D5:A2:70:D0:A2:63:45:FC:50:66:89:59:
  111. 9A:82:B1:27:6C:45:0B:0A:BA:33:23:8C:2D:FD:3F:96:31:B0:4E:81:
Add Comment
Please, Sign In to add comment