SE driver lookup functions

Expose the type of an entry in the SE driver table as an opaque type
to other library modules. Soon, driver table entries will have state,
and callers will need to be able to access this state through
functions using this opaque type.

Provide functions to look up a driver by its lifetime and to retrieve
the method table from an entry.
diff --git a/library/psa_crypto_se.c b/library/psa_crypto_se.c
index 688d4e7..70e3a16 100644
--- a/library/psa_crypto_se.c
+++ b/library/psa_crypto_se.c
@@ -32,13 +32,53 @@
 
 #include "psa_crypto_se.h"
 
-typedef struct
+/****************************************************************/
+/* Driver lookup */
+/****************************************************************/
+
+typedef struct psa_se_drv_table_entry_s
 {
     psa_key_lifetime_t lifetime;
     const psa_drv_se_t *methods;
-} method_table_entry_t;
+} psa_se_drv_table_entry_t;
 
-static method_table_entry_t driver_table[PSA_MAX_SE_DRIVERS];
+static psa_se_drv_table_entry_t driver_table[PSA_MAX_SE_DRIVERS];
+
+const psa_se_drv_table_entry_t *psa_get_se_driver_entry(
+    psa_key_lifetime_t lifetime )
+{
+    size_t i;
+    if( lifetime == 0 )
+        return( NULL );
+    for( i = 0; i < PSA_MAX_SE_DRIVERS; i++ )
+    {
+        if( driver_table[i].lifetime == lifetime )
+            return( &driver_table[i] );
+    }
+    return( NULL );
+}
+
+const psa_drv_se_t *psa_get_se_driver_methods(
+    const psa_se_drv_table_entry_t *drv )
+{
+    return( drv->methods );
+}
+
+const psa_drv_se_t *psa_get_se_driver( psa_key_lifetime_t lifetime )
+{
+    const psa_se_drv_table_entry_t *drv = psa_get_se_driver_entry( lifetime );
+    if( drv == NULL )
+        return( NULL );
+    else
+        return( drv->methods );
+}
+
+
+
+
+/****************************************************************/
+/* Driver registration */
+/****************************************************************/
 
 psa_status_t psa_register_se_driver(
     psa_key_lifetime_t lifetime,
@@ -83,4 +123,10 @@
     memset( driver_table, 0, sizeof( driver_table ) );
 }
 
+
+
+/****************************************************************/
+/* The end */
+/****************************************************************/
+
 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */