]> git.sommitrealweird.co.uk Git - onak.git/blobdiff - decodekey.c
Add ctags/cscope files to .gitignore + clean rule
[onak.git] / decodekey.c
index 7dd79927533d855bfbfb68ba6e309e0fb545d078..b4f7ceb46781d45f376385c4cea0ac42affffb63 100644 (file)
@@ -2,6 +2,19 @@
  * decodekey.c - Routines to further decode an OpenPGP key.
  *
  * Copyright 2002-2008 Jonathan McDowell <noodles@earth.li>
  * decodekey.c - Routines to further decode an OpenPGP key.
  *
  * Copyright 2002-2008 Jonathan McDowell <noodles@earth.li>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include <stdbool.h>
  */
 
 #include <stdbool.h>
@@ -69,16 +82,10 @@ int parse_subpackets(unsigned char *data, uint64_t *keyid, time_t *creation)
                                *creation = data[offset + packetlen - 1];
                        }
                        break;
                                *creation = data[offset + packetlen - 1];
                        }
                        break;
-               case OPENPGP_SIGSUB_EXPIRY:
                        /*
                         * Signature expiration time. Might want to output this?
                         */
                        break;
                        /*
                         * Signature expiration time. Might want to output this?
                         */
                        break;
-               case OPENPGP_SIGSUB_REGEX:
-                       /*
-                        * Regular expression for UIDs this sig is over.
-                        */
-                       break;
                case OPENPGP_SIGSUB_ISSUER:
                        if (keyid != NULL) {
                                *keyid = data[offset+packetlen - 8];
                case OPENPGP_SIGSUB_ISSUER:
                        if (keyid != NULL) {
                                *keyid = data[offset+packetlen - 8];
@@ -98,25 +105,23 @@ int parse_subpackets(unsigned char *data, uint64_t *keyid, time_t *creation)
                                *keyid += data[offset+packetlen - 1];
                        }
                        break;
                                *keyid += data[offset+packetlen - 1];
                        }
                        break;
+               case OPENPGP_SIGSUB_EXPIRY:
+               case OPENPGP_SIGSUB_EXPORTABLE:
+               case OPENPGP_SIGSUB_TRUSTSIG:
+               case OPENPGP_SIGSUB_REGEX:
+               case OPENPGP_SIGSUB_KEYEXPIRY:
+               case OPENPGP_SIGSUB_PREFSYM:
                case OPENPGP_SIGSUB_NOTATION:
                case OPENPGP_SIGSUB_NOTATION:
-                       /*
-                        * Annotation data.
-                        */
-                       break;
-
+               case OPENPGP_SIGSUB_PREFHASH:
+               case OPENPGP_SIGSUB_PREFCOMPRESS:
                case OPENPGP_SIGSUB_KEYSERVER:
                case OPENPGP_SIGSUB_KEYSERVER:
-                       /*
-                        * Key server preferences. Including no-modify.
-                        */
-                       break;
                case OPENPGP_SIGSUB_PRIMARYUID:
                case OPENPGP_SIGSUB_PRIMARYUID:
-                       /*
-                        * Primary UID.
-                        */
-                       break;
                case OPENPGP_SIGSUB_POLICYURI:
                case OPENPGP_SIGSUB_POLICYURI:
+               case OPENPGP_SIGSUB_KEYFLAGS:
                        /*
                        /*
-                        * Policy URI.
+                        * Various subpacket types we know about, but don't
+                        * currently handle. Some are candidates for being
+                        * supported if we add signature checking support.
                         */
                        break;
                default:
                         */
                        break;
                default:
@@ -310,13 +315,13 @@ uint64_t *keysubkeys(struct openpgp_publickey *key)
        struct openpgp_signedpacket_list *cursubkey = NULL;
        uint64_t                         *subkeys = NULL;
        int                               count = 0;
        struct openpgp_signedpacket_list *cursubkey = NULL;
        uint64_t                         *subkeys = NULL;
        int                               count = 0;
-        
+
        if (key != NULL && key->subkeys != NULL) {
                subkeys = malloc((spsize(key->subkeys) + 1) *
                                sizeof (uint64_t));
                cursubkey = key->subkeys;
                while (cursubkey != NULL) {
        if (key != NULL && key->subkeys != NULL) {
                subkeys = malloc((spsize(key->subkeys) + 1) *
                                sizeof (uint64_t));
                cursubkey = key->subkeys;
                while (cursubkey != NULL) {
-                       subkeys[count++] = get_packetid(cursubkey->packet);
+                       get_packetid(cursubkey->packet, &subkeys[count++]);
                        cursubkey = cursubkey -> next;
                }
                subkeys[count] = 0;
                        cursubkey = cursubkey -> next;
                }
                subkeys[count] = 0;