David Horstmann cdaee54773 Fix incorrect printing of OIDs
The first 2 components of an OID are combined together into the same
subidentifier via the formula:

subidentifier = (component1 * 40) + component2

The current code extracts component1 and component2 using division and
modulo as one would expect. However, there is a subtlety in the
specification[1]:

>This packing of the first two object identifier components recognizes
>that only three values are allocated from the root node, and at most
>39 subsequent values from nodes reached by X = 0 and X = 1.

If the root node (component1) is 2, the subsequent node (component2)
may be greater than 38. For example, the following are real OIDs:
* 2.40.0.25, UPU standard S25
* 2.49.0.0.826.0, Met Office
* 2.999, Allocated example OID

This has 2 implications that the current parsing code does not take
account of:
1. The second component may be > 39, so (subidentifier % 40) is not
correct in all circumstances.
2. The first subidentifier (containing the first 2 components) may be
more than one byte long. Currently we assume it is just 1 byte.

Improve parsing code to deal with these cases correctly.

[1] Rec. ITU-T X.690 (02/2021), 8.19.4

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-20 14:44:18 +00:00
..
.gitignore Split libs with make + general make cleanups 2015-06-25 10:59:56 +02:00
aes.c Switch to the new code style 2023-01-11 14:52:35 +01:00
aesni.c Switch to the new code style 2023-01-11 14:52:35 +01:00
arc4.c Switch to the new code style 2023-01-11 14:52:35 +01:00
aria.c Switch to the new code style 2023-01-11 14:52:35 +01:00
asn1parse.c Switch to the new code style 2023-01-11 14:52:35 +01:00
asn1write.c Switch to the new code style 2023-01-11 14:52:35 +01:00
base64.c Switch to the new code style 2023-01-11 14:52:35 +01:00
bignum.c Fix IAR warnings 2023-02-13 15:07:44 +00:00
blowfish.c Switch to the new code style 2023-01-11 14:52:35 +01:00
camellia.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ccm.c Fix use of sizeof without brackets 2023-02-02 12:46:39 +00:00
certs.c Switch to the new code style 2023-01-11 14:52:35 +01:00
chacha20.c Switch to the new code style 2023-01-11 14:52:35 +01:00
chachapoly.c Switch to the new code style 2023-01-11 14:52:35 +01:00
check_crypto_config.h Switch to the new code style 2023-01-11 14:52:35 +01:00
cipher_wrap.c Switch to the new code style 2023-01-11 14:52:35 +01:00
cipher.c Switch to the new code style 2023-01-11 14:52:35 +01:00
cmac.c Switch to the new code style 2023-01-11 14:52:35 +01:00
CMakeLists.txt Bump LTS version to 2.28.2 2022-12-08 11:05:11 +00:00
common.h Switch to the new code style 2023-01-11 14:52:35 +01:00
constant_time_internal.h Switch to the new code style 2023-01-11 14:52:35 +01:00
constant_time_invasive.h Switch to the new code style 2023-01-11 14:52:35 +01:00
constant_time.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ctr_drbg.c Switch to the new code style 2023-01-11 14:52:35 +01:00
debug.c Switch to the new code style 2023-01-11 14:52:35 +01:00
des.c Switch to the new code style 2023-01-11 14:52:35 +01:00
dhm.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ecdh.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ecdsa.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ecjpake.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ecp_curves.c Address missed instances of sizeof 2023-02-02 15:34:23 +00:00
ecp_invasive.h Switch to the new code style 2023-01-11 14:52:35 +01:00
ecp.c Fix IAR warnings 2023-02-13 15:07:44 +00:00
entropy_poll.c Switch to the new code style 2023-01-11 14:52:35 +01:00
entropy.c Fix use of sizeof without brackets 2023-02-02 12:46:39 +00:00
error.c Update generated files 2023-01-11 14:52:37 +01:00
gcm.c Switch to the new code style 2023-01-11 14:52:35 +01:00
havege.c Switch to the new code style 2023-01-11 14:52:35 +01:00
hkdf.c Switch to the new code style 2023-01-11 14:52:35 +01:00
hmac_drbg.c Switch to the new code style 2023-01-11 14:52:35 +01:00
Makefile Add a selftest run for the TIMING_ALT test 2023-01-26 04:33:59 -05:00
md2.c Switch to the new code style 2023-01-11 14:52:35 +01:00
md4.c Switch to the new code style 2023-01-11 14:52:35 +01:00
md5.c Switch to the new code style 2023-01-11 14:52:35 +01:00
md.c Switch to the new code style 2023-01-11 14:52:35 +01:00
memory_buffer_alloc.c Switch to the new code style 2023-01-11 14:52:35 +01:00
mps_common.h Switch to the new code style 2023-01-11 14:52:35 +01:00
mps_error.h Switch to the new code style 2023-01-11 14:52:35 +01:00
mps_reader.c Switch to the new code style 2023-01-11 14:52:35 +01:00
mps_reader.h Switch to the new code style 2023-01-11 14:52:35 +01:00
mps_trace.c Switch to the new code style 2023-01-11 14:52:35 +01:00
mps_trace.h Switch to the new code style 2023-01-11 14:52:35 +01:00
net_sockets.c Switch to the new code style 2023-01-11 14:52:35 +01:00
nist_kw.c Switch to the new code style 2023-01-11 14:52:35 +01:00
oid.c Fix incorrect printing of OIDs 2023-02-20 14:44:18 +00:00
padlock.c Switch to the new code style 2023-01-11 14:52:35 +01:00
pem.c Switch to the new code style 2023-01-11 14:52:35 +01:00
pk_wrap.c Switch to the new code style 2023-01-11 14:52:35 +01:00
pk.c Switch to the new code style 2023-01-11 14:52:35 +01:00
pkcs5.c Switch to the new code style 2023-01-11 14:52:35 +01:00
pkcs11.c Switch to the new code style 2023-01-11 14:52:35 +01:00
pkcs12.c Switch to the new code style 2023-01-11 14:52:35 +01:00
pkparse.c Switch to the new code style 2023-01-11 14:52:35 +01:00
pkwrite.c Switch to the new code style 2023-01-11 14:52:35 +01:00
platform_util.c Switch to the new code style 2023-01-11 14:52:35 +01:00
platform.c Switch to the new code style 2023-01-11 14:52:35 +01:00
poly1305.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_aead.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_aead.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_cipher.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_cipher.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_client.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_core.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_driver_wrappers.c Fix compiler warning: unreachable code 2023-02-11 18:20:20 -07:00
psa_crypto_driver_wrappers.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_ecp.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_ecp.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_hash.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_hash.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_invasive.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_its.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_mac.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_mac.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_random_impl.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_rsa.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_rsa.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_se.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_se.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_slot_management.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_slot_management.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_storage.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto_storage.h Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_crypto.c Switch to the new code style 2023-01-11 14:52:35 +01:00
psa_its_file.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ripemd160.c Fix use of sizeof without brackets 2023-02-02 12:46:39 +00:00
rsa_internal.c Switch to the new code style 2023-01-11 14:52:35 +01:00
rsa.c Switch to the new code style 2023-01-11 14:52:35 +01:00
sha1.c Switch to the new code style 2023-01-11 14:52:35 +01:00
sha256.c Switch to the new code style 2023-01-11 14:52:35 +01:00
sha512.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_cache.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_ciphersuites.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_cli.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_cookie.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_msg.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_srv.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_ticket.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_tls13_keys.c Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_tls13_keys.h Switch to the new code style 2023-01-11 14:52:35 +01:00
ssl_tls.c Switch to the new code style 2023-01-11 14:52:35 +01:00
threading.c Switch to the new code style 2023-01-11 14:52:35 +01:00
timing.c Enable the timing.c selftest with MBEDTLS_TIMING_ALT 2023-01-13 19:01:51 -05:00
version_features.c Update generated files 2023-01-11 14:52:37 +01:00
version.c Switch to the new code style 2023-01-11 14:52:35 +01:00
x509_create.c Switch to the new code style 2023-01-11 14:52:35 +01:00
x509_crl.c Switch to the new code style 2023-01-11 14:52:35 +01:00
x509_crt.c X.509: Remove red'n bounds checks and zeroiz'n in OtherName parsing 2023-02-08 08:50:01 -05:00
x509_csr.c Switch to the new code style 2023-01-11 14:52:35 +01:00
x509.c Switch to the new code style 2023-01-11 14:52:35 +01:00
x509write_crt.c x509write_crt: reject serial longer than X509_RFC5280_MAX_SERIAL_LEN 2023-01-13 08:39:36 +01:00
x509write_csr.c Switch to the new code style 2023-01-11 14:52:35 +01:00
xtea.c Switch to the new code style 2023-01-11 14:52:35 +01:00