Overview
Comment: | Added description and provider to cipher, digest, mac, and pkey info commands. This only work for OpenSSL 3.0+. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | crypto |
Files: | files | file ages | folders |
SHA3-256: |
968f8bf25be359fbe919b3393e079b38 |
User & Date: | bohagan on 2024-03-31 20:57:43 |
Other Links: | branch diff | manifest | tags |
Context
2024-04-07
| ||
20:52 | Added RC4 stream cipher test vectors check-in: 6e07821c1e user: bohagan tags: crypto | |
2024-03-31
| ||
20:57 | Added description and provider to cipher, digest, mac, and pkey info commands. This only work for OpenSSL 3.0+. check-in: 968f8bf25b user: bohagan tags: crypto | |
03:12 | Added DES test vectors check-in: 66cee0f83a user: bohagan tags: crypto | |
Changes
Modified generic/tlsInfo.c from [28c894841a] to [c3297cae77].
︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | + + + + + - + - + + + + + + + + + + + + | * *------------------------------------------------------------------- */ int CipherInfo(Tcl_Interp *interp, Tcl_Obj *nameObj) { const EVP_CIPHER *cipher; Tcl_Obj *resultObj, *listObj; unsigned long flags, mode; int res = TCL_OK; char *modeName = NULL; char *name = Tcl_GetString(nameObj); /* Get cipher */ #if OPENSSL_VERSION_NUMBER < 0x30000000L cipher = EVP_get_cipherbyname(name); #else cipher = EVP_CIPHER_fetch(NULL, name, NULL); #endif if (cipher == NULL) { Tcl_AppendResult(interp, "Invalid cipher \"", name, "\"", (char *) NULL); return TCL_ERROR; } |
︙ | |||
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | + + + + + + + + + - + | /* CTX only properties */ { EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); int tag_len = 0; EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL); #if OPENSSL_VERSION_NUMBER < 0x30000000L if (mode == EVP_CIPH_GCM_MODE || mode == EVP_CIPH_OCB_MODE) { tag_len = EVP_GCM_TLS_TAG_LEN; /* EVP_MAX_AEAD_TAG_LENGTH */ } else if (mode == EVP_CIPH_CCM_MODE) { tag_len = EVP_CCM_TLS_TAG_LEN; } else if (cipher == EVP_get_cipherbyname("chacha20-poly1305")) { tag_len = EVP_CHACHAPOLY_TLS_TAG_LEN; /* POLY1305_BLOCK_SIZE */ } #else tag_len = EVP_CIPHER_CTX_get_tag_length(ctx); #endif EVP_CIPHER_CTX_free(ctx); LAPPEND_INT(interp, resultObj, "tag_length", tag_len); } /* AEAD properties */ { int aad_len = 0; if (flags & EVP_CIPH_FLAG_AEAD_CIPHER) { aad_len = EVP_AEAD_TLS1_AAD_LEN; } LAPPEND_INT(interp, resultObj, "aad_length", aad_len); } Tcl_SetObjResult(interp, resultObj); done: #if OPENSSL_VERSION_NUMBER >= 0x30000000L EVP_CIPHER_free(cipher); #endif |
︙ | |||
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | 476 477 478 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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | + + + + + - + + + + + + - + + + + + + + + + + - + | * *------------------------------------------------------------------- */ int DigestInfo(Tcl_Interp *interp, Tcl_Obj *nameObj) { const EVP_MD *md; Tcl_Obj *resultObj, *listObj; unsigned long flags; int res = TCL_OK; char *name = Tcl_GetString(nameObj); /* Get message digest */ #if OPENSSL_VERSION_NUMBER < 0x30000000L md = EVP_get_digestbyname(name); #else md = EVP_MD_fetch(NULL, name, NULL); #endif if (md == NULL) { Tcl_AppendResult(interp, "Invalid digest \"", name, "\"", (char *) NULL); return TCL_ERROR; } /* Get properties */ resultObj = Tcl_NewListObj(0, NULL); if (resultObj == NULL) { |
︙ | |||
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 | + + + + + + + + + - + + + + + + + + + + + + + | *------------------------------------------------------------------- */ int MacInfo(Tcl_Interp *interp, Tcl_Obj *nameObj) { Tcl_Obj *resultObj; int res = TCL_OK; char *name = Tcl_GetString(nameObj); #if OPENSSL_VERSION_NUMBER < 0x30000000L if (strcmp(name, "cmac") != 0 && strcmp(name, "hmac") != 0) { Tcl_AppendResult(interp, "Invalid MAC \"", name, "\"", (char *) NULL); return TCL_ERROR; } #else EVP_MAC *mac = EVP_MAC_fetch(NULL, name, NULL); if (mac == NULL) { Tcl_AppendResult(interp, "Invalid MAC \"", name, "\"", (char *) NULL); return TCL_ERROR; } #endif /* Get properties */ resultObj = Tcl_NewListObj(0, NULL); if (resultObj == NULL) { |
︙ | |||
760 761 762 763 764 765 766 | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | - + + + + + + + + + + - + + + + + + + + | Tcl_AppendResult(interp, "Invalid public key method \"", name, "\"", (char *) NULL); return TCL_ERROR; } /* Get properties */ resultObj = Tcl_NewListObj(0, NULL); if (resultObj == NULL) { |
︙ |