Overview
Comment: | Added more debug output to encrypt and digest files |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | crypto |
Files: | files | file ages | folders |
SHA3-256: |
6cccc0c9b2957542f08bcf5b79e5e88b |
User & Date: | bohagan on 2024-05-19 19:51:09 |
Other Links: | branch diff | manifest | tags |
Context
2024-05-19
| ||
20:15 | Fixed bug in update and finalize handlers for encrypt using accumulator command. check-in: 9bcee7c0e7 user: bohagan tags: crypto | |
19:51 | Added more debug output to encrypt and digest files check-in: 6cccc0c9b2 user: bohagan tags: crypto | |
18:50 | Merge in changes from master check-in: 911e1b65a9 user: bohagan tags: crypto | |
Changes
Modified generic/tlsDigest.c
from [862bda43dc]
to [dfd4a485c5].
︙ | |||
372 373 374 375 376 377 378 379 380 381 382 383 384 385 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | + + | * Sets the device into blocking or nonblocking mode. * Can call Tcl_SetChannelError. * *------------------------------------------------------------------- */ static int DigestBlockModeProc(ClientData clientData, int mode) { DigestState *statePtr = (DigestState *) clientData; dprintf("Called"); if (mode == TCL_MODE_NONBLOCKING) { statePtr->flags |= TLS_TCL_ASYNC; } else { statePtr->flags &= ~(TLS_TCL_ASYNC); } return 0; |
︙ | |||
400 401 402 403 404 405 406 407 408 409 410 411 412 413 | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | + + | * Side effects: * Deletes stored state data. * *------------------------------------------------------------------- */ int DigestCloseProc(ClientData clientData, Tcl_Interp *interp) { DigestState *statePtr = (DigestState *) clientData; dprintf("Called"); /* Cancel active timer, if any */ if (statePtr->timer != (Tcl_TimerToken) NULL) { Tcl_DeleteTimerHandler(statePtr->timer); statePtr->timer = (Tcl_TimerToken) NULL; } |
︙ | |||
433 434 435 436 437 438 439 440 441 442 443 444 445 446 | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | + + | return 0; } /* * Same as DigestCloseProc but with individual read and write close control */ static int DigestClose2Proc(ClientData instanceData, Tcl_Interp *interp, int flags) { dprintf("Called"); if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { return DigestCloseProc(instanceData, interp); } return EINVAL; } |
︙ | |||
462 463 464 465 466 467 468 469 470 471 472 473 474 475 | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | + + | *---------------------------------------------------------------------- */ int DigestInputProc(ClientData clientData, char *buf, int toRead, int *errorCodePtr) { DigestState *statePtr = (DigestState *) clientData; Tcl_Channel parent; Tcl_Size read; *errorCodePtr = 0; dprintf("Called"); /* Abort if nothing to process */ if (toRead <= 0 || statePtr->self == (Tcl_Channel) NULL) { return 0; } /* Get bytes from underlying channel */ |
︙ | |||
526 527 528 529 530 531 532 533 534 535 536 537 538 539 | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | + + | * Get data from buf and update digest * *---------------------------------------------------------------------- */ int DigestOutputProc(ClientData clientData, const char *buf, int toWrite, int *errorCodePtr) { DigestState *statePtr = (DigestState *) clientData; *errorCodePtr = 0; dprintf("Called"); /* Abort if nothing to process */ if (toWrite <= 0 || statePtr->self == (Tcl_Channel) NULL) { return 0; } /* Update hash function */ |
︙ | |||
562 563 564 565 566 567 568 569 570 571 572 573 574 575 | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | + + | *---------------------------------------------------------------------- */ static int DigestSetOptionProc(ClientData clientData, Tcl_Interp *interp, const char *optionName, const char *optionValue) { DigestState *statePtr = (DigestState *) clientData; Tcl_Channel parent; Tcl_DriverSetOptionProc *setOptionProc; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return TCL_ERROR; } /* Delegate options downstream */ |
︙ | |||
600 601 602 603 604 605 606 607 608 609 610 611 612 613 | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | + + | *---------------------------------------------------------------------- */ static int DigestGetOptionProc(ClientData clientData, Tcl_Interp *interp, const char *optionName, Tcl_DString *optionValue) { DigestState *statePtr = (DigestState *) clientData; Tcl_Channel parent; Tcl_DriverGetOptionProc *getOptionProc; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return TCL_ERROR; } /* Delegate options downstream */ |
︙ | |||
637 638 639 640 641 642 643 644 645 646 647 648 649 650 | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | + + | * Side effects: * May call Tcl_NotifyChannel * *---------------------------------------------------------------------- */ static void DigestTimerHandler(ClientData clientData) { DigestState *statePtr = (DigestState *) clientData; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return; } /* Clear timer token */ |
︙ | |||
671 672 673 674 675 676 677 678 679 680 681 682 683 684 | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | + + | * *---------------------------------------------------------------------- */ void DigestWatchProc(ClientData clientData, int mask) { DigestState *statePtr = (DigestState *) clientData; Tcl_Channel parent; Tcl_DriverWatchProc *watchProc; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return; } /* Store OR-ed combination of TCL_READABLE, TCL_WRITABLE and TCL_EXCEPTION */ |
︙ | |||
718 719 720 721 722 723 724 725 726 727 728 729 730 731 | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | + + | * None * *---------------------------------------------------------------------- */ int DigestGetHandleProc(ClientData clientData, int direction, ClientData *handlePtr) { DigestState *statePtr = (DigestState *) clientData; Tcl_Channel parent; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return TCL_ERROR; } parent = Tcl_GetStackedChannel(statePtr->self); |
︙ | |||
745 746 747 748 749 750 751 752 753 754 755 756 757 758 | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | + + | * Side effects: * Cancels any pending timer. * *---------------------------------------------------------------------- */ int DigestNotifyProc(ClientData clientData, int interestMask) { DigestState *statePtr = (DigestState *) clientData; dprintf("Called"); /* Skip timer event as redundant */ if (statePtr->timer != (Tcl_TimerToken) NULL) { Tcl_DeleteTimerHandler(statePtr->timer); statePtr->timer = (Tcl_TimerToken) NULL; } return interestMask; |
︙ | |||
980 981 982 983 984 985 986 987 988 989 990 991 992 993 | 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | + + | * Side effects: * Destroys state info structure * *------------------------------------------------------------------- */ void DigestCommandDeleteHandler(ClientData clientData) { DigestState *statePtr = (DigestState *) clientData; dprintf("Called"); /* Clean-up */ DigestStateFree(statePtr); } /* *------------------------------------------------------------------- |
︙ |
Modified generic/tlsEncrypt.c
from [8d58b29b53]
to [d282984124].
︙ | |||
305 306 307 308 309 310 311 312 313 314 315 316 317 318 | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | + + | * Sets the device into blocking or nonblocking mode. * Can call Tcl_SetChannelError. * *------------------------------------------------------------------- */ static int EncryptBlockModeProc(ClientData clientData, int mode) { EncryptState *statePtr = (EncryptState *) clientData; dprintf("Called"); if (mode == TCL_MODE_NONBLOCKING) { statePtr->flags |= TLS_TCL_ASYNC; } else { statePtr->flags &= ~(TLS_TCL_ASYNC); } return 0; |
︙ | |||
333 334 335 336 337 338 339 340 341 342 343 344 345 346 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | + + | * Side effects: * Deletes stored state data. * *------------------------------------------------------------------- */ int EncryptCloseProc(ClientData clientData, Tcl_Interp *interp) { EncryptState *statePtr = (EncryptState *) clientData; dprintf("Called"); /* Cancel active timer, if any */ if (statePtr->timer != (Tcl_TimerToken) NULL) { Tcl_DeleteTimerHandler(statePtr->timer); statePtr->timer = (Tcl_TimerToken) NULL; } |
︙ | |||
370 371 372 373 374 375 376 377 378 379 380 381 382 383 | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | + + | return 0; } /* * Same as EncryptCloseProc but with individual read and write close control */ static int EncryptClose2Proc(ClientData instanceData, Tcl_Interp *interp, int flags) { dprintf("Called"); if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { return EncryptCloseProc(instanceData, interp); } return EINVAL; } /* |
︙ | |||
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | + + - + + | EncryptState *statePtr = (EncryptState *) clientData; Tcl_Channel parent; int out_len; Tcl_Size read; *errorCodePtr = 0; char *in_buf; dprintf("Called"); /* Abort if nothing to process */ if (toRead <= 0 || statePtr->self == (Tcl_Channel) NULL) { return 0; } /* Get bytes from underlying channel */ in_buf = Tcl_Alloc((Tcl_Size) toRead); parent = Tcl_GetStackedChannel(statePtr->self); read = Tcl_ReadRaw(parent, in_buf, (Tcl_Size) toRead); /* Update function */ if (read > 0) { /* Have data - Update function */ |
︙ | |||
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | + + - + + | *---------------------------------------------------------------------- */ int EncryptOutputProc(ClientData clientData, const char *buf, int toWrite, int *errorCodePtr) { EncryptState *statePtr = (EncryptState *) clientData; int write = 0, out_len; *errorCodePtr = 0; char *out_buf; dprintf("Called"); /* Abort if nothing to process */ if (toWrite <= 0 || statePtr->self == (Tcl_Channel) NULL) { return 0; } out_buf = Tcl_Alloc((Tcl_Size) toWrite+EVP_MAX_BLOCK_LENGTH); /* Update function */ |
︙ | |||
520 521 522 523 524 525 526 527 528 529 530 531 532 533 | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | + + | *---------------------------------------------------------------------- */ static int EncryptSetOptionProc(ClientData clientData, Tcl_Interp *interp, const char *optionName, const char *optionValue) { EncryptState *statePtr = (EncryptState *) clientData; Tcl_Channel parent; Tcl_DriverSetOptionProc *setOptionProc; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return TCL_ERROR; } /* Delegate options downstream */ |
︙ | |||
558 559 560 561 562 563 564 565 566 567 568 569 570 571 | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | + + | *---------------------------------------------------------------------- */ static int EncryptGetOptionProc(ClientData clientData, Tcl_Interp *interp, const char *optionName, Tcl_DString *optionValue) { EncryptState *statePtr = (EncryptState *) clientData; Tcl_Channel parent; Tcl_DriverGetOptionProc *getOptionProc; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return TCL_ERROR; } /* Delegate options downstream */ |
︙ | |||
595 596 597 598 599 600 601 602 603 604 605 606 607 608 | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | + + | * Side effects: * May call Tcl_NotifyChannel * *---------------------------------------------------------------------- */ static void EncryptTimerHandler(ClientData clientData) { EncryptState *statePtr = (EncryptState *) clientData; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return; } /* Clear timer token */ |
︙ | |||
629 630 631 632 633 634 635 636 637 638 639 640 641 642 | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | + + | * *---------------------------------------------------------------------- */ void EncryptWatchProc(ClientData clientData, int mask) { EncryptState *statePtr = (EncryptState *) clientData; Tcl_Channel parent; Tcl_DriverWatchProc *watchProc; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return; } /* Store OR-ed combination of TCL_READABLE, TCL_WRITABLE and TCL_EXCEPTION */ |
︙ | |||
676 677 678 679 680 681 682 683 684 685 686 687 688 689 | 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | + + | * None * *---------------------------------------------------------------------- */ int EncryptGetHandleProc(ClientData clientData, int direction, ClientData *handlePtr) { EncryptState *statePtr = (EncryptState *) clientData; Tcl_Channel parent; dprintf("Called"); /* Abort if no channel */ if (statePtr->self == (Tcl_Channel) NULL) { return TCL_ERROR; } parent = Tcl_GetStackedChannel(statePtr->self); |
︙ | |||
703 704 705 706 707 708 709 710 711 712 713 714 715 716 | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | + + | * Side effects: * Cancels any pending timer. * *---------------------------------------------------------------------- */ int EncryptNotifyProc(ClientData clientData, int interestMask) { EncryptState *statePtr = (EncryptState *) clientData; dprintf("Called"); /* Skip timer event as redundant */ if (statePtr->timer != (Tcl_TimerToken) NULL) { Tcl_DeleteTimerHandler(statePtr->timer); statePtr->timer = (Tcl_TimerToken) NULL; } return interestMask; |
︙ | |||
956 957 958 959 960 961 962 963 964 965 966 967 968 969 | 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | + + | * Side effects: * Destroys state info structure * *------------------------------------------------------------------- */ void EncryptCommandDeleteHandler(ClientData clientData) { EncryptState *statePtr = (EncryptState *) clientData; dprintf("Called"); /* Clean-up */ EncryptStateFree(statePtr); } /* *------------------------------------------------------------------- |
︙ |