mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
targets/TARGET_NUVOTON/TARGET_NUC472/crypto/sha/sha1_alt.h@149:156823d33999, 2016-10-28 (annotated)
- Committer:
- <>
- Date:
- Fri Oct 28 11:17:30 2016 +0100
- Revision:
- 149:156823d33999
This updates the lib to the mbed lib v128
NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | /* mbed Microcontroller Library |
<> | 149:156823d33999 | 2 | * Copyright (c) 2015-2016 Nuvoton |
<> | 149:156823d33999 | 3 | * |
<> | 149:156823d33999 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 149:156823d33999 | 5 | * you may not use this file except in compliance with the License. |
<> | 149:156823d33999 | 6 | * You may obtain a copy of the License at |
<> | 149:156823d33999 | 7 | * |
<> | 149:156823d33999 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 149:156823d33999 | 9 | * |
<> | 149:156823d33999 | 10 | * Unless required by applicable law or agreed to in writing, software |
<> | 149:156823d33999 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 149:156823d33999 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 149:156823d33999 | 13 | * See the License for the specific language governing permissions and |
<> | 149:156823d33999 | 14 | * limitations under the License. |
<> | 149:156823d33999 | 15 | */ |
<> | 149:156823d33999 | 16 | #ifndef MBEDTLS_SHA1_ALT_H |
<> | 149:156823d33999 | 17 | #define MBEDTLS_SHA1_ALT_H |
<> | 149:156823d33999 | 18 | |
<> | 149:156823d33999 | 19 | #if !defined(MBEDTLS_CONFIG_FILE) |
<> | 149:156823d33999 | 20 | #include "config.h" |
<> | 149:156823d33999 | 21 | #else |
<> | 149:156823d33999 | 22 | #include MBEDTLS_CONFIG_FILE |
<> | 149:156823d33999 | 23 | #endif |
<> | 149:156823d33999 | 24 | |
<> | 149:156823d33999 | 25 | #if defined(MBEDTLS_SHA1_C) |
<> | 149:156823d33999 | 26 | #if defined(MBEDTLS_SHA1_ALT) |
<> | 149:156823d33999 | 27 | |
<> | 149:156823d33999 | 28 | #include "sha1.h" |
<> | 149:156823d33999 | 29 | #include "sha_alt_hw.h" |
<> | 149:156823d33999 | 30 | #include "sha1_alt_sw.h" |
<> | 149:156823d33999 | 31 | |
<> | 149:156823d33999 | 32 | #ifdef __cplusplus |
<> | 149:156823d33999 | 33 | extern "C" { |
<> | 149:156823d33999 | 34 | #endif |
<> | 149:156823d33999 | 35 | |
<> | 149:156823d33999 | 36 | struct mbedtls_sha1_context_s; |
<> | 149:156823d33999 | 37 | |
<> | 149:156823d33999 | 38 | /** |
<> | 149:156823d33999 | 39 | * \brief SHA-1 context structure |
<> | 149:156823d33999 | 40 | */ |
<> | 149:156823d33999 | 41 | typedef struct mbedtls_sha1_context_s |
<> | 149:156823d33999 | 42 | { |
<> | 149:156823d33999 | 43 | int ishw; |
<> | 149:156823d33999 | 44 | crypto_sha_context hw_ctx; |
<> | 149:156823d33999 | 45 | mbedtls_sha1_sw_context sw_ctx; |
<> | 149:156823d33999 | 46 | } |
<> | 149:156823d33999 | 47 | mbedtls_sha1_context; |
<> | 149:156823d33999 | 48 | |
<> | 149:156823d33999 | 49 | /** |
<> | 149:156823d33999 | 50 | * \brief Initialize SHA-1 context |
<> | 149:156823d33999 | 51 | * |
<> | 149:156823d33999 | 52 | * \param ctx SHA-1 context to be initialized |
<> | 149:156823d33999 | 53 | */ |
<> | 149:156823d33999 | 54 | void mbedtls_sha1_init( mbedtls_sha1_context *ctx ); |
<> | 149:156823d33999 | 55 | |
<> | 149:156823d33999 | 56 | /** |
<> | 149:156823d33999 | 57 | * \brief Clear SHA-1 context |
<> | 149:156823d33999 | 58 | * |
<> | 149:156823d33999 | 59 | * \param ctx SHA-1 context to be cleared |
<> | 149:156823d33999 | 60 | */ |
<> | 149:156823d33999 | 61 | void mbedtls_sha1_free( mbedtls_sha1_context *ctx ); |
<> | 149:156823d33999 | 62 | |
<> | 149:156823d33999 | 63 | /** |
<> | 149:156823d33999 | 64 | * \brief Clone (the state of) a SHA-1 context |
<> | 149:156823d33999 | 65 | * |
<> | 149:156823d33999 | 66 | * \param dst The destination context |
<> | 149:156823d33999 | 67 | * \param src The context to be cloned |
<> | 149:156823d33999 | 68 | */ |
<> | 149:156823d33999 | 69 | void mbedtls_sha1_clone( mbedtls_sha1_context *dst, |
<> | 149:156823d33999 | 70 | const mbedtls_sha1_context *src ); |
<> | 149:156823d33999 | 71 | |
<> | 149:156823d33999 | 72 | /** |
<> | 149:156823d33999 | 73 | * \brief SHA-1 context setup |
<> | 149:156823d33999 | 74 | * |
<> | 149:156823d33999 | 75 | * \param ctx context to be initialized |
<> | 149:156823d33999 | 76 | */ |
<> | 149:156823d33999 | 77 | void mbedtls_sha1_starts( mbedtls_sha1_context *ctx ); |
<> | 149:156823d33999 | 78 | |
<> | 149:156823d33999 | 79 | /** |
<> | 149:156823d33999 | 80 | * \brief SHA-1 process buffer |
<> | 149:156823d33999 | 81 | * |
<> | 149:156823d33999 | 82 | * \param ctx SHA-1 context |
<> | 149:156823d33999 | 83 | * \param input buffer holding the data |
<> | 149:156823d33999 | 84 | * \param ilen length of the input data |
<> | 149:156823d33999 | 85 | */ |
<> | 149:156823d33999 | 86 | void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen ); |
<> | 149:156823d33999 | 87 | |
<> | 149:156823d33999 | 88 | /** |
<> | 149:156823d33999 | 89 | * \brief SHA-1 final digest |
<> | 149:156823d33999 | 90 | * |
<> | 149:156823d33999 | 91 | * \param ctx SHA-1 context |
<> | 149:156823d33999 | 92 | * \param output SHA-1 checksum result |
<> | 149:156823d33999 | 93 | */ |
<> | 149:156823d33999 | 94 | void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] ); |
<> | 149:156823d33999 | 95 | |
<> | 149:156823d33999 | 96 | /* Internal use */ |
<> | 149:156823d33999 | 97 | void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[64] ); |
<> | 149:156823d33999 | 98 | |
<> | 149:156823d33999 | 99 | #ifdef __cplusplus |
<> | 149:156823d33999 | 100 | } |
<> | 149:156823d33999 | 101 | #endif |
<> | 149:156823d33999 | 102 | |
<> | 149:156823d33999 | 103 | #endif /* MBEDTLS_SHA1_ALT */ |
<> | 149:156823d33999 | 104 | #endif /* MBEDTLS_SHA1_C */ |
<> | 149:156823d33999 | 105 | |
<> | 149:156823d33999 | 106 | #endif /* sha1_alt.h */ |