Skip to content

Commit 4c6279c

Browse files
committed
Good feedback about adding wolfCrypt error codes to .cs layer. Partially added useful ones.
1 parent 9b50708 commit 4c6279c

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ private static int myVerify(int preverify, IntPtr x509_ctx)
6060
/* X509_STORE_CTX_get_error API can be enabled with
6161
* OPENSSL_EXTRA_X509_SMALL or WOLFSSL_EXTRA */
6262
int error = wolfssl.X509_STORE_CTX_get_error(x509_ctx);
63-
const int ASN_BEFORE_DATE_E = -150; /* ASN date error, current date before */
64-
65-
if (error == ASN_BEFORE_DATE_E) {
63+
if (error == wolfcrypt.ASN_BEFORE_DATE_E) {
6664
verify = 1; /* override error */
6765
}
6866

wrapper/CSharp/wolfSSL_CSharp/wolfCrypt.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,29 @@ private static void log(int lvl, string msg)
566566
public static readonly int AES_BLOCK_SIZE = 16;
567567

568568
/* Error codes */
569-
public static readonly int SUCCESS = 0;
570-
public static readonly int SIG_VERIFY_E = -229; /* wolfcrypt signature verify error */
571-
public static readonly int MEMORY_E = -125; /* Out of memory error */
572-
public static readonly int EXCEPTION_E = -1;
573-
public static readonly int BUFFER_E = -131; /* RSA buffer error, output too small/large */
569+
public static readonly int SUCCESS = 0;
570+
public static readonly int EXCEPTION_E = -1;
571+
public static readonly int MEMORY_E = -125; /* Out of memory error */
572+
public static readonly int BUFFER_E = -131; /* RSA buffer error, output too small/large */
573+
public static readonly int ASN_PARSE_E = -140; /* ASN parsing error, invalid input */
574+
public static readonly int ASN_VERSION_E = -141; /* ASN version error, invalid number */
575+
public static readonly int ASN_GETINT_E = -142; /* ASN get big int error, invalid data */
576+
public static readonly int ASN_RSA_KEY_E = -143; /* ASN key init error, invalid input */
577+
public static readonly int ASN_OBJECT_ID_E = -144; /* ASN object id error, invalid id */
578+
public static readonly int ASN_TAG_NULL_E = -145; /* ASN tag error, not null */
579+
public static readonly int ASN_EXPECT_0_E = -146; /* ASN expect error, not zero */
580+
public static readonly int ASN_BITSTR_E = -147; /* ASN bit string error, wrong id */
581+
public static readonly int ASN_UNKNOWN_OID_E = -148; /* ASN oid error, unknown sum id */
582+
public static readonly int ASN_DATE_SZ_E = -149; /* ASN date error, bad size */
583+
public static readonly int ASN_BEFORE_DATE_E = -150; /* ASN date error, current date before */
584+
public static readonly int ASN_AFTER_DATE_E = -151; /* ASN date error, current date after */
585+
public static readonly int ASN_SIG_OID_E = -152; /* ASN signature error, mismatched oid */
586+
public static readonly int ASN_TIME_E = -153; /* ASN time error, unknown time type */
587+
public static readonly int ASN_INPUT_E = -154; /* ASN input error, not enough data */
588+
public static readonly int ASN_SIG_CONFIRM_E = -155; /* ASN sig error, confirm failure */
589+
public static readonly int ASN_SIG_HASH_E = -156; /* ASN sig error, unsupported hash type */
590+
public static readonly int ASN_SIG_KEY_E = -157; /* ASN sig error, unsupported key type */
591+
public static readonly int SIG_VERIFY_E = -229; /* wolfcrypt signature verify error */
574592

575593

576594
/***********************************************************************

0 commit comments

Comments
 (0)