More granular define selections within code to allow for smaller code
sizes
diff --git a/library/oid.c b/library/oid.c
index 53c2e5d..51851ba 100644
--- a/library/oid.c
+++ b/library/oid.c
@@ -33,6 +33,8 @@
#include "polarssl/md.h"
#include "polarssl/rsa.h"
+#include <stdio.h>
+
/*
* For X520 attribute types
*/
@@ -77,6 +79,7 @@
}
};
+#if defined(POLARSSL_X509_PARSE_C) || defined(POLARSSL_X509_WRITE_C)
/*
* For X509 extensions
*/
@@ -123,6 +126,7 @@
{ OID_OCSP_SIGNING, "id-kp-OCSPSigning", "OCSP Signing" },
{ NULL, NULL, NULL },
};
+#endif /* POLARSSL_X509_PARSE_C || POLARSSL_X509_WRITE_C */
/*
* For SignatureAlgorithmIdentifier
@@ -378,6 +382,7 @@
oid->p, oid->len );
}
+#if defined(POLARSSL_X509_PARSE_C) || defined(POLARSSL_X509_WRITE_C)
int oid_get_extended_key_usage( const asn1_buf *oid, const char **desc )
{
const oid_descriptor_t *data = oid_descriptor_from_asn1(
@@ -401,6 +406,20 @@
oid );
}
+int oid_get_x509_ext_type( const asn1_buf *oid, int *ext_type )
+{
+ const oid_x509_ext_t *data = oid_x509_ext_from_asn1( oid );
+
+ if( data == NULL )
+ return( POLARSSL_ERR_OID_NOT_FOUND );
+
+ *ext_type = data->ext_type;
+
+ return( 0 );
+}
+
+#endif /* POLARSSL_X509_PARSE_C || POLARSSL_X509_WRITE_C */
+
static const oid_x520_attr_t *oid_x520_attr_from_asn1( const asn1_buf *oid )
{
return (const oid_x520_attr_t *) oid_descriptor_from_asn1(
@@ -433,18 +452,6 @@
oid );
}
-int oid_get_x509_ext_type( const asn1_buf *oid, int *ext_type )
-{
- const oid_x509_ext_t *data = oid_x509_ext_from_asn1( oid );
-
- if( data == NULL )
- return( POLARSSL_ERR_OID_NOT_FOUND );
-
- *ext_type = data->ext_type;
-
- return( 0 );
-}
-
int oid_get_attr_short_name( const asn1_buf *oid, const char **short_name )
{
const oid_x520_attr_t *data = oid_x520_attr_from_asn1( oid );