Diff

Differences From Artifact [e2ea39ef40]:

To Artifact [95753c0faa]:


391
392
393
394
395
396
397

398
399
400
401



402
403
404
405
406
407
408
391
392
393
394
395
396
397
398
399

400
401
402
403
404
405
406
407
408
409
410
411







+

-


+
+
+







 *
 * Side effects:
 *	None.
 *
 *-------------------------------------------------------------------
 */
int DigestInfo(Tcl_Interp *interp, char *digestName) {
    EVP_MD *md;
    Tcl_Obj *objPtr, *listPtr;
    EVP_MD *md = EVP_get_digestbyname(digestName);
    unsigned long flags;

    /* Get message digest */
    md = EVP_get_digestbyname(digestName);

    if (md == NULL) {
	Tcl_AppendResult(interp, "Invalid digest \"", digestName, "\"", NULL);
	return TCL_ERROR;
    }

    /* Get properties */
    objPtr = Tcl_NewListObj(0, NULL);
505
506
507
508
509
510
511















512

513
514
515
516
517
518
519
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







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+







 *
 * Side effects:
 *	None.
 *
 *-------------------------------------------------------------------
 */
int MacInfo(Tcl_Interp *interp, char *macName) {
    if (strcmp(macName, "cmac") != 0 && strcmp(macName, "hmac") != 0) {
	Tcl_AppendResult(interp, "Invalid MAC \"", macName, "\"", NULL);
	return TCL_ERROR;
    }

    /* Get properties */
    objPtr = Tcl_NewListObj(0, NULL);
    if (objPtr == NULL) {
	return TCL_ERROR;
    }
    LAPPEND_STR(interp, objPtr, "name", macName, -1);
    LAPPEND_STR(interp, objPtr, "description", "", -1);
    LAPPEND_STR(interp, objPtr, "provider", "", -1);

    Tcl_SetObjResult(interp, objPtr);
     return TCL_OK;
    return TCL_OK;
}

/*
 *-------------------------------------------------------------------
 *
 * MacList --
 *
590
591
592
593
594
595
596

























597

598
599
600
601
602
603
604
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639

640
641
642
643
644
645
646
647







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+







 *
 * Side effects:
 *	None.
 *
 *-------------------------------------------------------------------
 */
int PkeyInfo(Tcl_Interp *interp, char *pkeyName) {
    Tcl_Obj *objPtr;
    EVP_PKEY *pkey = NULL;

/* In work */
    if (pkey == NULL) {
	Tcl_AppendResult(interp, "Invalid public key method \"", pkeyName, "\"", NULL);
	return TCL_ERROR;
    }

    /* Get properties */
    objPtr = Tcl_NewListObj(0, NULL);
    if (objPtr == NULL) {
	return TCL_ERROR;
    }
    LAPPEND_STR(interp, objPtr, "name", OBJ_nid2ln(EVP_PKEY_id(pkey)), -1);
    LAPPEND_STR(interp, objPtr, "description", "", -1);
    LAPPEND_STR(interp, objPtr, "baseId", OBJ_nid2ln(EVP_PKEY_base_id(pkey)), -1);
    LAPPEND_STR(interp, objPtr, "provider", "", -1);
    LAPPEND_STR(interp, objPtr, "type", OBJ_nid2ln(EVP_PKEY_type(EVP_PKEY_id(pkey))), -1);

    LAPPEND_INT(interp, objPtr, "size", EVP_PKEY_size(pkey));
    LAPPEND_INT(interp, objPtr, "bits", EVP_PKEY_bits(pkey));
    LAPPEND_INT(interp, objPtr, "security_bits", EVP_PKEY_security_bits(pkey));

    Tcl_SetObjResult(interp, objPtr);
     return TCL_OK;
    return TCL_OK;
}

/*
 *-------------------------------------------------------------------
 *
 * PkeyList --
 *