@@ -369,6 +369,8 @@ extern "C" {
369
369
* - The maximum tag nesting is @c QCBOR_MAX_TAGS_PER_ITEM (typically 4).
370
370
* - Works only on 32- and 64-bit CPUs.
371
371
* - QCBORDecode_EnterBstrWrapped() doesn't work on indefinite-length strings.
372
+ * - Numeric reduction of big numbers to integers for preferred
373
+ * serialization is not performed.
372
374
*
373
375
* The public interface uses @c size_t for all lengths. Internally the
374
376
* implementation uses 32-bit lengths by design to use less memory and
@@ -987,9 +989,9 @@ QCBOREncode_AddTBinaryUUIDToMapN(QCBOREncodeContext *pCtx,
987
989
* (https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.3). No
988
990
* processing, such as removal of leading zeros, is perfomed.
989
991
*
990
- * Sometimes big numbers are used to represent parts of cryptographic
991
- * keys, however, COSE which defines representations for keys does,
992
- * not use this particular type .
992
+ * RFC 8949 preferred serialization requires big numbers that
993
+ * will fit in integers be encoded as integers. That is NOT
994
+ * performed .
993
995
*/
994
996
static void
995
997
QCBOREncode_AddTPositiveBignum (QCBOREncodeContext * pCtx ,
@@ -1026,6 +1028,10 @@ QCBOREncode_AddTPositiveBignumToMapN(QCBOREncodeContext *pCtx,
1026
1028
* (https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.3). No
1027
1029
* processing, such as removal of leading zeros or the required offset
1028
1030
* of 1 for negative values, is perfomed.
1031
+ *
1032
+ * RFC 8949 preferred serialization requires big numbers that
1033
+ * will fit in integers be encoded as integers. That is NOT
1034
+ * performed.
1029
1035
*/
1030
1036
static void
1031
1037
QCBOREncode_AddTNegativeBignum (QCBOREncodeContext * pCtx ,
@@ -1055,7 +1061,7 @@ QCBOREncode_AddTNegativeBignumToMapN(QCBOREncodeContext *pCtx,
1055
1061
* @param[in] nMantissa The mantissa.
1056
1062
* @param[in] nBase10Exponent The exponent.
1057
1063
*
1058
- * The value is nMantissa * 10 ^ nBase10Exponent.
1064
+ * The value is @c nMantissa * 10 ^ @c nBase10Exponent.
1059
1065
*
1060
1066
* A decimal fraction is good for exact representation of some values
1061
1067
* that can't be represented exactly with standard C (IEEE 754)
@@ -1074,8 +1080,8 @@ QCBOREncode_AddTNegativeBignumToMapN(QCBOREncodeContext *pCtx,
1074
1080
* support this range to reduce code size and interface complexity a
1075
1081
* little).
1076
1082
*
1077
- * CBOR Preferred serialization of the integers is used, thus they
1078
- * will be encoded in the smallest number of bytes possible .
1083
+ * Preferred serialization is used when the mantissa or exponent are
1084
+ * integers, thus they will be encoded in the smallest number of bytes.
1079
1085
*
1080
1086
* See also QCBOREncode_AddTDecimalFractionBigNum() for a decimal
1081
1087
* fraction with arbitrarily large precision and
@@ -1121,6 +1127,10 @@ QCBOREncode_AddTDecimalFractionToMapN(QCBOREncodeContext *pCtx,
1121
1127
* mantissa is a big number (See QCBOREncode_AddTPositiveBignum())
1122
1128
* allowing for arbitrarily large precision.
1123
1129
*
1130
+ * RFC 8949 preferred serialization requires reduction of big numbers
1131
+ * that can fit into integers be encoded as integers, not big numbers.
1132
+ * This implementation does NOT do that.
1133
+ *
1124
1134
* See @ref expAndMantissa for decoded representation.
1125
1135
*/
1126
1136
static void
@@ -1155,7 +1165,7 @@ QCBOREncode_AddTDecimalFractionBigNumToMapN(QCBOREncodeContext *pCtx,
1155
1165
* @param[in] nMantissa The mantissa.
1156
1166
* @param[in] nBase2Exponent The exponent.
1157
1167
*
1158
- * The value is nMantissa * 2 ^ nBase2Exponent.
1168
+ * The value is @c nMantissa * 2 ^ @c nBase2Exponent.
1159
1169
*
1160
1170
* "Bigfloats", as CBOR terms them, are similar to IEEE floating-point
1161
1171
* numbers in having a mantissa and base-2 exponent, but they are not
@@ -1175,8 +1185,8 @@ QCBOREncode_AddTDecimalFractionBigNumToMapN(QCBOREncodeContext *pCtx,
1175
1185
* support this range to reduce code size and interface complexity a
1176
1186
* little).
1177
1187
*
1178
- * CBOR preferred serialization of the integers is used, thus they will
1179
- * be encoded in the smallest number of bytes possible .
1188
+ * Preferred serialization is used when the mantissa or exponent are
1189
+ * integers, thus they will be encoded in the smallest number of bytes.
1180
1190
*
1181
1191
* This can also be used to represent floating-point numbers in
1182
1192
* environments that don't support IEEE 754.
@@ -1219,6 +1229,10 @@ QCBOREncode_AddTBigFloatToMapN(QCBOREncodeContext *pCtx,
1219
1229
* is a big number (See QCBOREncode_AddTPositiveBignum()) allowing for
1220
1230
* arbitrary precision.
1221
1231
*
1232
+ * RFC 8949 preferred serialization requires reduction of big numbers
1233
+ * that can fit into integers be encoded as integers, not big numbers.
1234
+ * This implementation does NOT do that.
1235
+ *
1222
1236
* See @ref expAndMantissa for decoded representation.
1223
1237
*/
1224
1238
static void
0 commit comments