build: Fix message digest library checks They were not failing when not finding the SHA-2 functions and were hardcoding -lmd regardless of what library had been found.