commit aws-c-common for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package aws-c-common for openSUSE:Factory checked in at 2024-08-09 16:14:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/aws-c-common (Old) and /work/SRC/openSUSE:Factory/.aws-c-common.new.7232 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "aws-c-common" Fri Aug 9 16:14:44 2024 rev:11 rq:1192575 version:0.9.25 Changes: -------- --- /work/SRC/openSUSE:Factory/aws-c-common/aws-c-common.changes 2024-07-31 13:31:26.221084295 +0200 +++ /work/SRC/openSUSE:Factory/.aws-c-common.new.7232/aws-c-common.changes 2024-08-09 16:15:13.272327043 +0200 @@ -1,0 +2,12 @@ +Wed Aug 7 13:29:24 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com> + +- Update to version 0.9.25 + * Run proofs with CBMC 6.1.0 by @graebm in (#1140) + * Avoiding allocating a handle in the Windows RNG + by @teo-tsirpanis in (#1046) + * Add no copy api variants to json interface + by @DmitriyMusatkin in (#1138) + * Allocate error space for aws-crt-swift + by @xiazhvera in (#1129) + +------------------------------------------------------------------- Old: ---- v0.9.24.tar.gz New: ---- v0.9.25.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ aws-c-common.spec ++++++ --- /var/tmp/diff_new_pack.2igJmy/_old 2024-08-09 16:15:14.380373293 +0200 +++ /var/tmp/diff_new_pack.2igJmy/_new 2024-08-09 16:15:14.384373460 +0200 @@ -19,7 +19,7 @@ %define library_version 1.0.0 %define library_soversion 1 Name: aws-c-common -Version: 0.9.24 +Version: 0.9.25 Release: 0 Summary: Core C99 package for AWS SDK for C License: Apache-2.0 ++++++ v0.9.24.tar.gz -> v0.9.25.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.24/.github/workflows/proof_ci_resources/config.yaml new/aws-c-common-0.9.25/.github/workflows/proof_ci_resources/config.yaml --- old/aws-c-common-0.9.24/.github/workflows/proof_ci_resources/config.yaml 2024-07-24 19:17:15.000000000 +0200 +++ new/aws-c-common-0.9.25/.github/workflows/proof_ci_resources/config.yaml 2024-08-01 20:44:38.000000000 +0200 @@ -1,7 +1,7 @@ # Use exact versions (instead of "latest") so we're not broken by surprise upgrades. cadical-tag: "rel-2.0.0" # tag of latest release: https://github.com/arminbiere/cadical/releases -cbmc-version: "6.0.0" # semver of latest release: https://github.com/diffblue/cbmc/releases -cbmc-viewer-version: "3.8" # semver of latest release: https://github.com/model-checking/cbmc-viewer/releases +cbmc-version: "6.1.0" # semver of latest release: https://github.com/diffblue/cbmc/releases +cbmc-viewer-version: "3.9" # semver of latest release: https://github.com/model-checking/cbmc-viewer/releases kissat-tag: "rel-3.1.1" # tag of latest release: https://github.com/arminbiere/kissat/releases litani-version: "1.29.0" # semver of latest release: https://github.com/awslabs/aws-build-accumulator/releases proofs-dir: verification/cbmc/proofs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.24/README.md new/aws-c-common-0.9.25/README.md --- old/aws-c-common-0.9.24/README.md 2024-07-24 19:17:15.000000000 +0200 +++ new/aws-c-common-0.9.25/README.md 2024-08-01 20:44:38.000000000 +0200 @@ -122,7 +122,8 @@ | [0x3800, 0x3C00) | aws-c-s3 | | [0x3C00, 0x4000) | aws-c-sdkutils | | [0x4000, 0x4400) | aws-crt-kotlin | -| [0x4400, 0x4800) | (reserved for future project) | +| [0x4400, 0x4800) | aws-crt-swift | +| [0x4800, 0x4C00) | (reserved for future project) | Each library should begin its error and log subject values at the beginning of its range and follow in sequence (don't skip codes). Upon adding an AWS maintained library, a new enum range must be approved and added to the above table. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.24/include/aws/common/json.h new/aws-c-common-0.9.25/include/aws/common/json.h --- old/aws-c-common-0.9.24/include/aws/common/json.h 2024-07-24 19:17:15.000000000 +0200 +++ new/aws-c-common-0.9.25/include/aws/common/json.h 2024-08-01 20:44:38.000000000 +0200 @@ -23,7 +23,8 @@ * * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or * on the object/array containing the aws_json_value. - * @param string A byte pointer to the string you want to store in the aws_json_value + * Note: might be slower than c_str version due to internal copy + * @param string A byte cursor you want to store in the aws_json_value * @param allocator The allocator to use when creating the value * @return A new string aws_json_value */ @@ -31,6 +32,18 @@ struct aws_json_value *aws_json_value_new_string(struct aws_allocator *allocator, struct aws_byte_cursor string); /** + * Creates a new string aws_json_value with the given string and returns a pointer to it. + * + * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or + * on the object/array containing the aws_json_value. + * @param string c string pointer you want to store in the aws_json_value + * @param allocator The allocator to use when creating the value + * @return A new string aws_json_value + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_new_string_from_c_str(struct aws_allocator *allocator, const char *string); + +/** * Creates a new number aws_json_value with the given number and returns a pointer to it. * * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or @@ -129,6 +142,7 @@ * * Note that the aws_json_value will be destroyed when the aws_json_value object is destroyed * by calling "aws_json_destroy()" + * Note: might be slower than c_str version due to internal copy * @param object The object aws_json_value you want to add a value to. * @param key The key to add the aws_json_value at. * @param value The aws_json_value you want to add. @@ -143,7 +157,23 @@ struct aws_json_value *value); /** + * Adds a aws_json_value to a object aws_json_value. + * + * Note that the aws_json_value will be destroyed when the aws_json_value object is destroyed + * by calling "aws_json_destroy()" + * @param object The object aws_json_value you want to add a value to. + * @param key The key to add the aws_json_value at. + * @param value The aws_json_value you want to add. + * @return AWS_OP_SUCCESS if adding was successful. + * Will return AWS_OP_ERROR if the object passed is invalid or if the passed key + * is already in use in the object. + */ +AWS_COMMON_API +int aws_json_value_add_to_object_c_str(struct aws_json_value *object, const char *key, struct aws_json_value *value); + +/** * Returns the aws_json_value at the given key. + * Note: might be slower than c_str version due to internal copy * @param object The object aws_json_value you want to get the value from. * @param key The key that the aws_json_value is at. Is case sensitive. * @return The aws_json_value at the given key, otherwise NULL. @@ -152,7 +182,19 @@ struct aws_json_value *aws_json_value_get_from_object(const struct aws_json_value *object, struct aws_byte_cursor key); /** + * Returns the aws_json_value at the given key. + * Note: same as aws_json_value_get_from_object but with key as const char *. + * Prefer this method is you have a key thats already a valid char * as it is likely to be faster. + * @param object The object aws_json_value you want to get the value from. + * @param key The key that the aws_json_value is at. Is case sensitive. + * @return The aws_json_value at the given key, otherwise NULL. + */ +AWS_COMMON_API +struct aws_json_value *aws_json_value_get_from_object_c_str(const struct aws_json_value *object, const char *key); + +/** * Checks if there is a aws_json_value at the given key. + * Note: might be slower than c_str version due to internal copy * @param object The value aws_json_value you want to check a key in. * @param key The key that you want to check. Is case sensitive. * @return True if a aws_json_value is found. @@ -161,7 +203,19 @@ bool aws_json_value_has_key(const struct aws_json_value *object, struct aws_byte_cursor key); /** + * Checks if there is a aws_json_value at the given key. + * Note: same as aws_json_value_has_key but with key as const char *. + * Prefer this method is you have a key thats already a valid char * as it is likely to be faster. + * @param object The value aws_json_value you want to check a key in. + * @param key The key that you want to check. Is case sensitive. + * @return True if a aws_json_value is found. + */ +AWS_COMMON_API +bool aws_json_value_has_key_c_str(const struct aws_json_value *object, const char *key); + +/** * Removes the aws_json_value at the given key. + * Note: might be slower than c_str version due to internal copy * @param object The object aws_json_value you want to remove a aws_json_value in. * @param key The key that the aws_json_value is at. Is case sensitive. * @return AWS_OP_SUCCESS if the aws_json_value was removed. @@ -172,6 +226,19 @@ int aws_json_value_remove_from_object(struct aws_json_value *object, struct aws_byte_cursor key); /** + * Removes the aws_json_value at the given key. + * Note: same as aws_json_value_remove_from_object but with key as const char *. + * Prefer this method is you have a key thats already a valid char * as it is likely to be faster. + * @param object The object aws_json_value you want to remove a aws_json_value in. + * @param key The key that the aws_json_value is at. Is case sensitive. + * @return AWS_OP_SUCCESS if the aws_json_value was removed. + * Will return AWS_OP_ERR if the object passed is invalid or if the value + * at the key cannot be found. + */ +AWS_COMMON_API +int aws_json_value_remove_from_object_c_str(struct aws_json_value *object, const char *key); + +/** * @brief callback for iterating members of an object * Iteration can be controlled as follows: * - return AWS_OP_SUCCESS and out_should_continue is set to true (default value) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.24/source/json.c new/aws-c-common-0.9.25/source/json.c --- old/aws-c-common-0.9.24/source/json.c 2024-07-24 19:17:15.000000000 +0200 +++ new/aws-c-common-0.9.25/source/json.c 2024-08-01 20:44:38.000000000 +0200 @@ -21,6 +21,12 @@ return ret_val; } +struct aws_json_value *aws_json_value_new_string_from_c_str(struct aws_allocator *allocator, const char *string) { + (void)allocator; /* No need for allocator. It is overriden through hooks. */ + void *ret_val = cJSON_CreateString(string); + return ret_val; +} + struct aws_json_value *aws_json_value_new_number(struct aws_allocator *allocator, double number) { (void)allocator; // prevent warnings over unused parameter return (void *)cJSON_CreateNumber(number); @@ -78,92 +84,95 @@ struct aws_byte_cursor key, struct aws_json_value *value) { - int result = AWS_OP_ERR; struct aws_string *tmp = aws_string_new_from_cursor(s_aws_json_module_allocator, &key); + int result = aws_json_value_add_to_object_c_str(object, aws_string_c_str(tmp), value); + + aws_string_destroy_secure(tmp); + return result; +} + +int aws_json_value_add_to_object_c_str(struct aws_json_value *object, const char *key, struct aws_json_value *value) { struct cJSON *cjson = (struct cJSON *)object; if (!cJSON_IsObject(cjson)) { - aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); - goto done; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } struct cJSON *cjson_value = (struct cJSON *)value; if (cJSON_IsInvalid(cjson_value)) { - result = aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); - goto done; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } - if (cJSON_HasObjectItem(cjson, aws_string_c_str(tmp))) { - goto done; + if (cJSON_HasObjectItem(cjson, key)) { + return AWS_OP_ERR; } - cJSON_AddItemToObject(cjson, aws_string_c_str(tmp), cjson_value); - result = AWS_OP_SUCCESS; - -done: - aws_string_destroy_secure(tmp); - return result; + cJSON_AddItemToObject(cjson, key, cjson_value); + return AWS_OP_SUCCESS; } struct aws_json_value *aws_json_value_get_from_object(const struct aws_json_value *object, struct aws_byte_cursor key) { - void *return_value = NULL; struct aws_string *tmp = aws_string_new_from_cursor(s_aws_json_module_allocator, &key); + void *return_value = aws_json_value_get_from_object_c_str(object, aws_string_c_str(tmp)); + + aws_string_destroy_secure(tmp); + return return_value; +} +struct aws_json_value *aws_json_value_get_from_object_c_str(const struct aws_json_value *object, const char *key) { const struct cJSON *cjson = (const struct cJSON *)object; if (!cJSON_IsObject(cjson)) { aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); - goto done; + return NULL; } - if (!cJSON_HasObjectItem(cjson, aws_string_c_str(tmp))) { - goto done; + if (!cJSON_HasObjectItem(cjson, key)) { + return NULL; } - return_value = (void *)cJSON_GetObjectItem(cjson, aws_string_c_str(tmp)); - -done: - aws_string_destroy_secure(tmp); - return return_value; + return (void *)cJSON_GetObjectItem(cjson, key); } bool aws_json_value_has_key(const struct aws_json_value *object, struct aws_byte_cursor key) { struct aws_string *tmp = aws_string_new_from_cursor(s_aws_json_module_allocator, &key); - bool result = false; + bool result = aws_json_value_has_key_c_str(object, aws_string_c_str(tmp)); + + aws_string_destroy_secure(tmp); + return result; +} +bool aws_json_value_has_key_c_str(const struct aws_json_value *object, const char *key) { const struct cJSON *cjson = (const struct cJSON *)object; if (!cJSON_IsObject(cjson)) { - goto done; + return false; } - if (!cJSON_HasObjectItem(cjson, aws_string_c_str(tmp))) { - goto done; + if (!cJSON_HasObjectItem(cjson, key)) { + return false; } - result = true; -done: - aws_string_destroy_secure(tmp); - return result; + return true; } int aws_json_value_remove_from_object(struct aws_json_value *object, struct aws_byte_cursor key) { - int result = AWS_OP_ERR; struct aws_string *tmp = aws_string_new_from_cursor(s_aws_json_module_allocator, &key); + int result = aws_json_value_remove_from_object_c_str(object, aws_string_c_str(tmp)); + aws_string_destroy_secure(tmp); + return result; +} + +int aws_json_value_remove_from_object_c_str(struct aws_json_value *object, const char *key) { struct cJSON *cjson = (struct cJSON *)object; if (!cJSON_IsObject(cjson)) { - aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); - goto done; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } - if (!cJSON_HasObjectItem(cjson, aws_string_c_str(tmp))) { - goto done; + if (!cJSON_HasObjectItem(cjson, key)) { + return AWS_OP_ERR; } - cJSON_DeleteItemFromObject(cjson, aws_string_c_str(tmp)); - result = AWS_OP_SUCCESS; - -done: - aws_string_destroy_secure(tmp); - return result; + cJSON_DeleteItemFromObject(cjson, key); + return AWS_OP_SUCCESS; } int aws_json_const_iterate_object( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.24/source/windows/device_random.c new/aws-c-common-0.9.25/source/windows/device_random.c --- old/aws-c-common-0.9.24/source/windows/device_random.c 2024-07-24 19:17:15.000000000 +0200 +++ new/aws-c-common-0.9.25/source/windows/device_random.c 2024-08-01 20:44:38.000000000 +0200 @@ -5,26 +5,11 @@ #include <aws/common/device_random.h> #include <aws/common/byte_buf.h> -#include <aws/common/thread.h> #include <windows.h> #include <bcrypt.h> -static BCRYPT_ALG_HANDLE s_alg_handle = NULL; -static aws_thread_once s_rand_init = AWS_THREAD_ONCE_STATIC_INIT; - -static void s_init_rand(void *user_data) { - (void)user_data; - NTSTATUS status = 0; - - status = BCryptOpenAlgorithmProvider(&s_alg_handle, BCRYPT_RNG_ALGORITHM, NULL, 0); - - if (!BCRYPT_SUCCESS(status)) { - abort(); - } -} - int aws_device_random_buffer(struct aws_byte_buf *output) { return aws_device_random_buffer_append(output, output->capacity - output->len); } @@ -32,8 +17,6 @@ int aws_device_random_buffer_append(struct aws_byte_buf *output, size_t n) { AWS_PRECONDITION(aws_byte_buf_is_valid(output)); - aws_thread_call_once(&s_rand_init, s_init_rand, NULL); - size_t space_available = output->capacity - output->len; if (space_available < n) { AWS_POSTCONDITION(aws_byte_buf_is_valid(output)); @@ -47,7 +30,8 @@ while (n > 0) { uint32_t capped_n = (uint32_t)aws_min_size(n, UINT32_MAX); - NTSTATUS status = BCryptGenRandom(s_alg_handle, output->buffer + output->len, capped_n, 0 /*flags*/); + NTSTATUS status = + BCryptGenRandom(NULL, output->buffer + output->len, capped_n, BCRYPT_USE_SYSTEM_PREFERRED_RNG); if (!BCRYPT_SUCCESS(status)) { output->len = original_len; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.24/tests/json_test.c new/aws-c-common-0.9.25/tests/json_test.c --- old/aws-c-common-0.9.24/tests/json_test.c 2024-07-24 19:17:15.000000000 +0200 +++ new/aws-c-common-0.9.25/tests/json_test.c 2024-08-01 20:44:38.000000000 +0200 @@ -114,6 +114,7 @@ // Testing valid array struct aws_json_value *array_node = aws_json_value_get_from_object(root, aws_byte_cursor_from_c_str("array")); + ASSERT_PTR_EQUALS(array_node, aws_json_value_get_from_object_c_str(root, "array")); ASSERT_NOT_NULL(array_node); ASSERT_TRUE(aws_json_value_is_array(array_node)); ASSERT_TRUE(aws_json_get_array_size(array_node) == 3); @@ -163,12 +164,14 @@ aws_string_destroy_secure(tmp_str); // Testing valid number - struct aws_json_value *number_node = aws_json_value_get_from_object(root, aws_byte_cursor_from_c_str("number")); + struct aws_json_value *number_node = aws_json_value_get_from_object_c_str(root, "number"); ASSERT_NOT_NULL(number_node); ASSERT_TRUE(aws_json_value_is_number(number_node)); double double_test_two = 0; aws_json_value_get_number(number_node, &double_test_two); ASSERT_TRUE(double_test_two == (double)123); + ASSERT_TRUE(aws_json_value_has_key_c_str(root, "number")); + ASSERT_TRUE(aws_json_value_has_key(root, aws_byte_cursor_from_c_str("number"))); // Testing valid object struct aws_json_value *object_node = aws_json_value_get_from_object(root, aws_byte_cursor_from_c_str("object")); @@ -210,6 +213,12 @@ // Test getting invalid type of data ASSERT_INT_EQUALS(aws_json_value_get_number(string_node, NULL), AWS_OP_ERR); + ASSERT_SUCCESS(aws_json_value_remove_from_object(root, aws_byte_cursor_from_c_str("number"))); + ASSERT_FALSE(aws_json_value_has_key_c_str(root, "number")); + + ASSERT_SUCCESS(aws_json_value_remove_from_object_c_str(root, "object")); + ASSERT_FALSE(aws_json_value_has_key_c_str(root, "object")); + aws_json_value_destroy(root); // Make sure that destroying NULL does not have any bad effects. @@ -233,12 +242,8 @@ aws_json_value_add_array_element(array, aws_json_value_new_number(allocator, 3)); aws_json_value_add_to_object(root, aws_byte_cursor_from_c_str("array"), array); - aws_json_value_add_to_object( - root, aws_byte_cursor_from_c_str("boolean"), aws_json_value_new_boolean(allocator, true)); - aws_json_value_add_to_object( - root, - aws_byte_cursor_from_c_str("color"), - aws_json_value_new_string(allocator, aws_byte_cursor_from_c_str("gold"))); + aws_json_value_add_to_object_c_str(root, "boolean", aws_json_value_new_boolean(allocator, true)); + aws_json_value_add_to_object_c_str(root, "color", aws_json_value_new_string_from_c_str(allocator, "gold")); aws_json_value_add_to_object(root, aws_byte_cursor_from_c_str("null"), aws_json_value_new_null(allocator)); aws_json_value_add_to_object(root, aws_byte_cursor_from_c_str("number"), aws_json_value_new_number(allocator, 123));
participants (1)
-
Source-Sync