Add tests for parsing CSRs
diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function
index f3da1fc..91b53aa 100644
--- a/tests/suites/test_suite_x509parse.function
+++ b/tests/suites/test_suite_x509parse.function
@@ -1,6 +1,7 @@
/* BEGIN_HEADER */
#include <polarssl/x509_crt.h>
#include <polarssl/x509_crl.h>
+#include <polarssl/x509_csr.h>
#include <polarssl/pem.h>
#include <polarssl/oid.h>
@@ -75,6 +76,28 @@
}
/* END_CASE */
+/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_CSR_PARSE_C */
+void x509_csr_info( char *csr_file, char *result_str )
+{
+ x509_csr csr;
+ char buf[2000];
+ int res;
+
+ x509_csr_init( &csr );
+ memset( buf, 0, 2000 );
+
+ TEST_ASSERT( x509_csr_parse_file( &csr, csr_file ) == 0 );
+ res = x509_csr_info( buf, 2000, "", &csr );
+
+ x509_csr_free( &csr );
+
+ TEST_ASSERT( res != -1 );
+ TEST_ASSERT( res != -2 );
+
+ TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+}
+/* END_CASE */
+
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_CRT_PARSE_C:POLARSSL_X509_CRL_PARSE_C */
void x509_verify( char *crt_file, char *ca_file, char *crl_file,
char *cn_name_str, int result, int flags_result,