Bladeren bron

[crypto] Add an explicit "RSA signature incorrect" error message

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 jaren geleden
bovenliggende
commit
ed64732b73
1 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 7
    1
      src/crypto/rsa.c

+ 7
- 1
src/crypto/rsa.c Bestand weergeven

@@ -39,6 +39,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
39 39
  * RSA is documented in RFC 3447.
40 40
  */
41 41
 
42
+/* Disambiguate the various error causes */
43
+#define EACCES_VERIFY \
44
+	__einfo_error ( EINFO_EACCES_VERIFY )
45
+#define EINFO_EACCES_VERIFY \
46
+	__einfo_uniqify ( EINFO_EACCES, 0x01, "RSA signature incorrect" )
47
+
42 48
 /** "rsaEncryption" object identifier */
43 49
 static uint8_t oid_rsa_encryption[] = { ASN1_OID_RSAENCRYPTION };
44 50
 
@@ -610,7 +616,7 @@ static int rsa_verify ( void *ctx, struct digest_algorithm *digest,
610 616
 	if ( memcmp ( actual, expected, context->max_len ) != 0 ) {
611 617
 		DBGC ( context, "RSA %p signature verification failed\n",
612 618
 		       context );
613
-		return -EACCES;
619
+		return -EACCES_VERIFY;
614 620
 	}
615 621
 
616 622
 	DBGC ( context, "RSA %p signature verified successfully\n", context );

Laden…
Annuleren
Opslaan