Comment: | Updated error messages and optimized when to add error message to result. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | crypto |
Files: | files | file ages | folders |
SHA3-256: |
2b4e85a3ebcf1da1163cc3c7ea90a0ef |
User & Date: | bohagan on 2023-11-14 00:53:04.000 |
Other Links: | branch diff | manifest | tags |
2023-11-14
| ||
03:53 | Split ciphers test file into digest and info test files. Added common.tcl file for common test constraints. Updated HMAC and CMAC test cases Added RFC 4231 HMAC example test cases. check-in: b186ba1b7d user: bohagan tags: crypto | |
00:53 | Updated error messages and optimized when to add error message to result. check-in: 2b4e85a3eb user: bohagan tags: crypto | |
2023-11-13
| ||
03:14 | Changed hex output to use lowercase letters check-in: aef7825f91 user: bohagan tags: crypto | |
Modified generic/tlsDigest.c
from [9e69cd3c7b]
to [03763b15bf].
133 134 135 136 137 138 139 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 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 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 | - + - + - + - + + + + + | * Side effects: * No result or error message * *------------------------------------------------------------------- */ int Tls_DigestInit(Tcl_Interp *interp, DigestState *statePtr, const EVP_MD *md, const EVP_CIPHER *cipher, Tcl_Obj *keyObj) { |
230 231 232 233 234 235 236 | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | - + | res = HMAC_Final(statePtr->hctx, md_buf, &md_len); } else if (statePtr->format & TYPE_CMAC) { size_t len; res = CMAC_Final(statePtr->cctx, md_buf, &len); md_len = (unsigned int) len; } if (!res) { |
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | + - + - | if ((res = Tcl_SetChannelOption(interp, chan, "-translation", "binary")) == TCL_ERROR) { goto done; } Tcl_SetChannelBufferSize(chan, BUFFER_SIZE); /* Create state data struct */ if ((statePtr = Tls_DigestNew(interp, format)) == NULL) { Tcl_AppendResult(interp, "Memory allocation error", (char *) NULL); res = TCL_ERROR; goto done; } /* Initialize hash function */ if ((res = Tls_DigestInit(interp, statePtr, md, cipher, keyObj)) != TCL_OK) { goto done; } /* Read file data and update hash function */ while (!Tcl_Eof(chan)) { len = Tcl_ReadRaw(chan, (char *) buf, BUFFER_SIZE); if (len > 0) { |
431 432 433 434 435 436 437 | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | - - + + | /* Get bytes from underlying channel */ parent = Tcl_GetStackedChannel(statePtr->self); read = Tcl_ReadRaw(parent, buf, toRead); /* Update hash function */ if (read > 0) { |
460 461 462 463 464 465 466 | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | - + | res = HMAC_Final(statePtr->hctx, md_buf, &md_len); } else if (statePtr->format & TYPE_CMAC) { size_t len; res = CMAC_Final(statePtr->cctx, md_buf, &len); md_len = (unsigned int) len; } if (!res) { |
512 513 514 515 516 517 518 | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | - - + + | /* Abort if nothing to process */ if (toWrite <= 0 || statePtr->self == (Tcl_Channel) NULL) { return 0; } /* Update hash function */ |
797 798 799 800 801 802 803 | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | - + | } /* Make sure to operate on the topmost channel */ chan = Tcl_GetTopChannel(chan); /* Create state data struct */ if ((statePtr = Tls_DigestNew(interp, format)) == NULL) { |
922 923 924 925 926 927 928 | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 | - + - - | buf = Tcl_GetByteArrayFromObj(objv[2], &len); } else { Tcl_WrongNumArgs(interp, 1, objv, "update data"); return TCL_ERROR; } /* Update hash function */ |
983 984 985 986 987 988 989 | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 | - + | int Tls_DigestInstance(Tcl_Interp *interp, Tcl_Obj *cmdObj, const EVP_MD *md, const EVP_CIPHER *cipher, int format, Tcl_Obj *keyObj) { DigestState *statePtr; char *cmdName = Tcl_GetStringFromObj(cmdObj, NULL); /* Create state data struct */ if ((statePtr = Tls_DigestNew(interp, format)) == NULL) { |
1061 1062 1063 1064 1065 1066 1067 | 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 | - + | DigestState *statePtr; if ((statePtr = Tls_DigestNew(interp, format)) == NULL) { Tcl_AppendResult(interp, "Memory allocation error", (char *) NULL); return TCL_ERROR; } if (Tls_DigestInit(interp, statePtr, md, cipher, keyObj) != TCL_OK || |
Modified generic/tlsX509.c
from [2979c19145]
to [ead2e837f3].
430 431 432 433 434 435 436 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | - + - + | /* Subject identifies the entity associated with the public key stored in the subject public key field. RFC 5280 section 4.1.2.6 */ len = BIO_to_Buffer(X509_NAME_print_ex(bio, X509_get_subject_name(cert), 0, flags), bio, buffer, BUFSIZ); LAPPEND_STR(interp, certPtr, "subject", buffer, len); /* SHA1 Digest (Fingerprint) of cert - DER representation */ if (X509_digest(cert, EVP_sha1(), md, &len)) { |
476 477 478 479 480 481 482 | 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 | - + - + | LAPPEND_STR(interp, certPtr, "purpose", Tls_x509Purpose(cert), -1); LAPPEND_OBJ(interp, certPtr, "certificatePurpose", Tls_x509Purposes(interp, cert)); /* Get extensions flags */ xflags = X509_get_extension_flags(cert); LAPPEND_INT(interp, certPtr, "extFlags", xflags); |
512 513 514 515 516 517 518 | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | - + | LAPPEND_INT(interp, certPtr, "extCount", X509_get_ext_count(cert)); LAPPEND_OBJ(interp, certPtr, "extensions", Tls_x509Extensions(interp, cert)); /* Authority Key Identifier (AKI) is the Subject Key Identifier (SKI) of its signer (the CA). RFC 5280 section 4.2.1.1, NID_authority_key_identifier */ LAPPEND_OBJ(interp, certPtr, "authorityKeyIdentifier", Tls_x509Identifier(X509_get0_authority_key_id(cert))); |