Esempio n. 1
0
	int cipherList(State & state){
		Stack * stack = state.stack;
		CipherInfo * interfaceCipherInfo = OBJECT_IFACE(CipherInfo);
		const int * list = mbedtls_cipher_list();
		stack->newTable();

		while (*list != 0){
			const mbedtls_cipher_info_t * info = mbedtls_cipher_info_from_type(static_cast<mbedtls_cipher_type_t>(*list));
			stack->push<int>(*list);
			interfaceCipherInfo->push(const_cast<mbedtls_cipher_info_t *>(info));
			stack->setTable();
			list++;
		}
		return 1;
	}
Esempio n. 2
0
void
show_available_ciphers()
{
    const int *ciphers = mbedtls_cipher_list();

#ifndef ENABLE_SMALL
    printf("The following ciphers and cipher modes are available for use\n"
           "with " PACKAGE_NAME ".  Each cipher shown below may be used as a\n"
           "parameter to the --cipher option.  Using a CBC or GCM mode is\n"
           "recommended.  In static key mode only CBC mode is allowed.\n\n");
#endif

    while (*ciphers != 0)
    {
        const cipher_kt_t *info = mbedtls_cipher_info_from_type(*ciphers);
        if (info && cipher_kt_block_size(info) >= 128/8)
        {
            print_cipher(info);
        }
        ciphers++;
    }

    printf("\nThe following ciphers have a block size of less than 128 bits, \n"
           "and are therefore deprecated.  Do not use unless you have to.\n\n");
    ciphers = mbedtls_cipher_list();
    while (*ciphers != 0)
    {
        const cipher_kt_t *info = mbedtls_cipher_info_from_type(*ciphers);
        if (info && cipher_kt_block_size(info) < 128/8)
        {
            print_cipher(info);
        }
        ciphers++;
    }
    printf("\n");
}