comparison libtomcrypt/demos/constants.c @ 1711:e9dba7abd939

Merge libtomcrypt v1.18.2
author Matt Johnston <matt@ucc.asn.au>
date Wed, 10 Jun 2020 23:16:13 +0800
parents 6dba84798cd5
children
comparison
equal deleted inserted replaced
1710:1ff2a1034c52 1711:e9dba7abd939
63 char *names_list; 63 char *names_list;
64 unsigned int names_list_len; 64 unsigned int names_list_len;
65 /* get and print the length of the names (and values) list */ 65 /* get and print the length of the names (and values) list */
66 if (crypt_list_all_constants(NULL, &names_list_len) != 0) exit(EXIT_FAILURE); 66 if (crypt_list_all_constants(NULL, &names_list_len) != 0) exit(EXIT_FAILURE);
67 /* get and print the names (and values) list */ 67 /* get and print the names (and values) list */
68 names_list = malloc(names_list_len); 68 if ((names_list = malloc(names_list_len)) == NULL) exit(EXIT_FAILURE);
69 if (crypt_list_all_constants(names_list, &names_list_len) != 0) exit(EXIT_FAILURE); 69 if (crypt_list_all_constants(names_list, &names_list_len) != 0) exit(EXIT_FAILURE);
70 printf("%s\n", names_list); 70 printf("%s\n", names_list);
71 free(names_list);
71 } 72 }
72 } else if (argc == 3) { 73 } else if (argc == 3) {
73 if (strcmp(argv[1], "-s") == 0) { 74 if (strcmp(argv[1], "-s") == 0) {
74 int value; 75 int value;
75 if (crypt_get_constant(argv[2], &value) != 0) exit(EXIT_FAILURE); 76 if (crypt_get_constant(argv[2], &value) != 0) exit(EXIT_FAILURE);