shishi-commit
[Top][All Lists]
Advanced

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

CVS shishi/lib


From: shishi-commit
Subject: CVS shishi/lib
Date: Fri, 10 Sep 2004 11:19:58 +0200

Update of /home/cvs/shishi/lib
In directory dopio:/tmp/cvs-serv19831

Modified Files:
        shishi.h.in encapreppart.c 
Log Message:
(shishi_encapreppart_get_key): Return Shishi_key instead of raw key data.


--- /home/cvs/shishi/lib/shishi.h.in    2004/09/10 09:04:16     1.235
+++ /home/cvs/shishi/lib/shishi.h.in    2004/09/10 09:19:57     1.236
@@ -82,7 +82,8 @@
   SHISHI_VERIFY_FAILED = 47,
   SHISHI_PRIV_BAD_KEYTYPE = 48,
   SHISHI_FILE_ERROR = 49,
-  SHISHI_LAST_ERROR = 49
+  SHISHI_ENCAPREPPART_BAD_KEYTYPE = 50,
+  SHISHI_LAST_ERROR = 50
 }
 Shishi_rc;
 
@@ -1859,9 +1860,7 @@
                                          int filetype, const char *filename);
 extern int shishi_encapreppart_get_key (Shishi * handle,
                                        Shishi_asn1 encapreppart,
-                                       int32_t * keytype,
-                                       char *keyvalue,
-                                       size_t * keyvalue_len);
+                                       Shishi_key ** key);
 extern int shishi_encapreppart_seqnumber_get (Shishi * handle,
                                              Shishi_asn1 encapreppart,
                                              uint32_t * seqnumber);
--- /home/cvs/shishi/lib/encapreppart.c 2004/04/18 13:36:59     1.35
+++ /home/cvs/shishi/lib/encapreppart.c 2004/09/10 09:19:57     1.36
@@ -262,10 +262,7 @@
  * shishi_encapreppart_get_key:
  * @handle: shishi handle as allocated by shishi_init().
  * @encapreppart: input EncAPRepPart variable.
- * @keytype: output variable that holds key type.
- * @keyvalue: output array with key.
- * @keyvalue_len: on input, maximum size of output array with key,
- *                on output, holds the actual size of output array with key.
+ * @key: newly allocated key.
  *
  * Extract the subkey from the encrypted AP-REP part.
  *
@@ -274,19 +271,28 @@
 int
 shishi_encapreppart_get_key (Shishi * handle,
                             Shishi_asn1 encapreppart,
-                            int32_t * keytype,
-                            char *keyvalue, size_t * keyvalue_len)
+                            Shishi_key ** key)
 {
   int res;
+  char *buf;
+  size_t buflen;
+  int32_t keytype;
 
-  *keytype = 0;
   res = shishi_asn1_read_int32 (handle, encapreppart,
-                               "subkey.keytype", keytype);
+                               "subkey.keytype", &keytype);
   if (res != SHISHI_OK)
     return res;
 
-  res = shishi_asn1_read (handle, encapreppart,
-                         "subkey.keyvalue", keyvalue, keyvalue_len);
+  res = shishi_asn1_read2 (handle, encapreppart, "subkey.keyvalue",
+                          &buf, &buflen);
+  if (res != SHISHI_OK)
+    return res;
+
+  if (shishi_cipher_keylen (keytype) != buflen)
+    return SHISHI_ENCAPREPPART_BAD_KEYTYPE;
+
+  res = shishi_key_from_value (handle, keytype, buf, key);
+  free (buf);
   if (res != SHISHI_OK)
     return res;
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]