Overview
Comment: | Support using a different sized hash result from BLAKE2b |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5b9fcbfff6cdc5bdc88dfe2c27b8fa64 |
User & Date: | rkeene on 2018-07-02 11:29:19 |
Other Links: | manifest | tags |
Context
2018-07-02
| ||
11:29 | Added start of high-level interfaces check-in: 2c0ba950ff user: rkeene tags: trunk | |
11:29 | Support using a different sized hash result from BLAKE2b check-in: 5b9fcbfff6 user: rkeene tags: trunk | |
07:36 | Improved work on static linking check-in: a8c730ce43 user: rkeene tags: trunk | |
Changes
Modified nano.c from [470015e0f0] to [a093ea96ca].
︙ | ︙ | |||
299 300 301 302 303 304 305 306 307 | /* NOTREACH */ clientData = clientData; } static int nano_tcl_hash_data(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { unsigned char *data, result[crypto_sign_BYTES]; int data_length, result_length; | > | | > > > > > > > > > > > > > > > > > | | > > | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | /* NOTREACH */ clientData = clientData; } static int nano_tcl_hash_data(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { unsigned char *data, result[crypto_sign_BYTES]; int tgifo_ret; int data_length, result_length; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "data ?hashLength?"); return(TCL_ERROR); } data = Tcl_GetByteArrayFromObj(objv[1], &data_length); if (objc == 3) { tgifo_ret = Tcl_GetIntFromObj(interp, objv[2], &result_length); if (tgifo_ret != TCL_OK) { return(tgifo_ret); } if (result_length > sizeof(result)) { Tcl_SetResult(interp, "Hash length too large", NULL); return(TCL_ERROR); } blake2b(result, result_length, data, data_length, NULL, 0); } else { /* * Default to the same as the cryptographic primitive */ crypto_hash(result, data, data_length); result_length = crypto_sign_BYTES; } Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(result, result_length)); return(TCL_OK); /* NOTREACH */ clientData = clientData; } |
︙ | ︙ | |||
332 333 334 335 336 337 338 339 340 341 342 343 344 345 | return(TCL_OK); /* NOTREACH */ clientData = clientData; } int Nano_Init(Tcl_Interp *interp) { const char nanoInitScript[] = { #include "nano.tcl.h" 0x00 }; #ifdef USE_TCL_STUBS const char *tclInitStubs_ret; | > | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | return(TCL_OK); /* NOTREACH */ clientData = clientData; } int Nano_Init(Tcl_Interp *interp) { int te_ret; const char nanoInitScript[] = { #include "nano.tcl.h" 0x00 }; #ifdef USE_TCL_STUBS const char *tclInitStubs_ret; |
︙ | ︙ | |||
354 355 356 357 358 359 360 | Tcl_CreateObjCommand(interp, "::nano::internal::generateKey", nano_tcl_generate_keypair, NULL, NULL); Tcl_CreateObjCommand(interp, "::nano::internal::signDetached", nano_tcl_sign_detached, NULL, NULL); Tcl_CreateObjCommand(interp, "::nano::internal::publicKey", nano_tcl_secret_key_to_public_key, NULL, NULL); Tcl_CreateObjCommand(interp, "::nano::internal::verifyDetached", nano_tcl_verify_detached, NULL, NULL); Tcl_CreateObjCommand(interp, "::nano::internal::hashData", nano_tcl_hash_data, NULL, NULL); if (interp) { | | > > > | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | Tcl_CreateObjCommand(interp, "::nano::internal::generateKey", nano_tcl_generate_keypair, NULL, NULL); Tcl_CreateObjCommand(interp, "::nano::internal::signDetached", nano_tcl_sign_detached, NULL, NULL); Tcl_CreateObjCommand(interp, "::nano::internal::publicKey", nano_tcl_secret_key_to_public_key, NULL, NULL); Tcl_CreateObjCommand(interp, "::nano::internal::verifyDetached", nano_tcl_verify_detached, NULL, NULL); Tcl_CreateObjCommand(interp, "::nano::internal::hashData", nano_tcl_hash_data, NULL, NULL); if (interp) { te_ret = Tcl_Eval(interp, nanoInitScript); if (te_ret != TCL_OK) { return(te_ret); } } return(TCL_OK); } |