mirror of
https://github.com/libtom/libtomcrypt
synced 2026-08-25 20:26:07 -04:00
Fix demos/pem-info.c to properly display different CFB modes
Also, make CMake build it.
This commit is contained in:
parent
dd3b9e59e1
commit
2026e2865d
2 changed files with 14 additions and 3 deletions
|
|
@ -2,7 +2,7 @@
|
|||
# Options
|
||||
#-----------------------------------------------------------------------------
|
||||
option(BUILD_USEFUL_DEMOS "Build useful demos (hashsum)" FALSE)
|
||||
option(BUILD_USABLE_DEMOS "Build usable demos (ltcrypt sizes constants)" FALSE)
|
||||
option(BUILD_USABLE_DEMOS "Build usable demos (ltcrypt sizes constants pem-info)" FALSE)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Useful demos
|
||||
|
|
@ -38,7 +38,7 @@ endif()
|
|||
|
||||
if(BUILD_USABLE_DEMOS)
|
||||
|
||||
list(APPEND ALL_DEMOS_TARGETS ltcrypt sizes constants)
|
||||
list(APPEND ALL_DEMOS_TARGETS ltcrypt sizes constants pem-info)
|
||||
|
||||
# ltcrypt
|
||||
add_executable(ltcrypt
|
||||
|
|
@ -67,6 +67,15 @@ if(BUILD_USABLE_DEMOS)
|
|||
${PROJECT_NAME}
|
||||
)
|
||||
|
||||
# pem-info
|
||||
add_executable(pem-info
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pem-info.c
|
||||
)
|
||||
|
||||
target_link_libraries(pem-info PRIVATE
|
||||
${PROJECT_NAME}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ static const struct {
|
|||
{ cm_none, "none", },
|
||||
{ cm_cbc, "CBC", },
|
||||
{ cm_cfb, "CFB", },
|
||||
{ cm_cfb1, "CFB1", },
|
||||
{ cm_cfb8, "CFB8", },
|
||||
{ cm_ctr, "CTR", },
|
||||
{ cm_ofb, "OFB", },
|
||||
{ cm_stream, "STREAM", },
|
||||
|
|
@ -58,7 +60,7 @@ static const struct {
|
|||
static const char *s_map_mode(enum cipher_mode mode)
|
||||
{
|
||||
size_t n;
|
||||
mode &= cm_modes;
|
||||
mode &= cm_modes | cm_1bit | cm_8bit;
|
||||
for (n = 0; n < sizeof(cipher_mode_map)/sizeof(cipher_mode_map[0]); ++n) {
|
||||
if (cipher_mode_map[n].mode == mode)
|
||||
return cipher_mode_map[n].name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue