First, use glDrawPixels.
If the unsigned char is a greyscale, you can use GL_LUMINANCE.
If the unsigned char is an index into a palette (a color image like GIF) and you are in an OpenGL RGBA pixelformat (most likely, almost noone supports color indexed rendering in HW) you need to set up a palette lookup for the colors.
Look at glPixelTransfer and glPixelMap.
Don’t expect good performance.