=== src/pkcs11/pkcs11-spy.c
==================================================================
|
|
|
|
| 158 | 158 | return rv; |
| 159 | 159 | } |
| 160 | 160 | |
| | 161 | static CK_RV check_po() |
| | 162 | { |
| | 163 | if(!po) { |
| | 164 | fprintf(spy_output, "Error: Instance finalized early"); |
| | 165 | return retne(CKR_CRYPTOKI_NOT_INITIALIZED); |
| | 166 | } |
| | 167 | return CKR_OK; |
| | 168 | } |
| | 169 | #define CHECK_PO() do { CK_RV ret = check_po(); if(ret != CKR_OK) return ret; } while(0) |
| | 170 | |
| 161 | 171 | static void spy_dump_string_in(const char *name, CK_VOID_PTR data, CK_ULONG size) |
| 162 | 172 | { |
| 163 | 173 | fprintf(spy_output, "[in] %s ", name); |
| … |
… |
|
| 244 | 254 | { |
| 245 | 255 | CK_RV rv; |
| 246 | 256 | enter("C_Finalize"); |
| | 257 | CHECK_PO(); |
| | 258 | |
| 247 | 259 | rv = po->C_Finalize(pReserved); |
| 248 | 260 | /* After Finalize do not use the module again */ |
| 249 | 261 | C_UnloadModule(modhandle); |
| 250 | 262 | po = NULL; |
| | 263 | |
| 251 | 264 | return retne(rv); |
| 252 | 265 | } |
| 253 | 266 | |
| … |
… |
|
| 255 | 268 | { |
| 256 | 269 | CK_RV rv; |
| 257 | 270 | enter("C_GetInfo"); |
| | 271 | CHECK_PO(); |
| 258 | 272 | rv = po->C_GetInfo(pInfo); |
| 259 | 273 | if(rv == CKR_OK) { |
| 260 | 274 | print_ck_info(spy_output, pInfo); |
| … |
… |
|
| 269 | 283 | CK_RV rv; |
| 270 | 284 | enter("C_GetSlotList"); |
| 271 | 285 | spy_dump_ulong_in("tokenPresent", tokenPresent); |
| | 286 | CHECK_PO(); |
| 272 | 287 | rv = po->C_GetSlotList(tokenPresent, pSlotList, pulCount); |
| 273 | 288 | if(rv == CKR_OK) { |
| 274 | 289 | spy_dump_desc_out("pSlotList"); |
| … |
… |
|
| 284 | 299 | CK_RV rv; |
| 285 | 300 | enter("C_GetSlotInfo"); |
| 286 | 301 | spy_dump_ulong_in("slotID", slotID); |
| | 302 | CHECK_PO(); |
| 287 | 303 | rv = po->C_GetSlotInfo(slotID, pInfo); |
| 288 | 304 | if(rv == CKR_OK) { |
| 289 | 305 | spy_dump_desc_out("pInfo"); |
| … |
… |
|
| 298 | 314 | CK_RV rv; |
| 299 | 315 | enter("C_GetTokenInfo"); |
| 300 | 316 | spy_dump_ulong_in("slotID", slotID); |
| | 317 | CHECK_PO(); |
| 301 | 318 | rv = po->C_GetTokenInfo(slotID, pInfo); |
| 302 | 319 | if(rv == CKR_OK) { |
| 303 | 320 | spy_dump_desc_out("pInfo"); |
| … |
… |
|
| 313 | 330 | CK_RV rv; |
| 314 | 331 | enter("C_GetMechanismList"); |
| 315 | 332 | spy_dump_ulong_in("slotID", slotID); |
| | 333 | CHECK_PO(); |
| 316 | 334 | rv = po->C_GetMechanismList(slotID, pMechanismList, pulCount); |
| 317 | 335 | if(rv == CKR_OK) { |
| 318 | 336 | spy_dump_array_out("pMechanismList", *pulCount); |
| … |
… |
|
| 334 | 352 | } else { |
| 335 | 353 | fprintf(spy_output, " Unknown Mechanism (%08lx) \n", type); |
| 336 | 354 | } |
| | 355 | CHECK_PO(); |
| 337 | 356 | rv = po->C_GetMechanismInfo(slotID, type, pInfo); |
| 338 | 357 | if(rv == CKR_OK) { |
| 339 | 358 | spy_dump_desc_out("pInfo"); |
| … |
… |
|
| 352 | 371 | spy_dump_ulong_in("slotID", slotID); |
| 353 | 372 | spy_dump_string_in("pPin[ulPinLen]", pPin, ulPinLen); |
| 354 | 373 | spy_dump_string_in("pLabel[32]", pLabel, 32); |
| | 374 | CHECK_PO(); |
| 355 | 375 | rv = po->C_InitToken (slotID, pPin, ulPinLen, pLabel); |
| 356 | 376 | return retne(rv); |
| 357 | 377 | } |
| … |
… |
|
| 364 | 384 | enter("C_InitPIN"); |
| 365 | 385 | spy_dump_ulong_in("hSession", hSession); |
| 366 | 386 | spy_dump_string_in("pPin[ulPinLen]", pPin, ulPinLen); |
| | 387 | CHECK_PO(); |
| 367 | 388 | rv = po->C_InitPIN(hSession, pPin, ulPinLen); |
| 368 | 389 | return retne(rv); |
| 369 | 390 | } |
| … |
… |
|
| 379 | 400 | spy_dump_ulong_in("hSession", hSession); |
| 380 | 401 | spy_dump_string_in("pOldPin[ulOldLen]", pOldPin, ulOldLen); |
| 381 | 402 | spy_dump_string_in("pNewPin[ulNewLen]", pNewPin, ulNewLen); |
| | 403 | CHECK_PO(); |
| 382 | 404 | rv = po->C_SetPIN(hSession, pOldPin, ulOldLen, |
| 383 | 405 | pNewPin, ulNewLen); |
| 384 | 406 | return retne(rv); |
| … |
… |
|
| 396 | 418 | spy_dump_ulong_in("flags", flags); |
| 397 | 419 | fprintf(spy_output, "pApplication=%p\n", pApplication); |
| 398 | 420 | fprintf(spy_output, "Notify=%p\n", (void *)Notify); |
| | 421 | CHECK_PO(); |
| 399 | 422 | rv = po->C_OpenSession(slotID, flags, pApplication, |
| 400 | 423 | Notify, phSession); |
| 401 | 424 | spy_dump_ulong_out("*phSession", *phSession); |
| … |
… |
|
| 408 | 431 | CK_RV rv; |
| 409 | 432 | enter("C_CloseSession"); |
| 410 | 433 | spy_dump_ulong_in("hSession", hSession); |
| | 434 | CHECK_PO(); |
| 411 | 435 | rv = po->C_CloseSession(hSession); |
| 412 | 436 | return retne(rv); |
| 413 | 437 | } |
| … |
… |
|
| 418 | 442 | CK_RV rv; |
| 419 | 443 | enter("C_CloseAllSessions"); |
| 420 | 444 | spy_dump_ulong_in("slotID", slotID); |
| | 445 | CHECK_PO(); |
| 421 | 446 | rv = po->C_CloseAllSessions(slotID); |
| 422 | 447 | return retne(rv); |
| 423 | 448 | } |
| … |
… |
|
| 429 | 454 | CK_RV rv; |
| 430 | 455 | enter("C_GetSessionInfo"); |
| 431 | 456 | spy_dump_ulong_in("hSession", hSession); |
| | 457 | CHECK_PO(); |
| 432 | 458 | rv = po->C_GetSessionInfo(hSession, pInfo); |
| 433 | 459 | if(rv == CKR_OK) { |
| 434 | 460 | spy_dump_desc_out("pInfo"); |
| … |
… |
|
| 445 | 471 | CK_RV rv; |
| 446 | 472 | enter("C_GetOperationState"); |
| 447 | 473 | spy_dump_ulong_in("hSession", hSession); |
| | 474 | CHECK_PO(); |
| 448 | 475 | rv = po->C_GetOperationState(hSession, pOperationState, |
| 449 | 476 | pulOperationStateLen); |
| 450 | 477 | if (rv == CKR_OK) { |
| … |
… |
|
| 468 | 495 | pOperationState, ulOperationStateLen); |
| 469 | 496 | spy_dump_ulong_in("hEncryptionKey", hEncryptionKey); |
| 470 | 497 | spy_dump_ulong_in("hAuthenticationKey", hAuthenticationKey); |
| | 498 | CHECK_PO(); |
| 471 | 499 | rv = po->C_SetOperationState(hSession, pOperationState, |
| 472 | 500 | ulOperationStateLen, |
| 473 | 501 | hEncryptionKey, |
| … |
… |
|
| 487 | 515 | fprintf(spy_output, "[in] userType = %s\n", |
| 488 | 516 | lookup_enum(USR_T, userType)); |
| 489 | 517 | spy_dump_string_in("pPin[ulPinLen]", pPin, ulPinLen); |
| | 518 | CHECK_PO(); |
| 490 | 519 | rv = po->C_Login(hSession, userType, pPin, ulPinLen); |
| 491 | 520 | return retne(rv); |
| 492 | 521 | } |
| … |
… |
|
| 496 | 525 | CK_RV rv; |
| 497 | 526 | enter("C_Logout"); |
| 498 | 527 | spy_dump_ulong_in("hSession", hSession); |
| | 528 | CHECK_PO(); |
| 499 | 529 | rv = po->C_Logout(hSession); |
| 500 | 530 | return retne(rv); |
| 501 | 531 | } |
| … |
… |
|
| 509 | 539 | enter("C_CreateObject"); |
| 510 | 540 | spy_dump_ulong_in("hSession", hSession); |
| 511 | 541 | spy_attribute_list_in("pTemplate", pTemplate, ulCount); |
| | 542 | CHECK_PO(); |
| 512 | 543 | rv = po->C_CreateObject(hSession, pTemplate, ulCount, phObject); |
| 513 | 544 | if (rv == CKR_OK) { |
| 514 | 545 | spy_dump_ulong_out("*phObject", *phObject); |
| … |
… |
|
| 527 | 558 | spy_dump_ulong_in("hSession", hSession); |
| 528 | 559 | spy_dump_ulong_in("hObject", hObject); |
| 529 | 560 | spy_attribute_list_in("pTemplate", pTemplate, ulCount); |
| | 561 | CHECK_PO(); |
| 530 | 562 | rv = po->C_CopyObject(hSession, hObject, pTemplate, ulCount, phNewObject); |
| 531 | 563 | if (rv == CKR_OK) { |
| 532 | 564 | spy_dump_ulong_out("*phNewObject", *phNewObject); |
| … |
… |
|
| 542 | 574 | enter("C_DestroyObject"); |
| 543 | 575 | spy_dump_ulong_in("hSession", hSession); |
| 544 | 576 | spy_dump_ulong_in("hObject", hObject); |
| | 577 | CHECK_PO(); |
| 545 | 578 | rv = po->C_DestroyObject(hSession, hObject); |
| 546 | 579 | return retne(rv); |
| 547 | 580 | } |
| … |
… |
|
| 555 | 588 | enter("C_GetObjectSize"); |
| 556 | 589 | spy_dump_ulong_in("hSession", hSession); |
| 557 | 590 | spy_dump_ulong_in("hObject", hObject); |
| | 591 | CHECK_PO(); |
| 558 | 592 | rv = po->C_GetObjectSize(hSession, hObject, pulSize); |
| 559 | 593 | if (rv == CKR_OK) { |
| 560 | 594 | spy_dump_ulong_out("*pulSize", *pulSize); |
| … |
… |
|
| 579 | 613 | * true errors for C_GetAttributeValue.'' |
| 580 | 614 | * That's why we ignore these error codes, because we want to display |
| 581 | 615 | * all other attributes anyway (they may have been returned correctly) */ |
| | 616 | CHECK_PO(); |
| 582 | 617 | rv = po->C_GetAttributeValue(hSession, hObject, pTemplate, ulCount); |
| 583 | 618 | if (rv == CKR_OK || rv == CKR_ATTRIBUTE_SENSITIVE || |
| 584 | 619 | rv == CKR_ATTRIBUTE_TYPE_INVALID || rv == CKR_BUFFER_TOO_SMALL) { |
| … |
… |
|
| 598 | 633 | spy_dump_ulong_in("hSession", hSession); |
| 599 | 634 | spy_dump_ulong_in("hObject", hObject); |
| 600 | 635 | spy_attribute_list_in("pTemplate", pTemplate, ulCount); |
| | 636 | CHECK_PO(); |
| 601 | 637 | rv = po->C_SetAttributeValue(hSession, hObject, pTemplate, ulCount); |
| 602 | 638 | return retne(rv); |
| 603 | 639 | } |
| … |
… |
|
| 611 | 647 | enter("C_FindObjectsInit"); |
| 612 | 648 | spy_dump_ulong_in("hSession", hSession); |
| 613 | 649 | spy_attribute_list_in("pTemplate", pTemplate, ulCount); |
| | 650 | CHECK_PO(); |
| 614 | 651 | rv = po->C_FindObjectsInit(hSession, pTemplate, ulCount); |
| 615 | 652 | return retne(rv); |
| 616 | 653 | } |
| … |
… |
|
| 625 | 662 | enter("C_FindObjects"); |
| 626 | 663 | spy_dump_ulong_in("hSession", hSession); |
| 627 | 664 | spy_dump_ulong_in("ulMaxObjectCount", ulMaxObjectCount); |
| | 665 | CHECK_PO(); |
| 628 | 666 | rv = po->C_FindObjects(hSession, phObject, ulMaxObjectCount, |
| 629 | 667 | pulObjectCount); |
| 630 | 668 | if (rv == CKR_OK) { |
| … |
… |
|
| 643 | 681 | CK_RV rv; |
| 644 | 682 | enter("C_FindObjectsFinal"); |
| 645 | 683 | spy_dump_ulong_in("hSession", hSession); |
| | 684 | CHECK_PO(); |
| 646 | 685 | rv = po->C_FindObjectsFinal(hSession); |
| 647 | 686 | return retne(rv); |
| 648 | 687 | } |
| … |
… |
|
| 657 | 696 | fprintf(spy_output, "pMechanism->type=%s\n", |
| 658 | 697 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 659 | 698 | spy_dump_ulong_in("hKey", hKey); |
| | 699 | CHECK_PO(); |
| 660 | 700 | rv = po->C_EncryptInit(hSession, pMechanism, hKey); |
| 661 | 701 | return retne(rv); |
| 662 | 702 | } |
| … |
… |
|
| 672 | 712 | enter("C_Encrypt"); |
| 673 | 713 | spy_dump_ulong_in("hSession", hSession); |
| 674 | 714 | spy_dump_string_in("pData[ulDataLen]", pData, ulDataLen); |
| | 715 | CHECK_PO(); |
| 675 | 716 | rv = po->C_Encrypt(hSession, pData, ulDataLen, |
| 676 | 717 | pEncryptedData, pulEncryptedDataLen); |
| 677 | 718 | if (rv == CKR_OK) { |
| … |
… |
|
| 692 | 733 | enter("C_EncryptUpdate"); |
| 693 | 734 | spy_dump_ulong_in("hSession", hSession); |
| 694 | 735 | spy_dump_string_in("pPart[ulPartLen]", pPart, ulPartLen); |
| | 736 | CHECK_PO(); |
| 695 | 737 | rv = po->C_EncryptUpdate(hSession, pPart, ulPartLen, pEncryptedPart, |
| 696 | 738 | pulEncryptedPartLen); |
| 697 | 739 | if (rv == CKR_OK) { |
| … |
… |
|
| 708 | 750 | CK_RV rv; |
| 709 | 751 | enter("C_EncryptFinal"); |
| 710 | 752 | spy_dump_ulong_in("hSession", hSession); |
| | 753 | CHECK_PO(); |
| 711 | 754 | rv = po->C_EncryptFinal(hSession, pLastEncryptedPart, |
| 712 | 755 | pulLastEncryptedPartLen); |
| 713 | 756 | if (rv == CKR_OK) { |
| … |
… |
|
| 728 | 771 | fprintf(spy_output, "pMechanism->type=%s\n", |
| 729 | 772 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 730 | 773 | spy_dump_ulong_in("hKey", hKey); |
| | 774 | CHECK_PO(); |
| 731 | 775 | rv = po->C_DecryptInit(hSession, pMechanism, hKey); |
| 732 | 776 | return retne(rv); |
| 733 | 777 | } |
| … |
… |
|
| 744 | 788 | spy_dump_ulong_in("hSession", hSession); |
| 745 | 789 | spy_dump_string_in("pEncryptedData[ulEncryptedDataLen]", |
| 746 | 790 | pEncryptedData, ulEncryptedDataLen); |
| | 791 | CHECK_PO(); |
| 747 | 792 | rv = po->C_Decrypt(hSession, pEncryptedData, ulEncryptedDataLen, |
| 748 | 793 | pData, pulDataLen); |
| 749 | 794 | if (rv == CKR_OK) { |
| … |
… |
|
| 764 | 809 | spy_dump_ulong_in("hSession", hSession); |
| 765 | 810 | spy_dump_string_in("pEncryptedPart[ulEncryptedPartLen]", |
| 766 | 811 | pEncryptedPart, ulEncryptedPartLen); |
| | 812 | CHECK_PO(); |
| 767 | 813 | rv = po->C_DecryptUpdate(hSession, pEncryptedPart, ulEncryptedPartLen, |
| 768 | 814 | pPart, pulPartLen); |
| 769 | 815 | if (rv == CKR_OK) { |
| … |
… |
|
| 780 | 826 | CK_RV rv; |
| 781 | 827 | enter("C_DecryptFinal"); |
| 782 | 828 | spy_dump_ulong_in("hSession", hSession); |
| | 829 | CHECK_PO(); |
| 783 | 830 | rv = po->C_DecryptFinal(hSession, pLastPart, pulLastPartLen); |
| 784 | 831 | if (rv == CKR_OK) { |
| 785 | 832 | spy_dump_string_out("pLastPart[*pulLastPartLen]", |
| … |
… |
|
| 796 | 843 | spy_dump_ulong_in("hSession", hSession); |
| 797 | 844 | fprintf(spy_output, "pMechanism->type=%s\n", |
| 798 | 845 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| | 846 | CHECK_PO(); |
| 799 | 847 | rv = po->C_DigestInit(hSession, pMechanism); |
| 800 | 848 | return retne(rv); |
| 801 | 849 | } |
| … |
… |
|
| 811 | 859 | enter("C_Digest"); |
| 812 | 860 | spy_dump_ulong_in("hSession", hSession); |
| 813 | 861 | spy_dump_string_in("pData[ulDataLen]", pData, ulDataLen); |
| | 862 | CHECK_PO(); |
| 814 | 863 | rv = po->C_Digest(hSession, pData, ulDataLen, pDigest, pulDigestLen); |
| 815 | 864 | if (rv == CKR_OK) { |
| 816 | 865 | spy_dump_string_out("pDigest[*pulDigestLen]", |
| … |
… |
|
| 828 | 877 | enter("C_DigestUpdate"); |
| 829 | 878 | spy_dump_ulong_in("hSession", hSession); |
| 830 | 879 | spy_dump_string_in("pPart[ulPartLen]", pPart, ulPartLen); |
| | 880 | CHECK_PO(); |
| 831 | 881 | rv = po->C_DigestUpdate(hSession, pPart, ulPartLen); |
| 832 | 882 | return retne(rv); |
| 833 | 883 | } |
| … |
… |
|
| 840 | 890 | enter("C_DigestKey"); |
| 841 | 891 | spy_dump_ulong_in("hSession", hSession); |
| 842 | 892 | spy_dump_ulong_in("hKey", hKey); |
| | 893 | CHECK_PO(); |
| 843 | 894 | rv = po->C_DigestKey(hSession, hKey); |
| 844 | 895 | return retne(rv); |
| 845 | 896 | } |
| … |
… |
|
| 852 | 903 | CK_RV rv; |
| 853 | 904 | enter("C_DigestFinal"); |
| 854 | 905 | spy_dump_ulong_in("hSession", hSession); |
| | 906 | CHECK_PO(); |
| 855 | 907 | rv = po->C_DigestFinal(hSession, pDigest, pulDigestLen); |
| 856 | 908 | if (rv == CKR_OK) { |
| 857 | 909 | spy_dump_string_out("pDigest[*pulDigestLen]", |
| … |
… |
|
| 870 | 922 | fprintf(spy_output, "pMechanism->type=%s\n", |
| 871 | 923 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 872 | 924 | spy_dump_ulong_in("hKey", hKey); |
| | 925 | CHECK_PO(); |
| 873 | 926 | rv = po->C_SignInit(hSession, pMechanism, hKey); |
| 874 | 927 | return retne(rv); |
| 875 | 928 | } |
| … |
… |
|
| 885 | 938 | enter("C_Sign"); |
| 886 | 939 | spy_dump_ulong_in("hSession", hSession); |
| 887 | 940 | spy_dump_string_in("pData[ulDataLen]", pData, ulDataLen); |
| | 941 | CHECK_PO(); |
| 888 | 942 | rv = po->C_Sign(hSession, pData, ulDataLen, pSignature, pulSignatureLen); |
| 889 | 943 | if (rv == CKR_OK) { |
| 890 | 944 | spy_dump_string_out("pSignature[*pulSignatureLen]", |
| … |
… |
|
| 902 | 956 | enter("C_SignUpdate"); |
| 903 | 957 | spy_dump_ulong_in("hSession", hSession); |
| 904 | 958 | spy_dump_string_in("pPart[ulPartLen]", pPart, ulPartLen); |
| | 959 | CHECK_PO(); |
| 905 | 960 | rv = po->C_SignUpdate(hSession, pPart, ulPartLen); |
| 906 | 961 | return retne(rv); |
| 907 | 962 | } |
| … |
… |
|
| 914 | 969 | CK_RV rv; |
| 915 | 970 | enter("C_SignFinal"); |
| 916 | 971 | spy_dump_ulong_in("hSession", hSession); |
| | 972 | CHECK_PO(); |
| 917 | 973 | rv = po->C_SignFinal(hSession, pSignature, pulSignatureLen); |
| 918 | 974 | if (rv == CKR_OK) { |
| 919 | 975 | spy_dump_string_out("pSignature[*pulSignatureLen]", |
| … |
… |
|
| 933 | 989 | fprintf(spy_output, "pMechanism->type=%s\n", |
| 934 | 990 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 935 | 991 | spy_dump_ulong_in("hKey", hKey); |
| | 992 | CHECK_PO(); |
| 936 | 993 | rv = po->C_SignRecoverInit(hSession, pMechanism, hKey); |
| 937 | 994 | return retne(rv); |
| 938 | 995 | } |
| … |
… |
|
| 948 | 1005 | enter("C_SignRecover"); |
| 949 | 1006 | spy_dump_ulong_in("hSession", hSession); |
| 950 | 1007 | spy_dump_string_in("pData[ulDataLen]", pData, ulDataLen); |
| | 1008 | CHECK_PO(); |
| 951 | 1009 | rv = po->C_SignRecover(hSession, pData, ulDataLen, |
| 952 | 1010 | pSignature, pulSignatureLen); |
| 953 | 1011 | if (rv == CKR_OK) { |
| … |
… |
|
| 967 | 1025 | fprintf(spy_output, "pMechanism->type=%s\n", |
| 968 | 1026 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 969 | 1027 | spy_dump_ulong_in("hKey", hKey); |
| | 1028 | CHECK_PO(); |
| 970 | 1029 | rv = po->C_VerifyInit(hSession, pMechanism, hKey); |
| 971 | 1030 | return retne(rv); |
| 972 | 1031 | } |
| … |
… |
|
| 984 | 1043 | spy_dump_string_in("pData[ulDataLen]", pData, ulDataLen); |
| 985 | 1044 | spy_dump_string_in("pSignature[ulSignatureLen]", |
| 986 | 1045 | pSignature, ulSignatureLen); |
| | 1046 | CHECK_PO(); |
| 987 | 1047 | rv = po->C_Verify(hSession, pData, ulDataLen, pSignature, ulSignatureLen); |
| 988 | 1048 | return retne(rv); |
| 989 | 1049 | } |
| … |
… |
|
| 997 | 1057 | enter("C_VerifyUpdate"); |
| 998 | 1058 | spy_dump_ulong_in("hSession", hSession); |
| 999 | 1059 | spy_dump_string_in("pPart[ulPartLen]", pPart, ulPartLen); |
| | 1060 | CHECK_PO(); |
| 1000 | 1061 | rv = po->C_VerifyUpdate(hSession, pPart, ulPartLen); |
| 1001 | 1062 | return retne(rv); |
| 1002 | 1063 | } |
| … |
… |
|
| 1011 | 1072 | spy_dump_ulong_in("hSession", hSession); |
| 1012 | 1073 | spy_dump_string_in("pSignature[ulSignatureLen]", |
| 1013 | 1074 | pSignature, ulSignatureLen); |
| | 1075 | CHECK_PO(); |
| 1014 | 1076 | rv = po->C_VerifyFinal(hSession, pSignature, ulSignatureLen); |
| 1015 | 1077 | return retne(rv); |
| 1016 | 1078 | } |
| … |
… |
|
| 1026 | 1088 | fprintf(spy_output, "pMechanism->type=%s\n", |
| 1027 | 1089 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 1028 | 1090 | spy_dump_ulong_in("hKey", hKey); |
| | 1091 | CHECK_PO(); |
| 1029 | 1092 | rv = po->C_VerifyRecoverInit(hSession, pMechanism, hKey); |
| 1030 | 1093 | return retne(rv); |
| 1031 | 1094 | } |
| … |
… |
|
| 1042 | 1105 | spy_dump_ulong_in("hSession", hSession); |
| 1043 | 1106 | spy_dump_string_in("pSignature[ulSignatureLen]", |
| 1044 | 1107 | pSignature, ulSignatureLen); |
| | 1108 | CHECK_PO(); |
| 1045 | 1109 | rv = po->C_VerifyRecover(hSession, pSignature, ulSignatureLen, |
| 1046 | 1110 | pData, pulDataLen); |
| 1047 | 1111 | if (rv == CKR_OK) { |
| … |
… |
|
| 1060 | 1124 | enter("C_DigestEncryptUpdate"); |
| 1061 | 1125 | spy_dump_ulong_in("hSession", hSession); |
| 1062 | 1126 | spy_dump_string_in("pPart[ulPartLen]", pPart, ulPartLen); |
| | 1127 | CHECK_PO(); |
| 1063 | 1128 | rv = po->C_DigestEncryptUpdate(hSession, pPart, ulPartLen, |
| 1064 | 1129 | pEncryptedPart, pulEncryptedPartLen); |
| 1065 | 1130 | if (rv == CKR_OK) { |
| … |
… |
|
| 1081 | 1146 | spy_dump_ulong_in("hSession", hSession); |
| 1082 | 1147 | spy_dump_string_in("pEncryptedPart[ulEncryptedPartLen]", |
| 1083 | 1148 | pEncryptedPart, ulEncryptedPartLen); |
| | 1149 | CHECK_PO(); |
| 1084 | 1150 | rv = po->C_DecryptDigestUpdate(hSession, pEncryptedPart, |
| 1085 | 1151 | ulEncryptedPartLen, |
| 1086 | 1152 | pPart, pulPartLen); |
| … |
… |
|
| 1101 | 1167 | enter("C_SignEncryptUpdate"); |
| 1102 | 1168 | spy_dump_ulong_in("hSession", hSession); |
| 1103 | 1169 | spy_dump_string_in("pPart[ulPartLen]", pPart, ulPartLen); |
| | 1170 | CHECK_PO(); |
| 1104 | 1171 | rv = po->C_SignEncryptUpdate(hSession, pPart, ulPartLen, |
| 1105 | 1172 | pEncryptedPart, pulEncryptedPartLen); |
| 1106 | 1173 | if (rv == CKR_OK) { |
| … |
… |
|
| 1122 | 1189 | spy_dump_ulong_in("hSession", hSession); |
| 1123 | 1190 | spy_dump_string_in("pEncryptedPart[ulEncryptedPartLen]", |
| 1124 | 1191 | pEncryptedPart, ulEncryptedPartLen); |
| | 1192 | CHECK_PO(); |
| 1125 | 1193 | rv = po->C_DecryptVerifyUpdate(hSession, pEncryptedPart, |
| 1126 | 1194 | ulEncryptedPartLen, pPart, |
| 1127 | 1195 | pulPartLen); |
| … |
… |
|
| 1143 | 1211 | fprintf(spy_output, "pMechanism->type=%s\n", |
| 1144 | 1212 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 1145 | 1213 | spy_attribute_list_in("pTemplate", pTemplate, ulCount); |
| | 1214 | CHECK_PO(); |
| 1146 | 1215 | rv = po->C_GenerateKey(hSession, pMechanism, pTemplate, |
| 1147 | 1216 | ulCount, phKey); |
| 1148 | 1217 | if (rv == CKR_OK) { |
| … |
… |
|
| 1169 | 1238 | pPublicKeyTemplate, ulPublicKeyAttributeCount); |
| 1170 | 1239 | spy_attribute_list_in("pPrivateKeyTemplate", |
| 1171 | 1240 | pPrivateKeyTemplate, ulPrivateKeyAttributeCount); |
| | 1241 | CHECK_PO(); |
| 1172 | 1242 | rv = po->C_GenerateKeyPair(hSession, pMechanism, pPublicKeyTemplate, |
| 1173 | 1243 | ulPublicKeyAttributeCount, pPrivateKeyTemplate, |
| 1174 | 1244 | ulPrivateKeyAttributeCount, phPublicKey, |
| … |
… |
|
| 1195 | 1265 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 1196 | 1266 | spy_dump_ulong_in("hWrappingKey", hWrappingKey); |
| 1197 | 1267 | spy_dump_ulong_in("hKey", hKey); |
| | 1268 | CHECK_PO(); |
| 1198 | 1269 | rv = po->C_WrapKey(hSession, pMechanism, hWrappingKey, |
| 1199 | 1270 | hKey, pWrappedKey, pulWrappedKeyLen); |
| 1200 | 1271 | if (rv == CKR_OK) { |
| … |
… |
|
| 1222 | 1293 | spy_dump_string_in("pWrappedKey[ulWrappedKeyLen]", |
| 1223 | 1294 | pWrappedKey, ulWrappedKeyLen); |
| 1224 | 1295 | spy_attribute_list_in("pTemplate", pTemplate, ulAttributeCount); |
| | 1296 | CHECK_PO(); |
| 1225 | 1297 | rv = po->C_UnwrapKey(hSession, pMechanism, hUnwrappingKey, |
| 1226 | 1298 | pWrappedKey, ulWrappedKeyLen, pTemplate, |
| 1227 | 1299 | ulAttributeCount, phKey); |
| … |
… |
|
| 1245 | 1317 | lookup_enum(MEC_T, pMechanism->mechanism)); |
| 1246 | 1318 | spy_dump_ulong_in("hBaseKey", hBaseKey); |
| 1247 | 1319 | spy_attribute_list_in("pTemplate", pTemplate, ulAttributeCount); |
| | 1320 | CHECK_PO(); |
| 1248 | 1321 | rv = po->C_DeriveKey(hSession, pMechanism, hBaseKey, |
| 1249 | 1322 | pTemplate, ulAttributeCount, phKey); |
| 1250 | 1323 | if (rv == CKR_OK) { |
| … |
… |
|
| 1261 | 1334 | enter("C_SeedRandom"); |
| 1262 | 1335 | spy_dump_ulong_in("hSession", hSession); |
| 1263 | 1336 | spy_dump_string_in("pSeed[ulSeedLen]", pSeed, ulSeedLen); |
| | 1337 | CHECK_PO(); |
| 1264 | 1338 | rv = po->C_SeedRandom(hSession, pSeed, ulSeedLen); |
| 1265 | 1339 | return retne(rv); |
| 1266 | 1340 | } |
| … |
… |
|
| 1273 | 1347 | CK_RV rv; |
| 1274 | 1348 | enter("C_GenerateRandom"); |
| 1275 | 1349 | spy_dump_ulong_in("hSession", hSession); |
| | 1350 | CHECK_PO(); |
| 1276 | 1351 | rv = po->C_GenerateRandom(hSession, RandomData, ulRandomLen); |
| 1277 | 1352 | if (rv == CKR_OK) { |
| 1278 | 1353 | spy_dump_string_out("RandomData[ulRandomLen]", |
| … |
… |
|
| 1287 | 1362 | CK_RV rv; |
| 1288 | 1363 | enter("C_GetFunctionStatus"); |
| 1289 | 1364 | spy_dump_ulong_in("hSession", hSession); |
| | 1365 | CHECK_PO(); |
| 1290 | 1366 | rv = po->C_GetFunctionStatus(hSession); |
| 1291 | 1367 | return retne(rv); |
| 1292 | 1368 | } |
| … |
… |
|
| 1296 | 1372 | CK_RV rv; |
| 1297 | 1373 | enter("C_CancelFunction"); |
| 1298 | 1374 | spy_dump_ulong_in("hSession", hSession); |
| | 1375 | CHECK_PO(); |
| 1299 | 1376 | rv = po->C_CancelFunction(hSession); |
| 1300 | 1377 | return retne(rv); |
| 1301 | 1378 | } |
| … |
… |
|
| 1306 | 1383 | { |
| 1307 | 1384 | CK_RV rv; |
| 1308 | 1385 | enter("C_WaitForSlotEvent"); |
| | 1386 | CHECK_PO(); |
| 1309 | 1387 | rv = po->C_WaitForSlotEvent(flags, pSlot, pRserved); |
| 1310 | 1388 | return retne(rv); |
| 1311 | 1389 | } |