[PATCH libcacard 15/45] cac: Expose real key size in PKI Applet properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jakub Jelen <jjelen@xxxxxxxxxx>
Reviewed-by: Robert Relyea <rrelyea@xxxxxxxxxx>
---
 src/cac.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/cac.c b/src/cac.c
index 4b54e91..c7b5006 100644
--- a/src/cac.c
+++ b/src/cac.c
@@ -627,6 +627,7 @@ cac_new_pki_applet_private(int i, const unsigned char *cert,
 {
     CACPKIAppletData *pki_applet_data;
     VCardAppletPrivate *applet_private;
+    int bits;
 
     /* PKI applet Properies ex.:
      * 01  Tag: Applet Information
@@ -743,8 +744,10 @@ cac_new_pki_applet_private(int i, const unsigned char *cert,
     pki_object[1].value.value = buffer_properties;
 
     /* PKI properties needs adjustments based on the key sizes */
-    // TODO XXX assuming 1024 b keys!
-    // pki_properties[1] = key_bits >> 3;
+    bits = vcard_emul_rsa_bits(key);
+    g_debug("RSA bits = %d", bits);
+    if (bits > 0)
+        pki_properties[1] = 0xff & (bits / 8 / 8);
     pki_object[2].value.value = pki_properties;
 
     /* Inject Applet Version */
-- 
2.17.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]