/[mcrypt]/libmcrypt/lib/mcrypt.c
ViewVC logotype

Diff of /libmcrypt/lib/mcrypt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by nmav, Thu Oct 12 21:06:31 2000 UTC revision 1.4 by nmav, Wed Oct 25 18:43:11 2000 UTC
# Line 54  static int internal_init_mcrypt(MCRYPT t Line 54  static int internal_init_mcrypt(MCRYPT t
54  {  {
55          int *sizes = NULL;          int *sizes = NULL;
56          int num_of_sizes, i, ok = 0;          int num_of_sizes, i, ok = 0;
   
57          if (lenofkey == 0) {          if (lenofkey == 0) {
58                  return MCRYPT_KEY_LEN_ERROR;    /* error */                  return MCRYPT_KEY_LEN_ERROR;    /* error */
59          }          }
# Line 175  void mcrypt_perror(int err) Line 174  void mcrypt_perror(int err)
174  }  }
175    
176  WIN32DLL_DEFINE  WIN32DLL_DEFINE
177    char* mcrypt_strerror(int err)
178    {
179    char* cerr=malloc(256);
180    
181            switch (err) {
182            case MCRYPT_UNKNOWN_ERROR:
183                    sprintf(cerr, "Unknown error.\n");
184                    break;
185            case MCRYPT_ALGORITHM_MODE_INCOMPATIBILITY:
186                    sprintf(cerr,
187                            "Algorithm incompatible with this mode.\n");
188                    break;
189            case MCRYPT_KEY_LEN_ERROR:
190                    sprintf(cerr, "Key length is not legal.\n");
191                    break;
192            case MCRYPT_MEMORY_ALLOCATION_ERROR:
193                    sprintf(cerr, "Memory allocation failed.\n");
194                    break;
195            case MCRYPT_UNKNOWN_MODE:
196                    sprintf(cerr, "Unknown mode.\n");
197                    break;
198            case MCRYPT_UNKNOWN_ALGORITHM:
199                    sprintf(cerr, "Unknown algorithm.\n");
200                    break;
201    
202            }
203            return cerr;
204    }
205    
206    WIN32DLL_DEFINE
207  int mcrypt_free(void *ptr)  int mcrypt_free(void *ptr)
208  {  {
209          free(ptr);          free(ptr);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26