ssl - Bad MAC after porting OpenSSL 1.0.2 to ECOS -


we have openssl running on our embedded system, running ecos os. upgrading our openssl 1.0.2 version. have ported , compiled openssl library. when when try connect our device using ssl (via https), handshake fails bad record mac alert always. have enabled openssl debug option, unable identify why failing.

have ported latest openssl code ecos? need take of special compilation flags latest openssl code ecos?

for reference, here relevant part of ssl3_get_record:

mac = rr->data + rr->length; i=s->method->ssl3_enc->mac(s,md,0 /* not send */); if (i < 0 || crypto_memcmp(md, mac, (size_t)mac_size) != 0)     {     al=ssl_ad_bad_record_mac;     sslerr(ssl_f_ssl3_get_record,ssl_r_decryption_failed_or_bad_record_mac);     goto f_err;     } 

after debugging found random library (rand) failing ecos. there lot of places in openssl checks random_bytes return type. due failure, pre-master key decryption failing. , incoming packets not decrypted properly. hence bad mac records error seen.

we checked our old ported code (0.9.6), rand library failing there also, there no return check random_bytes , pseudo_rand_bytes. fix made rand return success every time, , can see ssl session being established fine openssl 1.0.2 version.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -