* Subra Aswathanarayanan wrote on Mon, Jun 07, 2010 at 20:44 -0400: > Both of you mention that OpenSSL doesn't provide such an interface. > May be this question is not appropriate for this forum, but do you > know of any such simpler libraries that I might be able to use?
If it is just SHA1 you need for a particular purpose, you may even use just some sha1.c (instead of using a big library), for example: http://www.koders.com/c/fid17B8BC1580A40B49AE494B182AF91A73CBF62B38.aspx?s=sort http://www.koders.com/c/fid292402EE6741EB2682D9E89AEF3A29B7B2C73F32.aspx?s=sort the context to be (serialized and) saved is: struct sha_ctx { u_int32_t digest[SHA_DIGESTLEN]; /* Message digest */ u_int32_t count_l, count_h; /* 64-bit block count */ u_int8_t block[SHA_DATASIZE]; /* SHA data buffer */ int index; /* index into buffer */ }; your implementation will depend on the structure, i.e. if it changes, your application breaks. Thus using an libraries private structure (like including private header files to see what is inside a struct which has just a forwarder in the public header) has the disadvantage that as soon as the library is changed, your application may break, because it uses internal interfaces and relies on hidden data. When you have a copy of sha1.c, it is your structure and you have the control. For testing, you might even use memcpy(dest, ctx, sizeof(struct sha_ctx)). I assume by serializing such a context, your application depends on the hardware architecture (e.g. byte order), even if serialization takes byte order into account the implemenation may fail (for example, if `block' has to have a specific format). When Engines are used, for example a smart card, it might even be impossible to serialize a context in the way you need it (I would intuitively assume that any hardware token would prohibit such usage to avoid potential miss-use). oki, Steffen About Ingenico: Ingenico is a leading provider of payment solutions, with over 15 million terminals deployed in more than 125 countries. Its 2,850 employees worldwide support retailers, banks and service providers to optimize and secure their electronic payments solutions, develop their offer of services and increase their point of sales revenue. More information on http://www.ingenico.com/. This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. P Please consider the environment before printing this e-mail ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org