/*
*/
/*
- *
- * hbytes bin VAR => binary string
- * hbytes bin VAR VALUE => set
+ * hbytes raw2h BINARY => hex
+ * hbytes h2raw HEX => binary
*
* hbytes prefix VAR [VALUE ...] = set VAR [concat VALUE ... $VAR]
* hbytes append VAR [VALUE ...] = set VAR [concat $VAR VALUE ...]
* hbytes chopto VAR NEWVARLENGTH => suffix (removed from VAR)
* (too short? error)
*
- * hbytes pkcs5 pv|uv VAR ALG => worked? (always 1 for p)
+ * hbytes pkcs5 pa|ua VAR ALG => worked? (always 1 for p)
* hbytes pkcs5 pn|un VAR BLOCKSIZE => worked? (always 1 for p)
- * hbytes blockcipher e|d VAR ALG MODE [IV] => IV
- * hbytes hash ALG VALUE => hash
- * hbytes hmac ALG VALUE KEY [MACLENGTH] => mac
+ * hbytes blockcipher d|e VAR ALG MODE [IV] => IV
+ *
+ * hbytes hash ALG MESSAGE => hash
+ * hbytes hmac ALG MESSAGE KEY [MACLENGTH] => mac
*
* Refs: HMAC: RFC2104
*/
int staticerr(Tcl_Interp *ip, const char *m);
void objfreeir(Tcl_Obj *o);
-Tcl_Obj *hbytes_set(Tcl_Obj *overwrite, const Byte *array, int l);
+void hbytes_set(HBytes_Value *upd, const Byte *array, int l);
+Tcl_Obj *hbytes_set_obj(Tcl_Obj *overwrite, const Byte *array, int l);
/* from enum.c */
* set to the error message.
*/
+/* from crypto.c */
+
+typedef struct {
+ int blocksize, hashsize;
+} HashAlgInfo;
+
+typedef struct {
+ int blocksize;
+} BlockCipherAlgInfo;
+
+typedef struct {
+ int dummy;
+} BlockCipherModeInfo;
+
/* useful macros */
-#define HBYTES(o) ((HBytes_Value*)&(o)->internalRep.twoPtrValue)
-#define HBYTES_LEN(o) (HBYTES((o))->end - HBYTES((o))->start)
+#define HBYTES(o) (*(HBytes_Value*)&(o)->internalRep.twoPtrValue)
+#define HBYTES_LEN(hb) ((hb).end - (hb).start)
#define TALLOC(s) ((void*)Tcl_Alloc((s)))
#define TFREE(f) (Tcl_Free((void*)(f)))