In order to do reverse geocoding lookups to find a country (as ISO-3166-1) and the subdivision (as ISO-3166-2) for given coordinates I am looking for a way to get all polygons of all countries and their subdivisions.
Reverse geocoding lookups with Google Maps or other services either do not always return the country and subdivision (Google Maps), or sometimes they are incorrect (geonames.org). As I understand it all countries and subdivisons are available in the openstreetmap data, but I do not know how to only retrieve the polygons - no map data, no points of interest or cities are necessary, only the outlines of all subdivisions with the given country and subdivision codes. Then I can check myself if a given point is within any given polygon, or near it.
Does anyone know how to retrieve this data from the openstreetmap data, or is there any other source for this data?