Mageia Bugzilla – Attachment 11109 Details for
Bug 23853
Update android-tools to 9.0.0_r21
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
bz1441234
0004-bz1441234.patch (text/plain), 1.69 KB, created by
Kristoffer Grundström
on 2019-06-18 12:15:44 CEST
(
hide
)
Description:
bz1441234
Filename:
MIME Type:
Creator:
Kristoffer Grundström
Created:
2019-06-18 12:15:44 CEST
Size:
1.69 KB
patch
obsolete
>diff --git a/libcrypto_utils/android_pubkey.c b/libcrypto_utils/android_pubkey.c >index 3052e52..7061db9 100644 >--- a/libcrypto_utils/android_pubkey.c >+++ b/libcrypto_utils/android_pubkey.c >@@ -126,37 +126,41 @@ bool android_pubkey_encode(const RSA* key, uint8_t* key_buffer, size_t size) { > BIGNUM* r32 = BN_new(); > BIGNUM* n0inv = BN_new(); > BIGNUM* rr = BN_new(); >+ const BIGNUM *n; >+ const BIGNUM *e; > > if (sizeof(RSAPublicKey) > size || > RSA_size(key) != ANDROID_PUBKEY_MODULUS_SIZE) { > goto cleanup; > } > >+ RSA_get0_key(key, &n, &e, NULL); >+ > // Store the modulus size. > key_struct->modulus_size_words = ANDROID_PUBKEY_MODULUS_SIZE_WORDS; > > // Compute and store n0inv = -1 / N[0] mod 2^32. >- if (!ctx || !r32 || !n0inv || !BN_set_bit(r32, 32) || >- !BN_mod(n0inv, key->n, r32, ctx) || >+ if (!ctx || !r32 || !n0inv || !n || !e || !BN_set_bit(r32, 32) || >+ !BN_mod(n0inv, n, r32, ctx) || > !BN_mod_inverse(n0inv, n0inv, r32, ctx) || !BN_sub(n0inv, r32, n0inv)) { > goto cleanup; > } > key_struct->n0inv = (uint32_t)BN_get_word(n0inv); > > // Store the modulus. >- if (!android_pubkey_encode_bignum(key->n, key_struct->modulus)) { >+ if (!android_pubkey_encode_bignum(n, key_struct->modulus)) { > goto cleanup; > } > > // Compute and store rr = (2^(rsa_size)) ^ 2 mod N. > if (!ctx || !rr || !BN_set_bit(rr, ANDROID_PUBKEY_MODULUS_SIZE * 8) || >- !BN_mod_sqr(rr, rr, key->n, ctx) || >+ !BN_mod_sqr(rr, rr, n, ctx) || > !android_pubkey_encode_bignum(rr, key_struct->rr)) { > goto cleanup; > } > > // Store the exponent. >- key_struct->exponent = (uint32_t)BN_get_word(key->e); >+ key_struct->exponent = (uint32_t)BN_get_word(e); > > ret = true; >
diff --git a/libcrypto_utils/android_pubkey.c b/libcrypto_utils/android_pubkey.c index 3052e52..7061db9 100644 --- a/libcrypto_utils/android_pubkey.c +++ b/libcrypto_utils/android_pubkey.c @@ -126,37 +126,41 @@ bool android_pubkey_encode(const RSA* key, uint8_t* key_buffer, size_t size) { BIGNUM* r32 = BN_new(); BIGNUM* n0inv = BN_new(); BIGNUM* rr = BN_new(); + const BIGNUM *n; + const BIGNUM *e; if (sizeof(RSAPublicKey) > size || RSA_size(key) != ANDROID_PUBKEY_MODULUS_SIZE) { goto cleanup; } + RSA_get0_key(key, &n, &e, NULL); + // Store the modulus size. key_struct->modulus_size_words = ANDROID_PUBKEY_MODULUS_SIZE_WORDS; // Compute and store n0inv = -1 / N[0] mod 2^32. - if (!ctx || !r32 || !n0inv || !BN_set_bit(r32, 32) || - !BN_mod(n0inv, key->n, r32, ctx) || + if (!ctx || !r32 || !n0inv || !n || !e || !BN_set_bit(r32, 32) || + !BN_mod(n0inv, n, r32, ctx) || !BN_mod_inverse(n0inv, n0inv, r32, ctx) || !BN_sub(n0inv, r32, n0inv)) { goto cleanup; } key_struct->n0inv = (uint32_t)BN_get_word(n0inv); // Store the modulus. - if (!android_pubkey_encode_bignum(key->n, key_struct->modulus)) { + if (!android_pubkey_encode_bignum(n, key_struct->modulus)) { goto cleanup; } // Compute and store rr = (2^(rsa_size)) ^ 2 mod N. if (!ctx || !rr || !BN_set_bit(rr, ANDROID_PUBKEY_MODULUS_SIZE * 8) || - !BN_mod_sqr(rr, rr, key->n, ctx) || + !BN_mod_sqr(rr, rr, n, ctx) || !android_pubkey_encode_bignum(rr, key_struct->rr)) { goto cleanup; } // Store the exponent. - key_struct->exponent = (uint32_t)BN_get_word(key->e); + key_struct->exponent = (uint32_t)BN_get_word(e); ret = true;
View Attachment As Raw
Actions:
View
Attachments on
bug 23853
:
10474
|
10475
|
10476
|
10477
|
10478
|
10479
|
10480
|
10481
|
10482
|
11104
|
11105
|
11106
|
11107
|
11108
|
11109
|
11110
|
11111
|
11112
|
11113
|
11114