diff --git a/AUTHORS b/AUTHORS index d8cdd8f..9a3c148 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,90 +1,106 @@ Program: GPA -Maintainer: None, check the mailing list gpa-dev@gnupg.org. -Bug reports: +Maintainer: Werner Koch +Bug reports: http://bugs.gnupg.org Security related bug reports: License: GPLv3+ Authors ======= (Please put the names also into the file src/help.c) Markus Gerwinski Designed GPA and GPAPA, implemented GPA. Peter Gerwinski Implemented GPAPA; did changes everywhere in GPA. Peter Neuhaus German translation. Werner Koch Glued everything together, fixes here and there, W32 porting, about dialog, card manager. Jan-Oliver Wagner Polishing (toolbar, icons integration), some fixing. Beate Esser Icon design. Bernhard Herzog Revamped the whole src/ code. Shell Hung Chinese translation (Big5) Peter Hanecak Wrote gpa.spec Michael Fischer v. Mollard See ChangeLog. Michael Mauch See ChangeLogs. Benedikt Wildenhain Helped to debug GPA and to make it compile under CygWin. Miguel Coca Merged version 0.4.3 with 0.5.0, ported to GPGME. Renato Martini Brazilian translation. Yasunari Imado Japanese translation. Michael Anckaert Dutch translation. Mick Ohrberg Swedish Translation. Andy Ruddock See ChangeLogs. Ling Li See ChangeLogs. Josué Burgos Designed the gpa.png icon. Can Berk Güder Turkish translation. Emilian Nowak Polish translation. - + Daniel Nylander Swedish translation. - + Zdenek Hatas - Czech translation. + Czech translation. Maxim Britov Russian translation. Marcus Brinkmann Clipboard code, cleanups, bug fixes. + + +Copyright and Redistribution +============================ + +The copyright for GPA is hold by the authors. Check the above list +and each source file for the details. The file src/helpmenu.c is used +to show the names of the author and of the major copyright holders. + +GPA is distributed under the GNU General Public License, version 3 or +later. + +To allow easy reuse of certain parts of the code, some files are under +a different license, for example the GNU Lesser General Public +License. These licenses are compatible with the GPLv3 which covers +the entire work. diff --git a/src/filetype.c b/src/filetype.c index 87c2523..c59dde7 100644 --- a/src/filetype.c +++ b/src/filetype.c @@ -1,152 +1,150 @@ /* filetype.c - Identify file types * Copyright (C) 2012 g10 Code GmbH * - * This file is part of GPA + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GPA 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; either version 3 of the License, or - * (at your option) any later version. + * This file 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 Lesser General Public License for more details. * - * GPA 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 + * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, see . */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "parsetlv.h" #include "filetype.h" /* The size of the buffer we use to identify CMS objects. */ #define CMS_BUFFER_SIZE 2048 /* Warning: DATA may be binary but there must be a Nul before DATALEN. */ static int detect_cms (const char *data, size_t datalen) { tlvinfo_t ti; const char *s; size_t n; if (datalen < 24) /* Object is probably too short for CMS. */ return 0; s = data; n = datalen; if (parse_tlv (&s, &n, &ti)) goto try_pgp; /* Not properly BER encoded. */ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE && ti.is_cons)) goto try_pgp; /* A CMS object always starts witn a sequence. */ if (parse_tlv (&s, &n, &ti)) goto try_pgp; /* Not properly BER encoded. */ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_OBJECT_ID && !ti.is_cons && ti.length) || ti.length > n) goto try_pgp; /* This is not an OID as expected. */ if (ti.length == 9) { if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x03", 9)) return 1; /* Encrypted (aka Enveloped Data). */ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02", 9)) return 1; /* Signed. */ } try_pgp: /* Check whether this might be a non-armored PGP message. We need to do this before checking for armor lines, so that we don't get fooled by armored messages inside a signed binary PGP message. */ if ((data[0] & 0x80)) { /* That might be a binary PGP message. At least it is not plain ASCII. Of course this might be certain lead-in text of armored CMS messages. However, I am not sure whether this is at all defined and in any case it is uncommon. Thus we don't do any further plausibility checks but stupidly assume no CMS armored data will follow. */ return 0; } /* Now check whether there are armor lines. */ for (s = data; s && *s; s = (*s=='\n')?(s+1):((s=strchr (s,'\n'))?(s+1):s)) { if (!strncmp (s, "-----BEGIN ", 11)) { if (!strncmp (s+11, "PGP ", 4)) return 0; /* This is PGP */ return 1; /* Not PGP, thus we assume CMS. */ } } return 0; } /* Return true if the file FNAME looks like an CMS file. There is no error return, just a best effort try to identify CMS in a file with a CMS object. */ int is_cms_file (const char *fname) { int result; FILE *fp; char *data; size_t datalen; fp = fopen (fname, "rb"); if (!fp) return 0; /* Not found - can't be a CMS file. */ data = malloc (CMS_BUFFER_SIZE); if (!data) { fclose (fp); return 0; /* Oops */ } datalen = fread (data, 1, CMS_BUFFER_SIZE - 1, fp); data[datalen] = 0; fclose (fp); result = detect_cms (data, datalen); free (data); return result; } /* Return true if the data (DATA,DATALEN) looks like an CMS object. There is no error return, just a best effort try to identify CMS. */ int is_cms_data (const char *data, size_t datalen) { int result; char *buffer; if (datalen < 24) return 0; /* Too short - don't bother to copy the buffer. */ if (datalen > CMS_BUFFER_SIZE - 1) datalen = CMS_BUFFER_SIZE - 1; buffer = malloc (datalen + 1); if (!buffer) return 0; /* Oops */ memcpy (buffer, data, datalen); buffer[datalen] = 0; result = detect_cms (buffer, datalen); free (buffer); return result; } diff --git a/src/filetype.h b/src/filetype.h index da554ae..6c88c68 100644 --- a/src/filetype.h +++ b/src/filetype.h @@ -1,27 +1,25 @@ /* filetype.h - Identify file types * Copyright (C) 2012 g10 Code GmbH * - * This file is part of GPA + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GPA 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; either version 3 of the License, or - * (at your option) any later version. + * This file 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 Lesser General Public License for more details. * - * GPA 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 + * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, see . */ #ifndef FILETYPE_H #define FILETYPE_H int is_cms_file (const char *fname); int is_cms_data (const char *data, size_t datalen); #endif /*FILETYPE_H*/ diff --git a/src/parsetlv.c b/src/parsetlv.c index d673f02..afdc522 100644 --- a/src/parsetlv.c +++ b/src/parsetlv.c @@ -1,105 +1,103 @@ /* parsetlv.c - ASN.1 TLV functions * Copyright (C) 2005, 2007, 2008, 2012 g10 Code GmbH * - * This file is part of GPA + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GPA 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; either version 3 of the License, or - * (at your option) any later version. + * This file 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 Lesser General Public License for more details. * - * GPA 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 + * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, see . */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "parsetlv.h" /* Simple but pretty complete ASN.1 BER parser. Parse the data at the address of BUFFER with a length given at the address of SIZE. On success return 0 and update BUFFER and SIZE to point to the value. Do not update them on error. The information about the object are stored in the caller allocated TI structure. */ int parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti) { int c; unsigned long tag; const unsigned char *buf = (const unsigned char *)(*buffer); size_t length = *size; ti->cls = 0; ti->tag = 0; ti->is_cons = 0; ti->is_ndef = 0; ti->length = 0; ti->nhdr = 0; if (!length) return -1; c = *buf++; length--; ++ti->nhdr; ti->cls = (c & 0xc0) >> 6; ti->is_cons = !!(c & 0x20); tag = c & 0x1f; if (tag == 0x1f) { tag = 0; do { tag <<= 7; if (!length) return -1; c = *buf++; length--; ++ti->nhdr; tag |= c & 0x7f; } while (c & 0x80); } ti->tag = tag; if (!length) return -1; c = *buf++; length--; ++ti->nhdr; if ( !(c & 0x80) ) ti->length = c; else if (c == 0x80) ti->is_ndef = 1; else if (c == 0xff) return -1; else { unsigned long len = 0; int count = (c & 0x7f); if (count > sizeof (len) || count > sizeof (size_t)) return -1; for (; count; count--) { len <<= 8; if (!length) return -1; c = *buf++; length--; ++ti->nhdr; len |= c & 0xff; } ti->length = len; } *buffer = buf; *size = length; return 0; } diff --git a/src/parsetlv.h b/src/parsetlv.h index 9840b24..d61a1c3 100644 --- a/src/parsetlv.h +++ b/src/parsetlv.h @@ -1,48 +1,46 @@ /* parsetlv.h - TLV functions defintions * Copyright (C) 2012 g10 Code GmbH * - * This file is part of GPA + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GPA 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; either version 3 of the License, or - * (at your option) any later version. + * This file 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 Lesser General Public License for more details. * - * GPA 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 + * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, see . */ #ifndef PARSETLV_H #define PARSETLV_H /* ASN.1 constants. */ #define ASN1_CLASS_UNIVERSAL 0 #define ASN1_CLASS_APPLICATION 1 #define ASN1_CLASS_CONTEXT 2 #define ASN1_CLASS_PRIVATE 3 #define ASN1_TAG_OBJECT_ID 6 #define ASN1_TAG_SEQUENCE 16 /* Object used with parse_tlv. */ struct tlvinfo_s { int cls; /* The class of the tag. */ int tag; /* The tag. */ int is_cons; /* True if it is a constructed object. */ int is_ndef; /* True if the object has an indefinite length. */ size_t length; /* The length of the value. */ size_t nhdr; /* The number of octets in the header (tag,length). */ }; typedef struct tlvinfo_s tlvinfo_t; /*-- parsetlv.c --*/ int parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti); #endif /*PARSETLV_H*/