Hello community,

here is the log from the commit of package libasn1c for openSUSE:Factory 
checked in at 2017-05-06 18:31:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libasn1c (Old)
 and      /work/SRC/openSUSE:Factory/.libasn1c.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libasn1c"

Sat May  6 18:31:09 2017 rev:2 rq:493113 version:0.9.28.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/libasn1c/libasn1c.changes        2016-02-01 
19:55:46.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libasn1c.new/libasn1c.changes   2017-05-06 
18:31:12.810002572 +0200
@@ -1,0 +2,9 @@
+Sat Apr 29 00:14:29 UTC 2017 - [email protected]
+
+- Update to new upstream snapshot 0.9.28.9
+  * aper fix for decoding constrained integer with lower boundary
+  * fix APER encoding of integer
+  * remove config.h include from asn_system.h
+  * Add helper functions for uint32_t in octet strings
+
+-------------------------------------------------------------------

Old:
----
  libasn1c-0.9.28~21.tar.xz

New:
----
  _service
  libasn1c-0.9.28.9.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libasn1c.spec ++++++
--- /var/tmp/diff_new_pack.caZ7U0/_old  2017-05-06 18:31:13.861854150 +0200
+++ /var/tmp/diff_new_pack.caZ7U0/_new  2017-05-06 18:31:13.865853586 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libasn1c
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,20 +16,15 @@
 #
 
 
-%define soname 0
 Name:           libasn1c
-Version:        0.9.28~21
+Version:        0.9.28.9
 Release:        0
 Summary:        Osmocon ASN.1 decoder and encoder library
 License:        AGPL-3.0+ and BSD-2-Clause
 Group:          Development/Libraries/C and C++
 Url:            http://openbsc.osmocom.org/trac/
 
-#Git-Clone:    git://git.osmocom.org/libasn1c
-#Snapshot:     2d4f2bd91ce5724c9f1c3916dfa5b21c8f6e7fbc
 Source:         %name-%version.tar.xz
-BuildRequires:  autoconf
-BuildRequires:  automake
 BuildRequires:  libtool >= 2
 BuildRequires:  pkg-config
 BuildRequires:  xz
@@ -46,9 +41,9 @@
 
 %package -n libasn1c0
 Summary:        Osmocon ASN.1 decoder and encoder library
-Group:          System/Libraries
 # src/asn1helpers.c causes AGPL
 License:        AGPL-3.0+
+Group:          System/Libraries
 
 %description -n libasn1c0
 Lev Walkins's asn1c runtime, as a shared library and with
@@ -60,9 +55,9 @@
 
 %package -n libasn1c-devel
 Summary:        Development files for libasn1c, Osmocom's ASN.1 decoder and 
encoder library
+License:        AGPL-3.0+
 Group:          Development/Libraries/C and C++
 Requires:       libasn1c0 = %version
-License:        AGPL-3.0+
 
 %description -n libasn1c-devel
 Compiles ASN.1 data structures into C source structures that can be
@@ -73,10 +68,10 @@
 applications that want to make use of libasn1c.
 
 %prep
-%setup -qn %name
+%setup -q
 
 %build
-autoreconf -fiv
+autoreconf -fi
 %configure --disable-static
 make %{?_smp_mflags}
 

++++++ _service ++++++
<services>
        <service name="tar_scm" mode="disabled">
                <param name="scm">git</param>
                <param name="url">git://git.osmocom.org/libasn1c</param>
                <param name="revision">master</param>
                <param 
name="parent-tag">41b85d5597119fa8105dc0641ffe5cd1bbae39b2</param>
                <param name="versionformat">0.9.28.@TAG_OFFSET@</param>
        </service>
        <service name="recompress" mode="disabled">
                <param name="file">*.tar</param>
                <param name="compression">xz</param>
        </service>
        <service name="set_version" mode="disabled"/>
</services>
++++++ libasn1c-0.9.28~21.tar.xz -> libasn1c-0.9.28.9.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/.gitignore new/libasn1c-0.9.28.9/.gitignore
--- old/libasn1c/.gitignore     2015-12-23 19:29:42.134175354 +0100
+++ new/libasn1c-0.9.28.9/.gitignore    1970-01-01 01:00:00.000000000 +0100
@@ -1,22 +0,0 @@
-Makefile.in
-Makefile
-*/Makefile.in
-*/Makefile
-*/*/Makefile.in
-*/*/Makefile
-autom4te.cache
-aclocal.m4
-config.*
-configure
-depcomp
-libtool
-ltmain.sh
-install-sh
-m4
-missing
-libasn1c.pc
-*.o
-*.lo
-*.la
-.deps
-.libs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/configure.ac 
new/libasn1c-0.9.28.9/configure.ac
--- old/libasn1c/configure.ac   2015-12-23 19:29:42.134175354 +0100
+++ new/libasn1c-0.9.28.9/configure.ac  2016-05-01 01:05:34.000000000 +0200
@@ -15,7 +15,7 @@
 
 AC_CONFIG_MACRO_DIR([m4])
 
-PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.1.13)
+PKG_CHECK_MODULES(LIBTALLOC, talloc)
 
 # The following test is taken from WebKit's webkit.m4
 saved_CFLAGS="$CFLAGS"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/include/asn1c/asn1helpers.h 
new/libasn1c-0.9.28.9/include/asn1c/asn1helpers.h
--- old/libasn1c/include/asn1c/asn1helpers.h    2016-01-22 18:31:43.324334033 
+0100
+++ new/libasn1c-0.9.28.9/include/asn1c/asn1helpers.h   2016-05-01 
01:05:34.000000000 +0200
@@ -10,9 +10,11 @@
 void asn1_u28_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in);
 void asn1_u24_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in);
 int BIT_STRING_fromBuf(BIT_STRING_t *st, const uint8_t *str, unsigned int 
bit_len);
+void asn1_u32_to_str(OCTET_STRING_t *str, uint32_t *buf, uint32_t in);
 void asn1_u16_to_str(OCTET_STRING_t *str, uint16_t *buf, uint16_t in);
 void asn1_u8_to_str(OCTET_STRING_t *str, uint8_t *buf, uint8_t in);
 int asn1_strncpy(char *out, const OCTET_STRING_t *in, size_t n);
+uint32_t asn1str_to_u32(const OCTET_STRING_t *in);
 uint16_t asn1str_to_u16(const OCTET_STRING_t *in);
 uint8_t asn1str_to_u8(const OCTET_STRING_t *in);
 uint32_t asn1bitstr_to_u32(const BIT_STRING_t *in);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/include/asn1c/asn_internal.h 
new/libasn1c-0.9.28.9/include/asn1c/asn_internal.h
--- old/libasn1c/include/asn1c/asn_internal.h   2015-12-23 19:29:42.138175254 
+0100
+++ new/libasn1c-0.9.28.9/include/asn1c/asn_internal.h  2016-05-01 
01:05:34.000000000 +0200
@@ -15,7 +15,7 @@
 #include <assert.h>            /* for assert() macro */
 #endif
 
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 
 #ifdef __cplusplus
 extern "C" {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/include/asn1c/asn_system.h 
new/libasn1c-0.9.28.9/include/asn1c/asn_system.h
--- old/libasn1c/include/asn1c/asn_system.h     2015-12-23 19:29:42.138175254 
+0100
+++ new/libasn1c-0.9.28.9/include/asn1c/asn_system.h    2016-05-01 
01:05:34.000000000 +0200
@@ -9,10 +9,6 @@
 #ifndef        _ASN_SYSTEM_H_
 #define        _ASN_SYSTEM_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>     /* For snprintf(3) */
 #include <stdlib.h>    /* For *alloc(3) */
 #include <string.h>    /* For memcpy(3) */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/libasn1c.pc.in 
new/libasn1c-0.9.28.9/libasn1c.pc.in
--- old/libasn1c/libasn1c.pc.in 2015-12-23 19:29:42.138175254 +0100
+++ new/libasn1c-0.9.28.9/libasn1c.pc.in        2016-05-01 01:05:34.000000000 
+0200
@@ -6,6 +6,6 @@
 Name: asn1c runtime library
 Description: C Utility Library
 Version: @VERSION@
-Libs: -L${libdir} -lasn1c -lm
-Cflags: -I${includedir}/ -I${includedir}/asn1c
+Libs: -L${libdir} @LIBTALLOC_LIBS@ -lasn1c -lm
+Cflags: -I${includedir}/ -I${includedir}/asn1c @LIBTALLOC_CFLAGS@
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/src/INTEGER.c 
new/libasn1c-0.9.28.9/src/INTEGER.c
--- old/libasn1c/src/INTEGER.c  2015-12-23 19:29:42.138175254 +0100
+++ new/libasn1c-0.9.28.9/src/INTEGER.c 2016-05-01 01:05:34.000000000 +0200
@@ -716,34 +716,43 @@
                ASN_DEBUG("Integer with range %d bits", ct->range_bits);
                if(ct->range_bits >= 0) {
                        if (ct->range_bits > 16) {
-                               int max_range_bytes = (ct->range_bits >> 3) + 1;
-                               int length, i;
+                               int max_range_bytes = (ct->range_bits >> 3) +
+                                       (((ct->range_bits % 8) > 0) ? 1 : 0);
+                               int length = 0, i;
                                int64_t value = 0;
 
-                               for (i = 0; i < max_range_bytes; i++) {
-                                       int upper = 1 << (i + 1);
-                                       if (upper > max_range_bytes)
+                               for (i = 1; ; i++) {
+                                       int upper = 1 << i;
+                                       if (upper >= max_range_bytes)
                                                break;
                                }
-                               if ((length = per_get_few_bits(pd, i + 1)) < 0)
-                                       _ASN_DECODE_STARVED;
+                               ASN_DEBUG("Can encode %d (%d bytes) in %d 
bits", ct->range_bits,
+                                               max_range_bytes, i);
+
+                               if ((length = per_get_few_bits(pd, i)) < 0)
+                                       _ASN_DECODE_FAILED;
+
+                               /* X.691 #12.2.6 length determinant + lb (1) */
+                               length += 1;
+                               ASN_DEBUG("Got length %d", length);
+
                                if (aper_get_align(pd) != 0)
                                        _ASN_DECODE_STARVED;
-                               ASN_DEBUG("Got length %d", length + 1);
-                               for (i = 0; i < length + 1; i++) {
+
+                               while (length--) {
                                        int buf = per_get_few_bits(pd, 8);
                                        if (buf < 0)
                                                _ASN_DECODE_STARVED;
-                                       value += (((int64_t)buf) << (8 * i));
+                                       value += (((int64_t)buf) << (8 * 
length));
                                }
 
+                               value += ct->lower_bound;
                                if((specs && specs->field_unsigned)
                                        ? asn_uint642INTEGER(st, value)
                                        : asn_int642INTEGER(st, value))
                                        _ASN_DECODE_FAILED;
                                ASN_DEBUG("Got value %lld + low %lld",
                                                  value, ct->lower_bound);
-                               value += ct->lower_bound;
                        } else {
                                long value = 0;
                                if (ct->range_bits < 8) {
@@ -761,13 +770,13 @@
                                        value = per_get_few_bits(pd, 16);
                                        if(value < 0) _ASN_DECODE_STARVED;
                                }
+                               value += ct->lower_bound;
                                if((specs && specs->field_unsigned)
                                        ? asn_ulong2INTEGER(st, value)
                                        : asn_long2INTEGER(st, value))
                                        _ASN_DECODE_FAILED;
                                        ASN_DEBUG("Got value %ld + low %lld",
                                                          value, 
ct->lower_bound);
-                               value += ct->lower_bound;
                        }
                        return rval;
                } else {
@@ -995,18 +1004,35 @@
                } else {
                        /* TODO: extend to >64 bits */
                        int64_t v64 = v;
-                       int i;
+                       int i, j;
+                       int max_range_bytes = (ct->range_bits >> 3) +
+                                       (((ct->range_bits % 8) > 0) ? 1 : 0);
+
+                       for (i = 1; ; i++) {
+                               int upper = 1 << i;
+                               if (upper >= max_range_bytes)
+                                       break;
+                       }
 
-                       /* Putting length - 1 in the minimum number of bits ex: 
5 = 3bits */
-                       if (per_put_few_bits(po, st->size - 1, (ct->range_bits 
>> 3)-1))
+                       for (j = sizeof(int64_t) -1; j != 0; j--) {
+                               uint8_t val;
+                               val = v64 >> (j * 8);
+                               if (val != 0)
+                                       break;
+                       }
+
+                       /* Putting length in the minimum number of bits ex: 5 = 
3bits */
+                       if (per_put_few_bits(po, j, i))
                                _ASN_ENCODE_FAILED;
 
                        // Consume the bits to align on octet
                        if (aper_put_align(po) < 0)
                                _ASN_ENCODE_FAILED;
+
                        /* Put the value */
-                       for (i = 0; i < st->size; i++) {
-                               if(per_put_few_bits(po, (v64 >> (8 * (st->size 
- i - 1))) & 0xff, 8)) _ASN_ENCODE_FAILED;
+                       for (i = 0; i <= j; i++) {
+                               if(per_put_few_bits(po, (v64 >> (8 * (j - i))) 
& 0xff, 8))
+                                       _ASN_ENCODE_FAILED;
                        }
                }
                _ASN_ENCODED_OK(er);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/src/Makefile.am 
new/libasn1c-0.9.28.9/src/Makefile.am
--- old/libasn1c/src/Makefile.am        2016-01-22 18:31:43.328333933 +0100
+++ new/libasn1c-0.9.28.9/src/Makefile.am       2016-05-01 01:05:34.000000000 
+0200
@@ -4,13 +4,13 @@
 LIBVERSION=1:0:0
 
 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include/asn1c
-AM_CFLAGS = -fPIC -Wall $(LIBOSMOCORE_CFLAGS)
+AM_CFLAGS = -fPIC -Wall $(LIBTALLOC_CFLAGS)
 if BUILD_DEBUG
 AM_CFLAGS += -DEMIT_ASN_DEBUG=1
 endif
 
 lib_LTLIBRARIES = libasn1c.la
 
-libasn1c_la_LDFLAGS = $(LIBOSMOCORE_LIBS)
+libasn1c_la_LDFLAGS = $(LIBTALLOC_LIBS)
 libasn1c_la_SOURCES = ANY.c              constraints.c         
GeneralizedTime.c   NumericString.c      T61String.c asn_codecs_prim.c  
constr_CHOICE.c       GeneralString.c     ObjectDescriptor.c   TeletexString.c 
asn_SEQUENCE_OF.c  constr_SEQUENCE.c     GraphicString.c     
OBJECT_IDENTIFIER.c  UniversalString.c asn_SET_OF.c       constr_SEQUENCE_OF.c  
IA5String.c         OCTET_STRING.c       UTCTime.c ber_decoder.c      
constr_SET.c          INTEGER.c           per_decoder.c        UTF8String.c 
ber_tlv_length.c   constr_SET_OF.c       ISO646String.c      per_encoder.c      
  VideotexString.c ber_tlv_tag.c      constr_TYPE.c         NativeEnumerated.c  
per_support.c        VisibleString.c BIT_STRING.c       NativeInteger.c     
PrintableString.c    xer_decoder.c BMPString.c        der_encoder.c         
NativeReal.c        REAL.c               xer_encoder.c BOOLEAN.c          
ENUMERATED.c          NULL.c              RELATIVE-OID.c       xer_support.c    
per_opentype.c        asn1helpers.c
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libasn1c/src/asn1helpers.c 
new/libasn1c-0.9.28.9/src/asn1helpers.c
--- old/libasn1c/src/asn1helpers.c      2016-01-22 18:31:43.328333933 +0100
+++ new/libasn1c-0.9.28.9/src/asn1helpers.c     2016-05-01 01:05:34.000000000 
+0200
@@ -22,11 +22,15 @@
 #include <errno.h>
 #include <arpa/inet.h>
 
-#include <osmocom/core/utils.h>
-
 #include "asn1helpers.h"
 #include "asn_internal.h"
 
+#define ASN1C_ASSERT(exp)    \
+        if (!(exp)) { \
+                fprintf(stderr, "Assert failed %s %s:%d\n", #exp, __FILE__, 
__LINE__); \
+                abort(); \
+        }
+
 void asn1_u32_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in)
 {
        *buf = htonl(in);
@@ -73,7 +77,7 @@
        }
 
        if (len < 0)
-               len = strlen(str);
+               len = strlen((char*)str);
 
        buf = MALLOC(len);
        if (!buf) {
@@ -90,6 +94,13 @@
        return 0;
 }
 
+void asn1_u32_to_str(OCTET_STRING_t *str, uint32_t *buf, uint32_t in)
+{
+       *buf = htonl(in);
+       str->buf = (uint8_t *) buf;
+       str->size = sizeof(uint32_t);
+}
+
 void asn1_u16_to_str(OCTET_STRING_t *str, uint16_t *buf, uint16_t in)
 {
        *buf = htons(in);
@@ -117,35 +128,41 @@
        return cpylen;
 }
 
+uint32_t asn1str_to_u32(const OCTET_STRING_t *in)
+{
+       ASN1C_ASSERT(in && in->size == sizeof(uint32_t));
+       return ntohl(*(uint32_t *)in->buf);
+}
+
 uint16_t asn1str_to_u16(const OCTET_STRING_t *in)
 {
-       OSMO_ASSERT(in && in->size == sizeof(uint16_t));
+       ASN1C_ASSERT(in && in->size == sizeof(uint16_t));
        return ntohs(*(uint16_t *)in->buf);
 }
 
 uint8_t asn1str_to_u8(const OCTET_STRING_t *in)
 {
-       OSMO_ASSERT(in && in->size == sizeof(uint8_t));
+       ASN1C_ASSERT(in && in->size == sizeof(uint8_t));
        return *(uint8_t *)in->buf;
 }
 
 uint32_t asn1bitstr_to_u32(const BIT_STRING_t *in)
 {
-       OSMO_ASSERT(in && in->size == sizeof(uint32_t));
+       ASN1C_ASSERT(in && in->size == sizeof(uint32_t));
 
        return ntohl(*(uint32_t *)in->buf);
 }
 
 uint32_t asn1bitstr_to_u28(const BIT_STRING_t *in)
 {
-       OSMO_ASSERT(in && in->size == sizeof(uint32_t) && in->bits_unused == 4);
+       ASN1C_ASSERT(in && in->size == sizeof(uint32_t) && in->bits_unused == 
4);
 
        return ntohl(*(uint32_t *)in->buf) >> 4;
 }
 
 uint32_t asn1bitstr_to_u24(const BIT_STRING_t *in)
 {
-       OSMO_ASSERT(in && in->size == 3);
+       ASN1C_ASSERT(in && in->size == 3);
 
        return ntohl(*(uint32_t *)in->buf) >> 8;
 }


Reply via email to