Browse Source

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
ed64732b73
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      src/crypto/rsa.c

+ 7
- 1
src/crypto/rsa.c View File

39
  * RSA is documented in RFC 3447.
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
 /** "rsaEncryption" object identifier */
48
 /** "rsaEncryption" object identifier */
43
 static uint8_t oid_rsa_encryption[] = { ASN1_OID_RSAENCRYPTION };
49
 static uint8_t oid_rsa_encryption[] = { ASN1_OID_RSAENCRYPTION };
44
 
50
 
610
 	if ( memcmp ( actual, expected, context->max_len ) != 0 ) {
616
 	if ( memcmp ( actual, expected, context->max_len ) != 0 ) {
611
 		DBGC ( context, "RSA %p signature verification failed\n",
617
 		DBGC ( context, "RSA %p signature verification failed\n",
612
 		       context );
618
 		       context );
613
-		return -EACCES;
619
+		return -EACCES_VERIFY;
614
 	}
620
 	}
615
 
621
 
616
 	DBGC ( context, "RSA %p signature verified successfully\n", context );
622
 	DBGC ( context, "RSA %p signature verified successfully\n", context );

Loading…
Cancel
Save