Check-in [c5f7dd0630]
Overview
Comment:Added more cipher status flags to returned info for cipher command
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | crypto
Files: files | file ages | folders
SHA3-256: c5f7dd0630262fe31017657ece87bb9a3b69abb910d85ae4e03916539d588e1e
User & Date: bohagan on 2024-04-10 02:30:48
Other Links: branch diff | manifest | tags
Context
2024-04-10
04:13
Updated test cases check-in: 4936d5ae8d user: bohagan tags: crypto
02:30
Added more cipher status flags to returned info for cipher command check-in: c5f7dd0630 user: bohagan tags: crypto
2024-04-09
03:21
Added remaining Camellia cipher test vectors check-in: 51d59fd360 user: bohagan tags: crypto
Changes

Modified generic/tlsInfo.c from [c3297cae77] to [1695ade193].

133
134
135
136
137
138
139



140
141
142
143
144
145
146
147
148
149

150
151
152

153
154
155
156
157
158
159
160

161

162




163
164

165
166



167
168







169
170
171
172
173
174
175
	    modeName = "OFB";
	    break;
	case EVP_CIPH_CTR_MODE:
	    modeName = "CTR";
	    break;
	case EVP_CIPH_GCM_MODE:
	    modeName = "GCM";



	    break;
	case EVP_CIPH_XTS_MODE:
	    modeName = "XTS";
	    break;
	case EVP_CIPH_CCM_MODE:
	    modeName = "CCM";
	    break;
	case EVP_CIPH_OCB_MODE:
	    modeName = "OCB";
	    break;

	case EVP_CIPH_WRAP_MODE :
	    modeName = "WRAP";
	    break;

	default:
	    modeName = "unknown";
	    break;
    }
    LAPPEND_STR(interp, resultObj, "mode", modeName, -1);

    /* Flags */
    listObj = Tcl_NewListObj(0, NULL);

    LAPPEND_BOOL(interp, listObj, "Variable Length", flags & EVP_CIPH_VARIABLE_LENGTH);

    LAPPEND_BOOL(interp, listObj, "Always Call Init", flags & EVP_CIPH_ALWAYS_CALL_INIT);




    LAPPEND_BOOL(interp, listObj, "Custom IV", flags & EVP_CIPH_CUSTOM_IV);
    LAPPEND_BOOL(interp, listObj, "Control Init", flags & EVP_CIPH_CTRL_INIT);

    LAPPEND_BOOL(interp, listObj, "Custom Cipher", flags & EVP_CIPH_FLAG_CUSTOM_CIPHER);
    LAPPEND_BOOL(interp, listObj, "AEAD Cipher", flags & EVP_CIPH_FLAG_AEAD_CIPHER);



    LAPPEND_BOOL(interp, listObj, "Custom Copy", flags & EVP_CIPH_CUSTOM_COPY);
    LAPPEND_BOOL(interp, listObj, "Non FIPS Allow", flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW);







    LAPPEND_OBJ(interp, resultObj, "flags", listObj);

    /* CTX only properties */
    {
	EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
	int tag_len = 0;








>
>
>




|
|




>
|
|

>








>

>

>
>
>
>
|
|
>


>
>
>
|

>
>
>
>
>
>
>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
	    modeName = "OFB";
	    break;
	case EVP_CIPH_CTR_MODE:
	    modeName = "CTR";
	    break;
	case EVP_CIPH_GCM_MODE:
	    modeName = "GCM";
	    break;
	case EVP_CIPH_CCM_MODE:
	    modeName = "CCM";
	    break;
	case EVP_CIPH_XTS_MODE:
	    modeName = "XTS";
	    break;
	case EVP_CIPH_WRAP_MODE :
	    modeName = "WRAP";
	    break;
	case EVP_CIPH_OCB_MODE:
	    modeName = "OCB";
	    break;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
	case EVP_CIPH_SIV_MODE :
	    modeName = "SIV";
	    break;
#endif
	default:
	    modeName = "unknown";
	    break;
    }
    LAPPEND_STR(interp, resultObj, "mode", modeName, -1);

    /* Flags */
    listObj = Tcl_NewListObj(0, NULL);
    LAPPEND_BOOL(interp, listObj, "Wrap Allowed", flags & EVP_CIPHER_CTX_FLAG_WRAP_ALLOW);
    LAPPEND_BOOL(interp, listObj, "Variable Length", flags & EVP_CIPH_VARIABLE_LENGTH);
    LAPPEND_BOOL(interp, listObj, "Custom IV", flags & EVP_CIPH_CUSTOM_IV);
    LAPPEND_BOOL(interp, listObj, "Always Call Init", flags & EVP_CIPH_ALWAYS_CALL_INIT);
    LAPPEND_BOOL(interp, listObj, "Control Init", flags & EVP_CIPH_CTRL_INIT);
    LAPPEND_BOOL(interp, listObj, "Custom Key Length", flags & EVP_CIPH_CUSTOM_KEY_LENGTH);
    LAPPEND_BOOL(interp, listObj, "No padding", flags & EVP_CIPH_NO_PADDING);
    LAPPEND_BOOL(interp, listObj, "Has random key", flags & EVP_CIPH_RAND_KEY);
    LAPPEND_BOOL(interp, listObj, "Custom Copy", flags & EVP_CIPH_CUSTOM_COPY);
    LAPPEND_BOOL(interp, listObj, "Custom IV Length", flags & EVP_CIPH_CUSTOM_IV_LENGTH);
    LAPPEND_BOOL(interp, listObj, "Default ASN1", flags & EVP_CIPH_FLAG_DEFAULT_ASN1);
    LAPPEND_BOOL(interp, listObj, "Custom Cipher", flags & EVP_CIPH_FLAG_CUSTOM_CIPHER);
    LAPPEND_BOOL(interp, listObj, "AEAD Cipher", flags & EVP_CIPH_FLAG_AEAD_CIPHER);
    LAPPEND_BOOL(interp, listObj, "TLS 1.1 Multiblock", flags & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK);
    LAPPEND_BOOL(interp, listObj, "Pipeline", flags & EVP_CIPH_FLAG_PIPELINE);
#if OPENSSL_VERSION_NUMBER < 0x30000000L
    LAPPEND_BOOL(interp, listObj, "FIPS", flags & EVP_CIPH_FLAG_FIPS);
    LAPPEND_BOOL(interp, listObj, "Non FIPS Allow", flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW);
#else
    LAPPEND_BOOL(interp, listObj, "CTS", flags & EVP_CIPH_FLAG_CTS);
    LAPPEND_BOOL(interp, listObj, "Custom ASN1", flags & EVP_CIPH_FLAG_CUSTOM_ASN1);
    LAPPEND_BOOL(interp, listObj, "Cipher with MAC", flags & EVP_CIPH_FLAG_CIPHER_WITH_MAC);
    LAPPEND_BOOL(interp, listObj, "Get Wrap Cipher", flags & EVP_CIPH_FLAG_GET_WRAP_CIPHER);
    LAPPEND_BOOL(interp, listObj, "Inverse Cipher", flags & EVP_CIPH_FLAG_INVERSE_CIPHER);
#endif
    LAPPEND_OBJ(interp, resultObj, "flags", listObj);

    /* CTX only properties */
    {
	EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
	int tag_len = 0;

519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
    flags = EVP_MD_flags(md);

    /* Flags */
    listObj = Tcl_NewListObj(0, NULL);
    LAPPEND_BOOL(interp, listObj, "One-shot", flags & EVP_MD_FLAG_ONESHOT);
    LAPPEND_BOOL(interp, listObj, "XOF", flags & EVP_MD_FLAG_XOF);
    LAPPEND_BOOL(interp, listObj, "DigestAlgorithmId_NULL", flags & EVP_MD_FLAG_DIGALGID_NULL);
    LAPPEND_BOOL(interp, listObj, "DigestAlgorithmId_Abscent", flags & EVP_MD_FLAG_DIGALGID_ABSENT);
    LAPPEND_BOOL(interp, listObj, "DigestAlgorithmId_Custom", flags & EVP_MD_FLAG_DIGALGID_CUSTOM);
    LAPPEND_BOOL(interp, listObj, "FIPS", flags & EVP_MD_FLAG_FIPS);
    LAPPEND_OBJ(interp, resultObj, "flags", listObj);

    Tcl_SetObjResult(interp, resultObj);

done:







|







541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
    flags = EVP_MD_flags(md);

    /* Flags */
    listObj = Tcl_NewListObj(0, NULL);
    LAPPEND_BOOL(interp, listObj, "One-shot", flags & EVP_MD_FLAG_ONESHOT);
    LAPPEND_BOOL(interp, listObj, "XOF", flags & EVP_MD_FLAG_XOF);
    LAPPEND_BOOL(interp, listObj, "DigestAlgorithmId_NULL", flags & EVP_MD_FLAG_DIGALGID_NULL);
    LAPPEND_BOOL(interp, listObj, "DigestAlgorithmId_Absent", flags & EVP_MD_FLAG_DIGALGID_ABSENT);
    LAPPEND_BOOL(interp, listObj, "DigestAlgorithmId_Custom", flags & EVP_MD_FLAG_DIGALGID_CUSTOM);
    LAPPEND_BOOL(interp, listObj, "FIPS", flags & EVP_MD_FLAG_FIPS);
    LAPPEND_OBJ(interp, resultObj, "flags", listObj);

    Tcl_SetObjResult(interp, resultObj);

done: