Skip to content

Commit 4710803

Browse files
committed
debugging-2
1 parent 0aeb3a8 commit 4710803

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/tests/p11test/p11test_case_common.c

+24-24
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ int callback_public_keys(test_certs_t *objects,
369369
OSSL_PARAM_BLD *bld = NULL;
370370
#endif
371371

372-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
372+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
373373

374374

375375
/* Search for already stored certificate with same ID */
@@ -387,7 +387,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
387387
return -1;
388388
}
389389

390-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
390+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
391391

392392
o->public_handle = object_handle;
393393
o->verify = (template[0].ulValueLen == sizeof(CK_BBOOL))
@@ -402,7 +402,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
402402
o->derive_pub = (template[9].ulValueLen == sizeof(CK_BBOOL))
403403
? *((CK_BBOOL *) template[9].pValue) : CK_FALSE;
404404

405-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
405+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
406406

407407
/* check if we get the same public key as from the certificate */
408408
if (o->key_type == CKK_RSA) {
@@ -508,7 +508,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
508508
EC_POINT *cert_point = NULL;
509509
#endif
510510

511-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
511+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
512512

513513
/* Parse the nid out of the EC_PARAMS */
514514
p = template[6].pValue;
@@ -525,7 +525,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
525525
" to NID", o->id_str);
526526
goto ec_out;
527527
}
528-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
528+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
529529

530530
ecgroup = EC_GROUP_new_by_curve_name(nid);
531531
if (ecgroup == NULL) {
@@ -535,14 +535,14 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
535535
}
536536
EC_GROUP_set_asn1_flag(ecgroup, OPENSSL_EC_NAMED_CURVE);
537537

538-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
538+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
539539

540540
p = template[7].pValue;
541541
pub_asn1 = d2i_ASN1_OCTET_STRING(NULL, &p, template[7].ulValueLen);
542542
pub = ASN1_STRING_get0_data(pub_asn1);
543543
pub_len = ASN1_STRING_length(pub_asn1);
544544

545-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
545+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
546546

547547
if (!(ecpoint = EC_POINT_new(ecgroup))) {
548548
debug_print(" [WARN %s ] Cannot allocate EC_POINT", o->id_str);
@@ -566,7 +566,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
566566
unsigned char pubkey[256];
567567
size_t pubkey_len = 0;
568568
int cert_nid = 0;
569-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
569+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
570570

571571
if (EVP_PKEY_get_group_name(o->key, curve_name, sizeof(curve_name), &curve_name_len) != 1 ||
572572
(cert_nid = OBJ_txt2nid(curve_name)) == NID_undef ||
@@ -590,7 +590,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
590590
o->id_str);
591591
goto ec_out;
592592
}
593-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
593+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
594594

595595
o->verify_public = 1;
596596
} else { /* store the public key for future use */
@@ -606,7 +606,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
606606
#else
607607
ctx = EVP_PKEY_CTX_new_from_name(0, "EC", 0);
608608

609-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
609+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
610610

611611
const char *curve_name = OBJ_nid2sn(nid);
612612
if (!(bld = OSSL_PARAM_BLD_new()) ||
@@ -640,7 +640,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
640640
EC_POINT_free(cert_point);
641641
#endif
642642

643-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
643+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
644644

645645
if (ec_error) {
646646
debug_print(" [WARN %s ] Failed to check EC public key", o->id_str);
@@ -656,7 +656,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
656656
ASN1_OCTET_STRING *os;
657657
int evp_type;
658658

659-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
659+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
660660

661661
a = template[6].pValue;
662662
if (d2i_ASN1_PRINTABLESTRING(&curve, &a, (long)template[6].ulValueLen) != NULL) {
@@ -719,7 +719,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
719719
return -1;
720720
}
721721

722-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
722+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
723723

724724
/* PKCS#11-compliant modules should return ASN1_OCTET_STRING */
725725
a = template[7].pValue;
@@ -728,31 +728,31 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
728728
debug_print(" [WARN %s ] Cannot decode EC_POINT", o->id_str);
729729
return -1;
730730
}
731-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
731+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
732732

733733
if (os->length != 32) {
734734
debug_print(" [WARN %s ] Invalid length of EC_POINT value", o->id_str);
735735
return -1;
736736
}
737-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
737+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
738738

739739
key = EVP_PKEY_new_raw_public_key(evp_type, NULL,
740740
(const uint8_t *)os->data,
741741
os->length);
742-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
742+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
743743

744744
if (key == NULL) {
745745
debug_print(" [WARN %s ] Out of memory", o->id_str);
746746
ASN1_STRING_free(os);
747747
return -1;
748748
}
749-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
749+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
750750

751751
if (o->key != NULL) {
752752
unsigned char *pub = NULL;
753753
size_t publen = 0;
754754

755-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
755+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
756756

757757
/* TODO check EVP_PKEY type */
758758

@@ -768,7 +768,7 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
768768
return -1;
769769
}
770770

771-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
771+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
772772

773773
if (EVP_PKEY_get_raw_public_key(o->key, pub, &publen) != 1 ||
774774
publen != (size_t)os->length ||
@@ -783,29 +783,29 @@ debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
783783
free(pub);
784784
EVP_PKEY_free(key);
785785
o->verify_public = 1;
786-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
786+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
787787

788788
} else { /* store the public key for future use */
789-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
789+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
790790

791791
o->type = evp_type;
792792
o->key = key;
793793
o->bits = 255;
794794
}
795795
ASN1_STRING_free(os);
796796
} else {
797-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
797+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
798798

799799
debug_print(" [WARN %s ] unknown key. Key type: %02lX",
800800
o->id_str, o->key_type);
801801
return -1;
802802
}
803803

804-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
804+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
805805

806806
add_supported_mechs(o);
807807

808-
debug_print(" [ OK %s ] at %d", __FILE__, __LINE__);
808+
debug_print(" [ OK %s ] at %s:%d", o->id_str, __FILE__, __LINE__);
809809

810810
debug_print(" [ OK %s ] Public key loaded successfully V:%d E:%d T:%02lX",
811811
o->id_str, o->verify, o->encrypt, o->key_type);

0 commit comments

Comments
 (0)