28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
*-------------------------------------------------------------------
*/
EVP_CIPHER *Util_GetCipher(Tcl_Interp *interp, Tcl_Obj *cipherObj, int no_null) {
EVP_CIPHER *cipher = NULL;
char *name = NULL;
if (cipherObj != NULL) {
name = Tcl_GetStringFromObj(cipherObj, (Tcl_Size *) NULL);
#if OPENSSL_VERSION_NUMBER < 0x30000000L
cipher = EVP_get_cipherbyname(name);
#else
cipher = EVP_CIPHER_fetch(NULL, name, NULL);
#endif
if (cipher == NULL) {
Tcl_AppendResult(interp, "invalid cipher \"", name, "\"", (char *) NULL);
|
|
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
*-------------------------------------------------------------------
*/
EVP_CIPHER *Util_GetCipher(Tcl_Interp *interp, Tcl_Obj *cipherObj, int no_null) {
EVP_CIPHER *cipher = NULL;
char *name = NULL;
if (cipherObj != NULL) {
name = Tcl_GetString(cipherObj);
#if OPENSSL_VERSION_NUMBER < 0x30000000L
cipher = EVP_get_cipherbyname(name);
#else
cipher = EVP_CIPHER_fetch(NULL, name, NULL);
#endif
if (cipher == NULL) {
Tcl_AppendResult(interp, "invalid cipher \"", name, "\"", (char *) NULL);
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
*-------------------------------------------------------------------
*/
EVP_MD *Util_GetDigest(Tcl_Interp *interp, Tcl_Obj *digestObj, int no_null) {
EVP_MD *md = NULL;
char *name = NULL;
if (digestObj != NULL) {
name = Tcl_GetStringFromObj(digestObj, (Tcl_Size *) NULL);
#if OPENSSL_VERSION_NUMBER < 0x30000000L
md = EVP_get_digestbyname(name);
#else
md = EVP_MD_fetch(NULL, name, NULL);
#endif
if (md == NULL) {
Tcl_AppendResult(interp, "invalid digest \"", name, "\"", (char *) NULL);
|
|
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
*-------------------------------------------------------------------
*/
EVP_MD *Util_GetDigest(Tcl_Interp *interp, Tcl_Obj *digestObj, int no_null) {
EVP_MD *md = NULL;
char *name = NULL;
if (digestObj != NULL) {
name = Tcl_GetString(digestObj);
#if OPENSSL_VERSION_NUMBER < 0x30000000L
md = EVP_get_digestbyname(name);
#else
md = EVP_MD_fetch(NULL, name, NULL);
#endif
if (md == NULL) {
Tcl_AppendResult(interp, "invalid digest \"", name, "\"", (char *) NULL);
|
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
*/
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC *Util_GetMAC(Tcl_Interp *interp, Tcl_Obj *MacObj, int no_null) {
EVP_MAC *mac = NULL;
char *name = NULL;
if (MacObj != NULL) {
name = Tcl_GetStringFromObj(MacObj, (Tcl_Size *) NULL);
mac = EVP_MAC_fetch(NULL, name, NULL);
if (mac == NULL) {
Tcl_AppendResult(interp, "invalid MAC \"", name, "\"", (char *) NULL);
return NULL;
}
} else if (no_null) {
Tcl_AppendResult(interp, "no MAC", (char *) NULL);
|
|
|
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
*/
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC *Util_GetMAC(Tcl_Interp *interp, Tcl_Obj *MacObj, int no_null) {
EVP_MAC *mac = NULL;
char *name = NULL;
if (MacObj != NULL) {
name = Tcl_GetString(MacObj);
mac = EVP_MAC_fetch(NULL, name, NULL);
if (mac == NULL) {
Tcl_AppendResult(interp, "invalid MAC \"", name, "\"", (char *) NULL);
return NULL;
}
} else if (no_null) {
Tcl_AppendResult(interp, "no MAC", (char *) NULL);
|