mirror of
https://github.com/openssl/openssl.git
synced 2024-12-15 06:01:37 +08:00
Code & comments changes to make them in consistent
CLA: trivial Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26095)
This commit is contained in:
parent
df6a69a850
commit
2e407ea5c6
@ -40,7 +40,7 @@ int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-
|
/*
|
||||||
* This converts a big endian buffer and sign into its content encoding.
|
* This converts a big endian buffer and sign into its content encoding.
|
||||||
* This is used for INTEGER and ENUMERATED types.
|
* This is used for INTEGER and ENUMERATED types.
|
||||||
* The internal representation is an ASN1_STRING whose data is a big endian
|
* The internal representation is an ASN1_STRING whose data is a big endian
|
||||||
@ -260,12 +260,16 @@ static int asn1_get_int64(int64_t *pr, const unsigned char *b, size_t blen,
|
|||||||
return 0;
|
return 0;
|
||||||
if (neg) {
|
if (neg) {
|
||||||
if (r <= INT64_MAX) {
|
if (r <= INT64_MAX) {
|
||||||
/* Most significant bit is guaranteed to be clear, negation
|
/*
|
||||||
* is guaranteed to be meaningful in platform-neutral sense. */
|
* Most significant bit is guaranteed to be clear, negation
|
||||||
|
* is guaranteed to be meaningful in platform-neutral sense.
|
||||||
|
*/
|
||||||
*pr = -(int64_t)r;
|
*pr = -(int64_t)r;
|
||||||
} else if (r == ABS_INT64_MIN) {
|
} else if (r == ABS_INT64_MIN) {
|
||||||
/* This never happens if INT64_MAX == ABS_INT64_MIN, e.g.
|
/*
|
||||||
* on ones' complement system. */
|
* This never happens if INT64_MAX == ABS_INT64_MIN, e.g.
|
||||||
|
* on ones'-complement system.
|
||||||
|
*/
|
||||||
*pr = (int64_t)(0 - r);
|
*pr = (int64_t)(0 - r);
|
||||||
} else {
|
} else {
|
||||||
ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
|
ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
|
||||||
@ -345,11 +349,13 @@ static int asn1_string_set_int64(ASN1_STRING *a, int64_t r, int itype)
|
|||||||
|
|
||||||
a->type = itype;
|
a->type = itype;
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
/* Most obvious '-r' triggers undefined behaviour for most
|
/*
|
||||||
|
* Most obvious '-r' triggers undefined behaviour for most
|
||||||
* common INT64_MIN. Even though below '0 - (uint64_t)r' can
|
* common INT64_MIN. Even though below '0 - (uint64_t)r' can
|
||||||
* appear two's complement centric, it does produce correct/
|
* appear two's-complement centric, it does produce correct/
|
||||||
* expected result even on ones' complement. This is because
|
* expected result even on ones' complement. This is because
|
||||||
* cast to unsigned has to change bit pattern... */
|
* cast to unsigned has to change bit pattern...
|
||||||
|
*/
|
||||||
off = asn1_put_uint64(tbuf, 0 - (uint64_t)r);
|
off = asn1_put_uint64(tbuf, 0 - (uint64_t)r);
|
||||||
a->type |= V_ASN1_NEG;
|
a->type |= V_ASN1_NEG;
|
||||||
} else {
|
} else {
|
||||||
|
@ -255,6 +255,7 @@ BIGNUM *BN_new(void)
|
|||||||
BIGNUM *BN_secure_new(void)
|
BIGNUM *BN_secure_new(void)
|
||||||
{
|
{
|
||||||
BIGNUM *ret = BN_new();
|
BIGNUM *ret = BN_new();
|
||||||
|
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
ret->flags |= BN_FLG_SECURE;
|
ret->flags |= BN_FLG_SECURE;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -69,7 +69,7 @@ static ossl_inline void siv128_xorblock(SIV_BLOCK *x,
|
|||||||
* Doubles |b|, which is 16 bytes representing an element
|
* Doubles |b|, which is 16 bytes representing an element
|
||||||
* of GF(2**128) modulo the irreducible polynomial
|
* of GF(2**128) modulo the irreducible polynomial
|
||||||
* x**128 + x**7 + x**2 + x + 1.
|
* x**128 + x**7 + x**2 + x + 1.
|
||||||
* Assumes two's complement arithmetic
|
* Assumes two's-complement arithmetic
|
||||||
*/
|
*/
|
||||||
static ossl_inline void siv128_dbl(SIV_BLOCK *b)
|
static ossl_inline void siv128_dbl(SIV_BLOCK *b)
|
||||||
{
|
{
|
||||||
|
@ -275,7 +275,7 @@ static int fixup_des3_key(unsigned char *key)
|
|||||||
*
|
*
|
||||||
* block = 0
|
* block = 0
|
||||||
* for k: 1 -> K
|
* for k: 1 -> K
|
||||||
* block += s[N(k-1)..(N-1)k] (ones' complement addition)
|
* block += s[N(k-1)..(N-1)k] (ones'-complement addition)
|
||||||
*
|
*
|
||||||
* Optimizing for space we compute:
|
* Optimizing for space we compute:
|
||||||
* for each l in L-1 -> 0:
|
* for each l in L-1 -> 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user