Permalink
Browse files

- changed license to LGPL

- moved ASN.1 function definitions from sc.h to sc-asn1.h


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@36 c6295689-39f2-0310-b995-f0e70906c6a9
  • Loading branch information...
1 parent 27cc0a0 commit 18bab373b8cddc4ec80d5e6ee67d6dc8e2affe3e jey committed Nov 6, 2001
View
679 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,19 +1,21 @@
-/* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
- * All rights reserved.
+/*
+ * sc-asn1.c: ASN.1 decoding functions (DER)
*
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
+ *
+ * This library 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.
+ *
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sc.h"
View
@@ -1,11 +1,46 @@
-
-/* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
- * All rights reserved.
+/*
+ * sc-asn1.h: ASN.1 header file
+ *
+ * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
+ *
+ * This library 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.
+ *
+ * This library 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _SC_ASN1_H
#define _SC_ASN1_H
+/* DER tag and length parsing */
+const u8 *sc_asn1_find_tag(const u8 * buf, int buflen, int tag, int *taglen);
+const u8 *sc_asn1_verify_tag(const u8 * buf, int buflen, int tag, int *taglen);
+const u8 *sc_asn1_skip_tag(const u8 ** buf, int *buflen, int tag, int *taglen);
+
+/* ASN.1 printing functions */
+void sc_asn1_print_tags(const u8 * buf, int buflen);
+
+/* ASN.1 object decoding functions */
+int sc_asn1_utf8string_to_ascii(const u8 * buf, int buflen,
+ u8 * outbuf, int outlen);
+int sc_asn1_decode_bit_string(const u8 * inbuf, int inlen,
+ void *outbuf, int outlen);
+/* non-inverting version */
+int sc_asn1_decode_bit_string_ni(const u8 * inbuf, int inlen,
+ void *outbuf, int outlen);
+int sc_asn1_decode_integer(const u8 * inbuf, int inlen, int *out);
+int sc_asn1_decode_object_id(const u8 * inbuf, int inlen,
+ struct sc_object_id *id);
+
#define ASN1_TAG_CLASS 0xC0
#define ASN1_TAG_UNIVERSAL 0x00
#define ASN1_TAG_APPLICATION 0x40
@@ -16,7 +51,7 @@
#define ASN1_TAG_PRIMITIVE 0x1F
#define ASN1_EOC 0
-#define ASN1_BOOLEAN 1 /**/
+#define ASN1_BOOLEAN 1
#define ASN1_INTEGER 2
#define ASN1_NEG_INTEGER (2 | ASN1_NEG)
#define ASN1_BIT_STRING 3
@@ -31,18 +66,19 @@
#define ASN1_UTF8STRING 12
#define ASN1_SEQUENCE 16
#define ASN1_SET 17
-#define ASN1_NUMERICSTRING 18 /**/
+#define ASN1_NUMERICSTRING 18
#define ASN1_PRINTABLESTRING 19
#define ASN1_T61STRING 20
-#define ASN1_TELETEXSTRING 20 /* alias */
-#define ASN1_VIDEOTEXSTRING 21 /**/
+#define ASN1_TELETEXSTRING 20
+#define ASN1_VIDEOTEXSTRING 21
#define ASN1_IA5STRING 22
#define ASN1_UTCTIME 23
-#define ASN1_GENERALIZEDTIME 24 /**/
-#define ASN1_GRAPHICSTRING 25 /**/
-#define ASN1_ISO64STRING 26 /**/
-#define ASN1_VISIBLESTRING 26 /* alias */
-#define ASN1_GENERALSTRING 27 /**/
-#define ASN1_UNIVERSALSTRING 28 /**/
+#define ASN1_GENERALIZEDTIME 24
+#define ASN1_GRAPHICSTRING 25
+#define ASN1_ISO64STRING 26
+#define ASN1_VISIBLESTRING 26
+#define ASN1_GENERALSTRING 27
+#define ASN1_UNIVERSALSTRING 28
#define ASN1_BMPSTRING 30
+
#endif
View
@@ -1,19 +1,21 @@
-/* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
- * All rights reserved.
+/*
+ * sc-base64.c: Base64 converting functions
*
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
+ *
+ * This library 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.
+ *
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sc.h"
@@ -1,19 +1,21 @@
-/* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
- * All rights reserved.
+/*
+ * sc-pkcs15.h: PKCS#15 header file
*
- * 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; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
*
- * This program is distributed in the hope that it will be useful,
+ * This library 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.
+ *
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _SC_PKCS15_H
View
@@ -1,19 +1,21 @@
-/* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
- * All rights reserved.
+/*
+ * sc.h: SmartCard library header file
*
- * 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; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
*
- * This program is distributed in the hope that it will be useful,
+ * This library 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.
+ *
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _SC_H
@@ -131,28 +133,6 @@ struct sc_security_env {
int key_ref;
};
-/* ASN.1 functions */
-
-/* DER tag and length parsing */
-const u8 *sc_asn1_find_tag(const u8 * buf, int buflen, int tag, int *taglen);
-const u8 *sc_asn1_verify_tag(const u8 * buf, int buflen, int tag, int *taglen);
-const u8 *sc_asn1_skip_tag(const u8 ** buf, int *buflen, int tag, int *taglen);
-
-/* ASN.1 printing functions */
-void sc_asn1_print_tags(const u8 * buf, int buflen);
-
-/* ASN.1 object decoding functions */
-int sc_asn1_utf8string_to_ascii(const u8 * buf,
- int buflen, u8 * outbuf, int outlen);
-int sc_asn1_decode_bit_string(const u8 * inbuf,
- int inlen, void *outbuf, int outlen);
-/* non-inverting version */
-int sc_asn1_decode_bit_string_ni(const u8 * inbuf,
- int inlen, void *outbuf, int outlen);
-int sc_asn1_decode_integer(const u8 * inbuf, int inlen, int *out);
-int sc_asn1_decode_object_id(const u8 * inbuf, int inlen,
- struct sc_object_id *id);
-
/* Base64 encoding/decoding functions */
int sc_base64_encode(const u8 *in, int inlen, u8 *out, int outlen,
int linelength);
@@ -180,7 +160,7 @@ int sc_select_file(struct sc_card *card, struct sc_file *file,
int sc_read_binary(struct sc_card *card, int idx, u8 * buf, int count);
int sc_get_random(struct sc_card *card, u8 * rndout, int len);
-/* ISO 7816-9 (?) related functions */
+/* ISO 7816-8 related functions */
int sc_restore_security_env(struct sc_card *card, int se_num);
int sc_set_security_env(struct sc_card *card,
const struct sc_security_env *env);
@@ -1,23 +1,26 @@
-/* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
- * All rights reserved.
+/*
+ * sc-pkcs15-cert.c: PKCS#15 certificate functions
*
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
+ *
+ * This library 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.
+ *
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sc.h"
#include "sc-pkcs15.h"
+#include "sc-asn1.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
View
@@ -1,23 +1,26 @@
-/* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
- * All rights reserved.
+/*
+ * sc-pkcs15-pin.c: PKCS#15 PIN functions
*
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
+ *
+ * This library 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.
+ *
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sc.h"
#include "sc-pkcs15.h"
+#include "sc-asn1.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -1,23 +1,26 @@
-/* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
- * All rights reserved.
+/*
+ * sc-pkcs15-prkey.c: PKCS#15 private key functions
*
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
+ *
+ * This library 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.
+ *
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sc.h"
#include "sc-pkcs15.h"
+#include "sc-asn1.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
Oops, something went wrong.

0 comments on commit 18bab37

Please sign in to comment.