Overview
Comment: | Fixed bug in update and finalize handlers for encrypt using accumulator command. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | crypto |
Files: | files | file ages | folders |
SHA3-256: |
9bcee7c0e7187613d41e59901c18426e |
User & Date: | bohagan on 2024-05-19 20:15:50 |
Other Links: | branch diff | manifest | tags |
Context
2024-05-19
| ||
20:54 | Ensure minimum buffer size for encryption channel. check-in: 986ea5b483 user: bohagan tags: crypto | |
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 | |
Changes
Modified generic/tlsEncrypt.c from [d282984124] to [8d7af4c409].
︙ | ︙ | |||
920 921 922 923 924 925 926 | /* Get function */ if (Tcl_GetIndexFromObj(interp, objv[1], instance_fns, "function", 0, &fn) != TCL_OK) { return TCL_ERROR; } /* Allocate storage for result. Size should be data size + block size. */ resultObj = Tcl_NewObj(); | < | < > > > > > > > > > > > > > > > | 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | /* Get function */ if (Tcl_GetIndexFromObj(interp, objv[1], instance_fns, "function", 0, &fn) != TCL_OK) { return TCL_ERROR; } /* Allocate storage for result. Size should be data size + block size. */ resultObj = Tcl_NewObj(); if (resultObj == NULL) { Tcl_AppendResult(interp, "Memory allocation error", (char *) NULL); return TCL_ERROR; } /* Do function */ if (fn) { /* Get data or return error if none */ if (objc == 3) { data = Tcl_GetByteArrayFromObj(objv[2], &data_len); } else { Tcl_WrongNumArgs(interp, 1, objv, "update data"); return TCL_ERROR; } /* Allocate output buffer */ out_buf = Tcl_SetByteArrayLength(resultObj, data_len+EVP_MAX_BLOCK_LENGTH); if (data == NULL || out_buf == NULL) { Tcl_DecrRefCount(resultObj); Tcl_AppendResult(interp, "Memory allocation error", (char *) NULL); return TCL_ERROR; } /* Update function */ if (EncryptUpdate(interp, statePtr->type, statePtr->ctx, out_buf, &out_len, data, data_len) == TCL_OK) { out_buf = Tcl_SetByteArrayLength(resultObj, (Tcl_Size) out_len); Tcl_SetObjResult(interp, resultObj); } else { Tcl_DecrRefCount(resultObj); return TCL_ERROR; } } else { /* Allocate output buffer */ out_buf = Tcl_SetByteArrayLength(resultObj, EVP_MAX_BLOCK_LENGTH); if (out_buf == NULL) { Tcl_DecrRefCount(resultObj); Tcl_AppendResult(interp, "Memory allocation error", (char *) NULL); return TCL_ERROR; } /* Finalize function */ if (EncryptFinalize(interp, statePtr->type, statePtr->ctx, out_buf, &out_len) == TCL_OK) { out_buf = Tcl_SetByteArrayLength(resultObj, (Tcl_Size) out_len); Tcl_SetObjResult(interp, resultObj); } else { Tcl_DecrRefCount(resultObj); return TCL_ERROR; |
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 | /*******************************************************************/ /* *------------------------------------------------------------------- * * EncryptFileHandler -- * | | > | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | /*******************************************************************/ /* *------------------------------------------------------------------- * * EncryptFileHandler -- * * Perform encryption function on a block of data, write it to a * file, then return the result. * * Returns: * TCL_OK or TCL_ERROR * * Side effects: * Encrypts or decrypts inFile data to outFile and sets result to * size of outFile, or an error message. |
︙ | ︙ |