Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. int32_t verify_cert_chain(int **certificate_chain,int type)
  2.  
  3. {
  4. int32_t iVar1;
  5. int iVar2;
  6. char *type_str;
  7. int **ppiVar3;
  8.  
  9. type_str = "XS";
  10. if (type == 0x2) {
  11. type_str = "CP";
  12. }
  13. ppiVar3 = certificate_chain + 0x5;
  14. while( true ) {
  15. if ((type != 0x0) && (iVar1 = memcmp(*certificate_chain + 0x13,type_str,0x2), iVar1 != 0x0)) {
  16. return -0x1;
  17. }
  18. /* check if this is the root cert */
  19. iVar2 = strcmp((char *)(*certificate_chain + 0x3),"Root");
  20. if (iVar2 == 0x0) {
  21. /* Pass NULL as second arg to check Root signature */
  22. iVar1 = verify_cert_signature(*certificate_chain,NULL);
  23. return iVar1;
  24. }
  25. /* Pass next cert in to verify previous cert */
  26. iVar1 = verify_cert_signature(*certificate_chain,certificate_chain[0x1]);
  27. if (iVar1 != 0x0) break;
  28. certificate_chain = certificate_chain + 0x1;
  29. if ((int)ppiVar3 <= (int)certificate_chain) {
  30. return 0x0;
  31. }
  32. }
  33. return -0x1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement