Overview
Comment: | Added hashes command to list OpenSSL supported hash digests. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | crypto |
Files: | files | file ages | folders |
SHA3-256: |
78cf3787966eb397c64551ff54c25c9d |
User & Date: | bohagan on 2023-10-10 04:10:56 |
Other Links: | branch diff | manifest | tags |
Context
2023-10-11
| ||
22:34 | Modified ciphers command to make protocol arg optional to list all supported ciphers. check-in: a44d361c13 user: bohagan tags: crypto | |
2023-10-10
| ||
04:10 | Added hashes command to list OpenSSL supported hash digests. check-in: 78cf378796 user: bohagan tags: crypto | |
02:43 | Added hash command to calculate hash using any OpenSSL digest. Added convenience commands for md4, md5, sha1, and sha-256 digests. check-in: cafd2dc6ba user: bohagan tags: crypto | |
Changes
Modified doc/tls.html from [82151ac090] to [fe68420626].
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | <dd><b>tls::unimport</b> <em>channel</em></dd> <dt> </dt> <dd><b>tls::ciphers</b> <em>protocol ?verbose? ?supported?</em></dd> <dd><b>tls::protocols</b></dd> <dd><b>tls::version</b></dd> <dt> </dt> <dd><b>tls::hash</b> <em>type data</em></dd> <dd><b>tls::md4</b> <em>data</em></dd> <dd><b>tls::md5</b> <em>data</em></dd> <dd><b>tls::sha1</b> <em>data</em></dd> <dd><b>tls::sha256</b> <em>data</em></dd> </dl> </dd> <dd><a href="#COMMANDS">COMMANDS</a></dd> | > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | <dd><b>tls::unimport</b> <em>channel</em></dd> <dt> </dt> <dd><b>tls::ciphers</b> <em>protocol ?verbose? ?supported?</em></dd> <dd><b>tls::protocols</b></dd> <dd><b>tls::version</b></dd> <dt> </dt> <dd><b>tls::hash</b> <em>type data</em></dd> <dd><b>tls::hashes</b></dd> <dd><b>tls::md4</b> <em>data</em></dd> <dd><b>tls::md5</b> <em>data</em></dd> <dd><b>tls::sha1</b> <em>data</em></dd> <dd><b>tls::sha256</b> <em>data</em></dd> </dl> </dd> <dd><a href="#COMMANDS">COMMANDS</a></dd> |
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <a href="#tls::unimport"><b>tls::unimport</b> <i>channel</i></a><br> <br> <a href="#tls::ciphers"><b>tls::ciphers</b> <i>protocol ?verbose? ?supported?</i></a><br> <a href="#tls::protocols"><b>tls::protocols</b></a><br> <a href="#tls::version"><b>tls::version</b></a><br> <br> <a href="#tls::hash"><b>tls::hash</b> <i>type data</i></a><br> <a href="#tls::md4"><b>tls::md4</b> <i>data</i></a><br> <a href="#tls::md5"><b>tls::md5</b> <i>data</i></a><br> <a href="#tls::sha1"><b>tls::sha1</b> <i>data</i></a><br> <a href="#tls::sha256"><b>tls::sha256</b> <i>data</i></a><br> </p> <h3><a name="DESCRIPTION">DESCRIPTION</a></h3> | > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | <a href="#tls::unimport"><b>tls::unimport</b> <i>channel</i></a><br> <br> <a href="#tls::ciphers"><b>tls::ciphers</b> <i>protocol ?verbose? ?supported?</i></a><br> <a href="#tls::protocols"><b>tls::protocols</b></a><br> <a href="#tls::version"><b>tls::version</b></a><br> <br> <a href="#tls::hash"><b>tls::hash</b> <i>type data</i></a><br> <a href="#tls::hashes"><b>tls::hashes</b></a><br> <a href="#tls::md4"><b>tls::md4</b> <i>data</i></a><br> <a href="#tls::md5"><b>tls::md5</b> <i>data</i></a><br> <a href="#tls::sha1"><b>tls::sha1</b> <i>data</i></a><br> <a href="#tls::sha256"><b>tls::sha256</b> <i>data</i></a><br> </p> <h3><a name="DESCRIPTION">DESCRIPTION</a></h3> |
︙ | ︙ | |||
449 450 451 452 453 454 455 456 457 458 459 460 461 462 | <dt><a name="tls::hash"><strong>tls::hash</strong> <em>type data</em></a></dt> <dd>Calculate the hash for <em>data</em> using <em>type</em> digest. Returns value as a hex string. Type cam be any OpenSSL supported hash digest including: <b>md4</b>, <b>md5</b>, <b>sha1</b>, sha2 (<b>sha224</b>, <b>sha256</b>, <b>sha384</b>, <b>sha512</b>, <b>sha512-224</b>, and <b>sha512-256</b>), sha3 (<b>sha3-224</b>, <b>sha3-256</b>, <b>sha3-384</b>, and <b>sha3-512</b>), etc.</dd> <dt><a name="tls::md4"><strong>tls::md4</strong> <em>data</em></a></dt> <dd>Calculate the hash for <em>data</em> using the MD4 message-digest algorithm.</dd> <dt><a name="tls::md5"><strong>tls::md5</strong> <em>data</em></a></dt> <dd>Calculate the hash for <em>data</em> using the MD5 message-digest algorithm.</dd> | > > > | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | <dt><a name="tls::hash"><strong>tls::hash</strong> <em>type data</em></a></dt> <dd>Calculate the hash for <em>data</em> using <em>type</em> digest. Returns value as a hex string. Type cam be any OpenSSL supported hash digest including: <b>md4</b>, <b>md5</b>, <b>sha1</b>, sha2 (<b>sha224</b>, <b>sha256</b>, <b>sha384</b>, <b>sha512</b>, <b>sha512-224</b>, and <b>sha512-256</b>), sha3 (<b>sha3-224</b>, <b>sha3-256</b>, <b>sha3-384</b>, and <b>sha3-512</b>), etc.</dd> <dt><a name="tls::hashes"><strong>tls::hashes</strong></a></dt> <dd>Returns a list of the valid hash digests.</dd> <dt><a name="tls::md4"><strong>tls::md4</strong> <em>data</em></a></dt> <dd>Calculate the hash for <em>data</em> using the MD4 message-digest algorithm.</dd> <dt><a name="tls::md5"><strong>tls::md5</strong> <em>data</em></a></dt> <dd>Calculate the hash for <em>data</em> using the MD5 message-digest algorithm.</dd> |
︙ | ︙ |
Modified generic/tls.c from [30dc12770e] to [d77314704b].
︙ | ︙ | |||
974 975 976 977 978 979 980 | } return TCL_OK; } /* *------------------------------------------------------------------- * | | | 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | } return TCL_OK; } /* *------------------------------------------------------------------- * * Hash Commands -- Return hash value for digest as hex string * * Results: * A standard Tcl result. * * Side effects: * None. * |
︙ | ︙ | |||
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | /* * Command to Calculate SHA-256 Hash */ int HashSHA256Cmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { return HashCalc(interp, objc, objv, EVP_sha256()); } /* *------------------------------------------------------------------- * * CiphersObjCmd -- list available ciphers * * This procedure is invoked to process the "tls::ciphers" command | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | /* * Command to Calculate SHA-256 Hash */ int HashSHA256Cmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { return HashCalc(interp, objc, objv, EVP_sha256()); } /* *------------------------------------------------------------------- * * Hash List Command -- Return list of hash message digests * * Results: * A standard Tcl result. * * Side effects: * None. * *------------------------------------------------------------------- */ void HashListCallback(const OBJ_NAME *obj, void *arg) { Tcl_Obj *objPtr = (Tcl_Obj *) arg; Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj(obj->name,-1)); } /* * Command to list available Hash values */ int HashListCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *objPtr = Tcl_NewListObj(0, NULL); OpenSSL_add_all_digests(); //make sure they're loaded OBJ_NAME_do_all(OBJ_NAME_TYPE_MD_METH, HashListCallback, (void *) objPtr); Tcl_ResetResult(interp); Tcl_SetObjResult(interp, objPtr); return TCL_OK; clientData = clientData; objc = objc; objv = objv; } /* *------------------------------------------------------------------- * * CiphersObjCmd -- list available ciphers * * This procedure is invoked to process the "tls::ciphers" command |
︙ | ︙ | |||
2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 | Tcl_CreateObjCommand(interp, "tls::unimport", UnimportObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::status", StatusObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::version", VersionObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::misc", MiscObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::protocols", ProtocolsObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::hash", HashCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::md4", HashMD4Cmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::md5", HashMD5Cmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::sha1", HashSHA1Cmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::sha256", HashSHA256Cmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); if (interp) { Tcl_Eval(interp, tlsTclInitScript); | > | 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 | Tcl_CreateObjCommand(interp, "tls::unimport", UnimportObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::status", StatusObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::version", VersionObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::misc", MiscObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::protocols", ProtocolsObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::hash", HashCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::hashes", HashListCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::md4", HashMD4Cmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::md5", HashMD5Cmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::sha1", HashSHA1Cmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::sha256", HashSHA256Cmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); if (interp) { Tcl_Eval(interp, tlsTclInitScript); |
︙ | ︙ |