devos50/qemu-ios

I get an error when generating a nor for iPod Touch 2g

Opened this issue · 0 comments

Here is the command I ran and the output:
gcc generate_nor.c aes.c -o generate_nor -I/usr/local/Cellar/openssl@3/3.0.7/include -L /usr/local/Cellar/openssl@3/3.0.7/lib -lssl -lcrypto
Output:
generate_nor.c:88:6: warning: multi-character character constant [-Wmultichar]
88 | {'Mod#', "MA623" },
| ^~~~~~
generate_nor.c:89:6: warning: multi-character character constant [-Wmultichar]
89 | {'Regn', "B/LL" },
| ^~~~~~
generate_nor.c:90:6: warning: multi-character character constant [-Wmultichar]
90 | {'SrNm', "1A8478BH203" },
| ^~~~~~
generate_nor.c:91:6: warning: multi-character character constant [-Wmultichar]
91 | {'Batt', "690476146348"}};
| ^~~~~~
generate_nor.c: In function 'calculate_img2_data_hash':
generate_nor.c:212:9: warning: 'SHA1_Init' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
212 | SHA1_Init(&context);
| ^~~~~~~~~
In file included from generate_nor.c:8:
/usr/include/openssl/sha.h:49:27: note: declared here
49 | OSSL_DEPRECATEDIN_3_0 int SHA1_Init(SHA_CTX *c);
| ^~~~~~~~~
generate_nor.c:213:9: warning: 'SHA1_Update' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
213 | SHA1_Update(&context, buffer, len);
| ^~~~~~~~~~~
/usr/include/openssl/sha.h:50:27: note: declared here
50 | OSSL_DEPRECATEDIN_3_0 int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
| ^~~~~~~~~~~
generate_nor.c:214:9: warning: 'SHA1_Final' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
214 | SHA1_Final(hash, &context);
| ^~~~~~~~~~
/usr/include/openssl/sha.h:51:27: note: declared here
51 | OSSL_DEPRECATEDIN_3_0 int SHA1_Final(unsigned char *md, SHA_CTX *c);
| ^~~~~~~~~~
generate_nor.c: In function 'calculate_img2_hash':
generate_nor.c:224:5: warning: 'SHA1_Init' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
224 | SHA1_Init(&context);
| ^~~~~~~~~
/usr/include/openssl/sha.h:49:27: note: declared here
49 | OSSL_DEPRECATEDIN_3_0 int SHA1_Init(SHA_CTX *c);
| ^~~~~~~~~
generate_nor.c:225:5: warning: 'SHA1_Update' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
225 | SHA1_Update(&context, (uint8_t *)header, 0x3E0);
| ^~~~~~~~~~~
/usr/include/openssl/sha.h:50:27: note: declared here
50 | OSSL_DEPRECATEDIN_3_0 int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
| ^~~~~~~~~~~
generate_nor.c:226:5: warning: 'SHA1_Final' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
226 | SHA1_Final(hash, &context);
| ^~~~~~~~~~
/usr/include/openssl/sha.h:51:27: note: declared here
51 | OSSL_DEPRECATEDIN_3_0 int SHA1_Final(unsigned char *md, SHA_CTX *c);
| ^~~~~~~~~~
generate_nor.c: In function 'add_img3':
generate_nor.c:260:9: warning: 'AES_set_decrypt_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
260 | AES_set_decrypt_key(key_uid, sizeof(key_uid) * 8, &encryptKey);
| ^~~~~~~~~~~~~~~~~~~
In file included from generate_nor.c:7:
/usr/include/openssl/aes.h:54:5: note: declared here
54 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
| ^~~~~~~~~~~~~~~~~~~
generate_nor.c:262:9: warning: 'AES_cbc_encrypt' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
262 | AES_cbc_encrypt(derivedSeed, derivedKey, 16, &encryptKey, &ivec, AES_DECRYPT);
| ^~~~~~~~~~~~~~~
/usr/include/openssl/aes.h:66:6: note: declared here
66 | void AES_cbc_encrypt(const unsigned char in, unsigned char out,
| ^~~~~~~~~~~~~~~
generate_nor.c:262:67: warning: passing argument 5 of 'AES_cbc_encrypt' from incompatible pointer type [-Wincompatible-pointer-types]
262 | AES_cbc_encrypt(derivedSeed, derivedKey, 16, &encryptKey, &ivec, AES_DECRYPT);
| ^~~~~
| |
| uint8_t (
)[16] {aka unsigned char (
)[16]}

/usr/include/openssl/aes.h:68:37: note: expected 'unsigned char ' but argument is of type 'uint8_t ()[16]' {aka 'unsigned char (*)[16]'}
68 | unsigned char *ivec, const int enc);
| ~~~~~~~~~~~~~~~^~~~
generate_nor.c:273:9: warning: 'AES_set_encrypt_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
273 | AES_set_encrypt_key(derivedKey, sizeof(key_uid) * 8, &encryptKey);
| ^~~~~~~~~~~~~~~~~~~
/usr/include/openssl/aes.h:51:5: note: declared here
51 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
| ^~~~~~~~~~~~~~~~~~~
generate_nor.c:276:9: warning: 'AES_cbc_encrypt' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
276 | AES_cbc_encrypt(&imgdata[168108], &imgdata[168108], 0x80, &encryptKey, &ivec2, AES_ENCRYPT);
| ^~~~~~~~~~~~~~~
/usr/include/openssl/aes.h:66:6: note: declared here
66 | void AES_cbc_encrypt(const unsigned char in, unsigned char out,
| ^~~~~~~~~~~~~~~
generate_nor.c:276:80: warning: passing argument 5 of 'AES_cbc_encrypt' from incompatible pointer type [-Wincompatible-pointer-types]
276 | rypt(&imgdata[168108], &imgdata[168108], 0x80, &encryptKey, &ivec2, AES_ENCRYPT);
| ^~~~~~
| |
| uint8_t (
)[16] {aka unsigned char (
)[16]}

/usr/include/openssl/aes.h:68:37: note: expected 'unsigned char ' but argument is of type 'uint8_t ()[16]' {aka 'unsigned char (*)[16]'}
68 | unsigned char *ivec, const int enc);
| ~~~~~~~~~~~~~~~^~~~
generate_nor.c: In function 'main':
generate_nor.c:341:30: warning: multi-character character constant [-Wmultichar]
341 | syscfg_header->shMagic = 'SCfg';
| ^~~~~~
aes.c: In function 'aes_encrypt':
aes.c:45:9: warning: 'AES_set_decrypt_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
45 | AES_set_decrypt_key((uint8_t *)key_words, key_size * 8, &encryption_key);
| ^~~~~~~~~~~~~~~~~~~
In file included from aes.c:6:
/usr/include/openssl/aes.h:54:5: note: declared here
54 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
| ^~~~~~~~~~~~~~~~~~~
aes.c:53:9: warning: 'AES_cbc_encrypt' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
53 | AES_cbc_encrypt(data, data, size, &encryption_key, (uint8_t *)iv_enc, AES_ENCRYPT);
| ^~~~~~~~~~~~~~~
/usr/include/openssl/aes.h:66:6: note: declared here
66 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
| ^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccBxUjKo.o: in function add_img3': generate_nor.c:(.text+0x8b8): undefined reference to ceil'
collect2: error: ld returned 1 exit status