X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcske%2Fsilcske.c;h=cacdb3d66d1b43be2f9d5e82cbe54210b425a3a2;hb=08091374ff1050f22c4f1d8bf89288c0f347b441;hp=e69fc0f9df52914c69fc0bff33ff2023944d40ed;hpb=23308d2b819b6274fe0d02d4751ec7493202e937;p=silc.git diff --git a/lib/silcske/silcske.c b/lib/silcske/silcske.c index e69fc0f9..cacdb3d6 100644 --- a/lib/silcske/silcske.c +++ b/lib/silcske/silcske.c @@ -1888,3 +1888,44 @@ void silc_ske_free_key_material(SilcSKEKeyMaterial *key) } silc_free(key); } + +const char *silc_ske_status_string[] = +{ + /* Official */ + "Ok", + "Unkown error occurred", + "Bad payload in packet", + "Unsupported group", + "Unsupported cipher", + "Unsupported PKCS", + "Unsupported hash function", + "Unsupported HMAC", + "Unsupported public key (or certificate)", + "Incorrect signature", + "Bad or unsupported version", + "Invalid cookie", + + /* Other errors */ + "Pending", + "Remote did not provide public key", + "Key exchange protocol is not active", + "Bad reserved field in packet", + "Bad payload length in packet", + "Incorrect hash", + + NULL +}; + +/* Maps status to readable string and returns the string. If string is not + found and empty character string ("") is returned. */ + +const char *silc_ske_map_status(SilcSKEStatus status) +{ + int i; + + for (i = 0; silc_ske_status_string[i]; i++) + if (status == i) + return silc_ske_status_string[i]; + + return ""; +}