]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/sha1.h
sandbox: config: Enable cros_ec emulation and related items
[karo-tx-uboot.git] / include / sha1.h
index 3030f2975f2774c69ca84c0e1391eeb476f7caae..da09dab9769af05a80c7f42c42e1f489fe32cb66 100644 (file)
@@ -17,7 +17,7 @@
  *  You should have received a copy of the GNU Lesser General Public
  *  License along with this library; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- *  MA  02110-1301  USA
+ *  MA 02110-1301  USA
  */
 /*
  *  The SHA-1 standard was published by NIST in 1993.
@@ -35,76 +35,79 @@ extern "C" {
 #define SHA1_SUM_LEN   20
 
 /**
- * \brief          SHA-1 context structure
+ * \brief         SHA-1 context structure
  */
 typedef struct
 {
-    unsigned long total[2];     /*!< number of bytes processed  */
-    unsigned long state[5];     /*!< intermediate digest state  */
-    unsigned char buffer[64];   /*!< data block being processed */
+    unsigned long total[2];    /*!< number of bytes processed  */
+    unsigned long state[5];    /*!< intermediate digest state  */
+    unsigned char buffer[64];  /*!< data block being processed */
 }
 sha1_context;
 
 /**
- * \brief          SHA-1 context setup
+ * \brief         SHA-1 context setup
  *
- * \param ctx      SHA-1 context to be initialized
+ * \param ctx     SHA-1 context to be initialized
  */
 void sha1_starts( sha1_context *ctx );
 
 /**
- * \brief          SHA-1 process buffer
+ * \brief         SHA-1 process buffer
  *
- * \param ctx      SHA-1 context
+ * \param ctx     SHA-1 context
  * \param input    buffer holding the  data
- * \param ilen     length of the input data
+ * \param ilen    length of the input data
  */
-void sha1_update( sha1_context *ctx, unsigned char *input, int ilen );
+void sha1_update(sha1_context *ctx, const unsigned char *input,
+                unsigned int ilen);
 
 /**
- * \brief          SHA-1 final digest
+ * \brief         SHA-1 final digest
  *
- * \param ctx      SHA-1 context
+ * \param ctx     SHA-1 context
  * \param output   SHA-1 checksum result
  */
 void sha1_finish( sha1_context *ctx, unsigned char output[20] );
 
 /**
- * \brief          Output = SHA-1( input buffer )
+ * \brief         Output = SHA-1( input buffer )
  *
  * \param input    buffer holding the  data
- * \param ilen     length of the input data
+ * \param ilen    length of the input data
  * \param output   SHA-1 checksum result
  */
-void sha1_csum( unsigned char *input, int ilen,
-                unsigned char output[20] );
+void sha1_csum(const unsigned char *input, unsigned int ilen,
+               unsigned char *output);
 
 /**
- * \brief          Output = SHA-1( file contents )
+ * \brief         Output = SHA-1( input buffer ), with watchdog triggering
  *
- * \param path     input file name
+ * \param input    buffer holding the  data
+ * \param ilen    length of the input data
  * \param output   SHA-1 checksum result
- * \return         0 if successful, or 1 if fopen failed
+ * \param chunk_sz watchdog triggering period (in bytes of input processed)
  */
-int sha1_file( char *path, unsigned char output[20] );
+void sha1_csum_wd(const unsigned char *input, unsigned int ilen,
+               unsigned char *output, unsigned int chunk_sz);
 
 /**
- * \brief          Output = HMAC-SHA-1( input buffer, hmac key )
+ * \brief         Output = HMAC-SHA-1( input buffer, hmac key )
  *
- * \param key      HMAC secret key
+ * \param key     HMAC secret key
  * \param keylen   length of the HMAC key
  * \param input    buffer holding the  data
- * \param ilen     length of the input data
+ * \param ilen    length of the input data
  * \param output   HMAC-SHA-1 result
  */
-void sha1_hmac( unsigned char *key, int keylen,
-                unsigned char *input, int ilen,
-                unsigned char output[20] );
+void sha1_hmac(const unsigned char *key, int keylen,
+               const unsigned char *input, unsigned int ilen,
+               unsigned char *output);
 
 /**
- * \brief          Checkup routine
+ * \brief         Checkup routine
  *
- * \return         0 if successful, or 1 if the test failed
+ * \return        0 if successful, or 1 if the test failed
  */
 int sha1_self_test( void );