Its not illegal to root your smartphone no matter where you live. Just make sure that the company, which your smartphone belongs to, has made the smartphone compatible for rooting. This will not void your warranty if something wrong happens to your phone while rooting. All smartphones can be rooted, however, some can be damaged (bricked).
Samsung, LG, HTC companies doesnot recommend to root their phone and wont give warrenty if something happens whreas companies like OnePlus, Xiaomi phones are made for rooting.