[-]
[+]
|
Changed |
_service:tar_git:ell.spec
|
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ChangeLog
^
|
@@ -1,3 +1,13 @@
+ver 0.65:
+ Add support for bitmaps manipulation macros.
+
+ver 0.64:
+ Fix issue with casting in C++ environment.
+ Fix issue with ASCII string upper and lower helpers.
+
+ver 0.63:
+ Fix issue with handling ending boundary of the PEM.
+
ver 0.62:
Add support for cleanup functions and macros.
Add support for setting DHCP max attempts.
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/configure.ac
^
|
@@ -1,5 +1,5 @@
AC_PREREQ([2.69])
-AC_INIT([ell],[0.62])
+AC_INIT([ell],[0.65])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_AUX_DIR(build-aux)
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/cert.c
^
|
@@ -1658,7 +1658,6 @@
{
const uint8_t *seq;
size_t seq_len;
- const uint8_t *elem_data;
size_t elem_len;
uint8_t tag;
@@ -1674,8 +1673,7 @@
* to add any more formats we'll probably need to start guessing
* from the filename suffix.
*/
- if (!(elem_data = asn1_der_find_elem(seq, seq_len,
- 0, &tag, &elem_len)))
+ if (!asn1_der_find_elem(seq, seq_len,0, &tag, &elem_len))
return -ENOMSG;
if (tag == ASN1_ID_SEQUENCE) {
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/dbus.c
^
|
@@ -1689,8 +1689,7 @@
va_start(args, member);
rule_len = 0;
- while ((type = va_arg(args, enum l_dbus_match_type)) !=
- L_DBUS_MATCH_NONE)
+ while (va_arg(args, enum l_dbus_match_type) != L_DBUS_MATCH_NONE)
rule_len++;
va_end(args);
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/ecc.c
^
|
@@ -806,6 +806,14 @@
return NULL;
}
+LIB_EXPORT struct l_ecc_scalar *l_ecc_scalar_clone(const struct l_ecc_scalar *s)
+{
+ if (!s)
+ return NULL;
+
+ return l_memdup(s, sizeof(*s));
+}
+
/*
* Build a scalar = value modulo p where p is the prime number for a given
* curve. bytes can contain a number with up to 2x number of digits as the
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/ecc.h
^
|
@@ -62,6 +62,7 @@
struct l_ecc_scalar *l_ecc_scalar_new(const struct l_ecc_curve *curve,
const void *buf, size_t len);
+struct l_ecc_scalar *l_ecc_scalar_clone(const struct l_ecc_scalar *s);
struct l_ecc_scalar *l_ecc_scalar_new_random(
const struct l_ecc_curve *curve);
struct l_ecc_scalar *l_ecc_scalar_new_modp(const struct l_ecc_curve *curve,
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/ecdh.c
^
|
@@ -16,6 +16,7 @@
#include "ecc.h"
#include "ecdh.h"
#include "random.h"
+#include "useful.h"
/*
* Some sane maximum for calculating the public key.
@@ -41,6 +42,9 @@
int iter = 0;
uint64_t p2[L_ECC_MAX_DIGITS];
+ if (unlikely(!curve || !out_private || !out_public))
+ return false;
+
_ecc_calculate_p2(curve, p2);
*out_public = l_ecc_point_new(curve);
@@ -77,6 +81,9 @@
struct l_ecc_scalar *z;
struct l_ecc_point *product;
+ if (unlikely(!private_key || !other_public || !secret))
+ return false;
+
z = l_ecc_scalar_new_random(curve);
product = l_ecc_point_new(curve);
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/ell.sym
^
|
@@ -611,6 +611,7 @@
l_ecc_scalar_legendre;
l_ecc_scalar_multiply;
l_ecc_scalar_new;
+ l_ecc_scalar_clone;
l_ecc_scalar_new_random;
l_ecc_scalar_new_modp;
l_ecc_scalar_new_modn;
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/gvariant-util.c
^
|
@@ -843,7 +843,6 @@
offset_size = offset_length(builder->body_pos,
container->offset_index);
- i = container->offset_index - 1;
start = grow_body(builder, offset_size * container->offset_index, 1);
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/log.h
^
|
@@ -17,6 +17,7 @@
#define L_LOG_ERR 3
#define L_LOG_WARNING 4
+#define L_LOG_NOTICE 5
#define L_LOG_INFO 6
#define L_LOG_DEBUG 7
@@ -84,6 +85,7 @@
#define l_error(format, ...) l_log(L_LOG_ERR, format, ##__VA_ARGS__)
#define l_warn(format, ...) l_log(L_LOG_WARNING, format, ##__VA_ARGS__)
+#define l_notice(format, ...) l_log(L_LOG_NOTICE, format, ##__VA_ARGS__)
#define l_info(format, ...) l_log(L_LOG_INFO, format, ##__VA_ARGS__)
#define l_debug(format, ...) L_DEBUG_SYMBOL(__debug_desc, format, ##__VA_ARGS__)
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/pem.c
^
|
@@ -148,7 +148,7 @@
*base64_len = buf_ptr - base64_data;
if (endp) {
- if (eol == buf + buf_len)
+ if (eol == buf_ptr + buf_len)
*endp = eol;
else
*endp = eol + 1;
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/queue.c
^
|
@@ -511,8 +511,6 @@
if (!entry->next)
queue->tail = prev;
- entry = entry->next;
-
data = tmp->data;
l_free(tmp);
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/queue.h
^
|
@@ -18,7 +18,7 @@
typedef void (*l_queue_destroy_func_t) (void *data);
typedef int (*l_queue_compare_func_t) (const void *a, const void *b,
void *user_data);
-typedef bool (*l_queue_match_func_t) (const void *a, const void *b);
+typedef bool (*l_queue_match_func_t) (const void *data, const void *user_data);
typedef bool (*l_queue_remove_func_t) (void *data, void *user_data);
struct l_queue;
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/utf8.c
^
|
@@ -63,11 +63,11 @@
if (len < 0)
slen = strlen(str);
else
- slen = minsize(strlen(str), (size_t) len);
+ slen = len;
ret = l_malloc(slen + 1);
- for (i = 0; i < slen; i++)
+ for (i = 0; i < slen && str[i]; i++)
ret[i] = l_ascii_tolower(str[i]);
ret[i] = '\0';
@@ -95,11 +95,11 @@
if (len < 0)
slen = strlen(str);
else
- slen = minsize(strlen(str), (size_t) len);
+ slen = len;
ret = l_malloc(slen + 1);
- for (i = 0; i < slen; i++)
+ for (i = 0; i < slen && str[i]; i++)
ret[i] = l_ascii_toupper(str[i]);
ret[i] = '\0';
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/ell/util.h
^
|
@@ -43,6 +43,27 @@
r; \
})
+/*
+ * If ELL headers and iterfaces end up getting compiled in a C++
+ * environment, even though ELL itself is a C source based and is
+ * compiled as such, certain assignments may be flagged by the C++
+ * compiler as errors or warnings. The following portable casts should
+ * be used in such cases, with a preference towards L_PERMISSIVE_CAST
+ * where possible since it is not a cast in C and, therefore, will not
+ * mask otherwise-legitimate warnings in that environment.
+ */
+#ifdef __cplusplus
+#define L_CONST_CAST(t, v) const_cast<t>(v)
+#define L_REINTERPRET_CAST(t, v) reinterpret_cast<t>(v)
+#define L_STATIC_CAST(t, v) static_cast<t>(v)
+#define L_PERMISSIVE_CAST(t, v) L_STATIC_CAST(t, v)
+#else
+#define L_CONST_CAST(t, v) ((t)(v))
+#define L_REINTERPRET_CAST(t, v) ((t)(v))
+#define L_STATIC_CAST(t, v) ((t)(v))
+#define L_PERMISSIVE_CAST(t, v) (v)
+#endif
+
#define L_PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
#define L_UINT_TO_PTR(u) ((void *) ((uintptr_t) (u)))
@@ -328,8 +349,8 @@
#define _L_IN_SET_CMP(val, type, cmp, ...) __extension__ ({ \
const type __v = (val); \
const typeof(__v) __elems[] = {__VA_ARGS__}; \
- unsigned int __i; \
- static const unsigned int __n = L_ARRAY_SIZE(__elems); \
+ size_t __i; \
+ const size_t __n = L_ARRAY_SIZE(__elems); \
bool __r = false; \
for (__i = 0; __i < __n && !__r; __i++) \
__r = (cmp); \
@@ -345,6 +366,50 @@
(__v && __elems[__i] && \
!strcmp(__v, __elems[__i])), ##__VA_ARGS__)
+#define _L_BIT_TO_MASK(bits, nr) __extension__ ({ \
+ typeof(*(bits)) _one = 1U; \
+ const unsigned int _shift = (nr) % (sizeof(_one) * 8); \
+ _one << _shift; \
+})
+
+#define _L_BIT_TO_OFFSET(bits, nr) __extension__ ({ \
+ __auto_type _bits = (bits); \
+ const size_t _offset = (nr) / (sizeof(*_bits) * 8); \
+ _bits + _offset; \
+})
+
+#define L_BIT_SET(bits, nr) __extension__ ({ \
+ size_t _nr = (nr); \
+ __auto_type _offset = _L_BIT_TO_OFFSET(bits, _nr); \
+ *_offset |= _L_BIT_TO_MASK(_offset, _nr); \
+})
+
+#define L_BIT_CLEAR(bits, nr) __extension__ ({ \
+ size_t _nr = (nr); \
+ __auto_type _offset = _L_BIT_TO_OFFSET(bits, _nr); \
+ *_offset &= ~_L_BIT_TO_MASK(_offset, _nr); \
+})
+
+#define L_BIT_TEST(bits, nr) __extension__ ({ \
+ size_t _nr = (nr); \
+ __auto_type _offset = _L_BIT_TO_OFFSET(bits, _nr); \
+ (*_offset & _L_BIT_TO_MASK(_offset, _nr)) != 0; \
+})
+
+#define L_BITS_SET(bits, ...) __extension__ ({ \
+ const unsigned int __elems[] = {__VA_ARGS__}; \
+ size_t __i; \
+ for (__i = 0; __i < L_ARRAY_SIZE(__elems); __i++) \
+ L_BIT_SET(bits, __elems[__i]); \
+})
+
+#define L_BITS_CLEAR(bits, ...) __extension__ ({ \
+ const unsigned int __elems[] = {__VA_ARGS__}; \
+ size_t __i; \
+ for (__i = 0; __i < L_ARRAY_SIZE(__elems); __i++) \
+ L_BIT_CLEAR(bits, __elems[__i]); \
+})
+
/*
* Taken from https://github.com/chmike/cst_time_memcmp, adding a volatile to
* ensure the compiler does not try to optimize the constant time behavior.
@@ -381,8 +446,10 @@
static inline int l_secure_memcmp(const void *a, const void *b,
size_t size)
{
- const volatile uint8_t *aa = a;
- const volatile uint8_t *bb = b;
+ const volatile uint8_t *aa =
+ L_PERMISSIVE_CAST(const volatile uint8_t *, a);
+ const volatile uint8_t *bb =
+ L_PERMISSIVE_CAST(const volatile uint8_t *, b);
int res = 0, diff, mask;
/*
@@ -433,9 +500,9 @@
const void *left, const void *right,
void *out, size_t len)
{
- const uint8_t *l = left;
- const uint8_t *r = right;
- uint8_t *o = out;
+ const uint8_t *l = L_PERMISSIVE_CAST(const uint8_t *, left);
+ const uint8_t *r = L_PERMISSIVE_CAST(const uint8_t *, right);
+ uint8_t *o = L_PERMISSIVE_CAST(uint8_t *, out);
uint8_t mask = -(!!select_left);
size_t i;
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/unit/test-gvariant-util.c
^
|
@@ -644,6 +644,7 @@
assert(ret);
ret = _gvariant_iter_enter_struct(&variant, &structure);
+ assert(ret);
ret = _gvariant_iter_next_entry_basic(&structure, 's', &s);
assert(ret);
@@ -1047,6 +1048,7 @@
ret = _gvariant_iter_init(&iter, NULL, "a(yv)", NULL,
test->data + 16, u);
+ assert(ret);
ret = _gvariant_iter_enter_array(&iter, &array);
assert(ret);
@@ -1308,6 +1310,7 @@
assert(ret);
ret = _gvariant_builder_append_basic(builder, 't', &t);
+ assert(ret);
ret = _gvariant_builder_leave_struct(builder);
assert(ret);
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/unit/test-uintset.c
^
|
@@ -411,7 +411,7 @@
assert(!l_uintset_contains(sub, 64));
l_uintset_free(sub);
- l_uintset_take(set_b, 64);
+ assert(l_uintset_take(set_b, 64));
/* (64) - (65, 63) = (64) */
sub = l_uintset_subtract(set_a, set_b);
@@ -424,6 +424,9 @@
assert(!l_uintset_contains(sub, 64));
assert(l_uintset_contains(sub, 63));
l_uintset_free(sub);
+
+ l_uintset_free(set_b);
+ l_uintset_free(set_a);
}
int main(int argc, char *argv[])
|
[-]
[+]
|
Changed |
_service:tar_git:ell-0.65+git1.tar.bz2/upstream/unit/test-util.c
^
|
@@ -195,6 +195,81 @@
assert(l_safe_atox8("0xffff", &c) == -ERANGE);
}
+static void test_set_bit(const void *test_data)
+{
+ uint32_t bitmap[2] = { };
+ int one = 0;
+
+ L_BIT_SET(&bitmap[0], 0);
+ L_BIT_SET(bitmap, 1);
+ L_BIT_SET(bitmap, 2);
+ L_BIT_SET(bitmap, 3);
+
+ assert(bitmap[0] == 0x0f);
+ assert(bitmap[1] == 0);
+
+ L_BIT_SET(bitmap, 63);
+ L_BIT_SET(bitmap, 62);
+ L_BIT_SET(bitmap, 61);
+ L_BIT_SET(bitmap, 60);
+
+ assert(bitmap[0] == 0x0fU);
+ assert(bitmap[1] == 0xf0000000U);
+
+ L_BIT_SET(&one, 0);
+ assert(one == 1);
+}
+
+static void test_clear_bit(const void *test_data)
+{
+ uint32_t bitmap[2] = { 0xfU, 0xf0000000U };
+
+ L_BIT_CLEAR(&bitmap[0], 3);
+ L_BIT_CLEAR(bitmap, 63);
+
+ assert(bitmap[0] == 0x07U);
+ assert(bitmap[1] == 0x70000000U);
+}
+
+static void test_is_bit_set(const void *test_data)
+{
+ uint32_t bitmap[2] = { 0xfU, 0xf0000000U };
+ uint8_t one = 1;
+
+ assert(L_BIT_TEST(&bitmap[0], 0) == true);
+ assert(L_BIT_TEST(bitmap, 1) == true);
+ assert(L_BIT_TEST(bitmap, 2) == true);
+ assert(L_BIT_TEST(bitmap, 3) == true);
+ assert(L_BIT_TEST(bitmap, 4) == false);
+
+ assert(L_BIT_TEST(bitmap, 63) == true);
+ assert(L_BIT_TEST(bitmap, 55) == false);
+
+ assert(L_BIT_TEST(&one, 0) == true);
+ assert(L_BIT_TEST(&one, 1) == false);
+}
+
+static void test_set_bits(const void *test_data)
+{
+ uint16_t bitmap[4] = {};
+
+ L_BITS_SET(bitmap, 0, 1, 16, 32, 48);
+
+ assert(bitmap[0] == 0x3);
+ assert(bitmap[1] == 0x1);
+ assert(bitmap[2] == 0x1);
+ assert(bitmap[3] == 0x1);
+}
+
+static void test_clear_bits(const void *test_data)
+{
+ uint16_t bitmap[4] = { 0x3, 0x1, 0x1, 0x1 };
+
+ L_BITS_CLEAR(bitmap, 0, 1, 16, 32, 48);
+
+ assert(l_memeqzero(bitmap, sizeof(bitmap)));
+}
+
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
@@ -212,5 +287,11 @@
l_test_add("l_safe_atoux", test_safe_atoux, NULL);
+ l_test_add("L_BIT_SET", test_set_bit, NULL);
+ l_test_add("L_BIT_CLEAR", test_clear_bit, NULL);
+ l_test_add("L_BIT_TEST", test_is_bit_set, NULL);
+ l_test_add("L_BITS_SET", test_set_bits, NULL);
+ l_test_add("L_BITS_CLEAR", test_clear_bits, NULL);
+
return l_test_run();
}
|