@@ -191,49 +191,6 @@ typedef struct SHA256Context SHA224Context;
191191 */
192192typedef struct SHA512Context SHA384Context ;
193193
194- /*
195- * This structure holds context information for all SHA
196- * hashing operations.
197- */
198- typedef struct USHAContext {
199- int whichSha ; /* which SHA is being used */
200- union {
201- SHA1Context sha1Context ;
202- SHA224Context sha224Context ; SHA256Context sha256Context ;
203- SHA384Context sha384Context ; SHA512Context sha512Context ;
204- } ctx ;
205- } USHAContext ;
206-
207- /*
208- * This structure will hold context information for the HMAC
209- * keyed-hashing operation.
210- */
211- typedef struct HMACContext {
212- int whichSha ; /* which SHA is being used */
213- int hashSize ; /* hash size of SHA being used */
214- int blockSize ; /* block size of SHA being used */
215- USHAContext shaContext ; /* SHA context */
216- unsigned char k_opad [USHA_Max_Message_Block_Size ];
217- /* outer padding - key XORd with opad */
218- int Computed ; /* Is the MAC computed? */
219- int Corrupted ; /* Cumulative corruption code */
220-
221- } HMACContext ;
222-
223- /*
224- * This structure will hold context information for the HKDF
225- * extract-and-expand Key Derivation Functions.
226- */
227- typedef struct HKDFContext {
228- int whichSha ; /* which SHA is being used */
229- HMACContext hmacContext ;
230- int hashSize ; /* hash size of SHA being used */
231- unsigned char prk [USHAMaxHashSize ];
232- /* pseudo-random key - output of hkdfInput */
233- int Computed ; /* Is the key material computed? */
234- int Corrupted ; /* Cumulative corruption code */
235- } HKDFContext ;
236-
237194/*
238195 * Function Prototypes
239196 */
@@ -283,73 +240,4 @@ extern int SHA512FinalBits(SHA512Context *, uint8_t bits,
283240extern int SHA512Result (SHA512Context * ,
284241 uint8_t Message_Digest [SHA512HashSize ]);
285242
286- /* Unified SHA functions, chosen by whichSha */
287- extern int USHAReset (USHAContext * context , SHAversion whichSha );
288- extern int USHAInput (USHAContext * context ,
289- const uint8_t * bytes , unsigned int bytecount );
290- extern int USHAFinalBits (USHAContext * context ,
291- uint8_t bits , unsigned int bit_count );
292- extern int USHAResult (USHAContext * context ,
293- uint8_t Message_Digest [USHAMaxHashSize ]);
294- extern int USHABlockSize (enum SHAversion whichSha );
295- extern int USHAHashSize (enum SHAversion whichSha );
296- extern int USHAHashSizeBits (enum SHAversion whichSha );
297- extern const char * USHAHashName (enum SHAversion whichSha );
298-
299- /*
300- * HMAC Keyed-Hashing for Message Authentication, RFC 2104,
301- * for all SHAs.
302- * This interface allows a fixed-length text input to be used.
303- */
304- extern int hmac (SHAversion whichSha , /* which SHA algorithm to use */
305- const unsigned char * text , /* pointer to data stream */
306- int text_len , /* length of data stream */
307- const unsigned char * key , /* pointer to authentication key */
308- int key_len , /* length of authentication key */
309- uint8_t digest [USHAMaxHashSize ]); /* caller digest to fill in */
310-
311- /*
312- * HMAC Keyed-Hashing for Message Authentication, RFC 2104,
313- * for all SHAs.
314- * This interface allows any length of text input to be used.
315- */
316- extern int hmacReset (HMACContext * context , enum SHAversion whichSha ,
317- const unsigned char * key , int key_len );
318- extern int hmacInput (HMACContext * context , const unsigned char * text ,
319- int text_len );
320- extern int hmacFinalBits (HMACContext * context , uint8_t bits ,
321- unsigned int bit_count );
322- extern int hmacResult (HMACContext * context ,
323- uint8_t digest [USHAMaxHashSize ]);
324-
325- /*
326- * HKDF HMAC-based Extract-and-Expand Key Derivation Function,
327- * RFC 5869, for all SHAs.
328- */
329- extern int hkdf (SHAversion whichSha , const unsigned char * salt ,
330- int salt_len , const unsigned char * ikm , int ikm_len ,
331- const unsigned char * info , int info_len ,
332- uint8_t okm [ ], int okm_len );
333- extern int hkdfExtract (SHAversion whichSha , const unsigned char * salt ,
334- int salt_len , const unsigned char * ikm ,
335- int ikm_len , uint8_t prk [USHAMaxHashSize ]);
336- extern int hkdfExpand (SHAversion whichSha , const uint8_t prk [ ],
337- int prk_len , const unsigned char * info ,
338- int info_len , uint8_t okm [ ], int okm_len );
339-
340- /*
341- * HKDF HMAC-based Extract-and-Expand Key Derivation Function,
342- * RFC 5869, for all SHAs.
343- * This interface allows any length of text input to be used.
344- */
345- extern int hkdfReset (HKDFContext * context , enum SHAversion whichSha ,
346- const unsigned char * salt , int salt_len );
347- extern int hkdfInput (HKDFContext * context , const unsigned char * ikm ,
348- int ikm_len );
349- extern int hkdfFinalBits (HKDFContext * context , uint8_t ikm_bits ,
350- unsigned int ikm_bit_count );
351- extern int hkdfResult (HKDFContext * context ,
352- uint8_t prk [USHAMaxHashSize ],
353- const unsigned char * info , int info_len ,
354- uint8_t okm [USHAMaxHashSize ], int okm_len );
355243#endif /* _SHA_H_ */
0 commit comments