Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
targets/TARGET_NUVOTON/TARGET_NUC472/crypto/sha/sha1_alt_sw.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 | /** |
<> | 149:156823d33999 | 2 | * \file sha1.h |
<> | 149:156823d33999 | 3 | * |
<> | 149:156823d33999 | 4 | * \brief SHA-1 cryptographic hash function |
<> | 149:156823d33999 | 5 | * |
<> | 149:156823d33999 | 6 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved |
<> | 149:156823d33999 | 7 | * SPDX-License-Identifier: Apache-2.0 |
<> | 149:156823d33999 | 8 | * |
<> | 149:156823d33999 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
<> | 149:156823d33999 | 10 | * not use this file except in compliance with the License. |
<> | 149:156823d33999 | 11 | * You may obtain a copy of the License at |
<> | 149:156823d33999 | 12 | * |
<> | 149:156823d33999 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 149:156823d33999 | 14 | * |
<> | 149:156823d33999 | 15 | * Unless required by applicable law or agreed to in writing, software |
<> | 149:156823d33999 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
<> | 149:156823d33999 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 149:156823d33999 | 18 | * See the License for the specific language governing permissions and |
<> | 149:156823d33999 | 19 | * limitations under the License. |
<> | 149:156823d33999 | 20 | * |
<> | 149:156823d33999 | 21 | * This file is part of mbed TLS (https://tls.mbed.org) |
<> | 149:156823d33999 | 22 | */ |
<> | 149:156823d33999 | 23 | #ifndef MBEDTLS_SHA1_ALT_SW_H |
<> | 149:156823d33999 | 24 | #define MBEDTLS_SHA1_ALT_SW_H |
<> | 149:156823d33999 | 25 | |
<> | 149:156823d33999 | 26 | #if !defined(MBEDTLS_CONFIG_FILE) |
<> | 149:156823d33999 | 27 | #include "config.h" |
<> | 149:156823d33999 | 28 | #else |
<> | 149:156823d33999 | 29 | #include MBEDTLS_CONFIG_FILE |
<> | 149:156823d33999 | 30 | #endif |
<> | 149:156823d33999 | 31 | |
<> | 149:156823d33999 | 32 | #if defined(MBEDTLS_SHA1_C) |
<> | 149:156823d33999 | 33 | #if defined(MBEDTLS_SHA1_ALT) |
<> | 149:156823d33999 | 34 | |
<> | 149:156823d33999 | 35 | #include <stddef.h> |
<> | 149:156823d33999 | 36 | #include <stdint.h> |
<> | 149:156823d33999 | 37 | |
<> | 149:156823d33999 | 38 | #ifdef __cplusplus |
<> | 149:156823d33999 | 39 | extern "C" { |
<> | 149:156823d33999 | 40 | #endif |
<> | 149:156823d33999 | 41 | |
<> | 149:156823d33999 | 42 | /** |
<> | 149:156823d33999 | 43 | * \brief SHA-1 context structure |
<> | 149:156823d33999 | 44 | */ |
<> | 149:156823d33999 | 45 | typedef struct |
<> | 149:156823d33999 | 46 | { |
<> | 149:156823d33999 | 47 | uint32_t total[2]; /*!< number of bytes processed */ |
<> | 149:156823d33999 | 48 | uint32_t state[5]; /*!< intermediate digest state */ |
<> | 149:156823d33999 | 49 | unsigned char buffer[64]; /*!< data block being processed */ |
<> | 149:156823d33999 | 50 | } |
<> | 149:156823d33999 | 51 | mbedtls_sha1_sw_context; |
<> | 149:156823d33999 | 52 | |
<> | 149:156823d33999 | 53 | /** |
<> | 149:156823d33999 | 54 | * \brief Initialize SHA-1 context |
<> | 149:156823d33999 | 55 | * |
<> | 149:156823d33999 | 56 | * \param ctx SHA-1 context to be initialized |
<> | 149:156823d33999 | 57 | */ |
<> | 149:156823d33999 | 58 | void mbedtls_sha1_sw_init( mbedtls_sha1_sw_context *ctx ); |
<> | 149:156823d33999 | 59 | |
<> | 149:156823d33999 | 60 | /** |
<> | 149:156823d33999 | 61 | * \brief Clear SHA-1 context |
<> | 149:156823d33999 | 62 | * |
<> | 149:156823d33999 | 63 | * \param ctx SHA-1 context to be cleared |
<> | 149:156823d33999 | 64 | */ |
<> | 149:156823d33999 | 65 | void mbedtls_sha1_sw_free( mbedtls_sha1_sw_context *ctx ); |
<> | 149:156823d33999 | 66 | |
<> | 149:156823d33999 | 67 | /** |
<> | 149:156823d33999 | 68 | * \brief Clone (the state of) a SHA-1 context |
<> | 149:156823d33999 | 69 | * |
<> | 149:156823d33999 | 70 | * \param dst The destination context |
<> | 149:156823d33999 | 71 | * \param src The context to be cloned |
<> | 149:156823d33999 | 72 | */ |
<> | 149:156823d33999 | 73 | void mbedtls_sha1_sw_clone( mbedtls_sha1_sw_context *dst, |
<> | 149:156823d33999 | 74 | const mbedtls_sha1_sw_context *src ); |
<> | 149:156823d33999 | 75 | |
<> | 149:156823d33999 | 76 | /** |
<> | 149:156823d33999 | 77 | * \brief SHA-1 context setup |
<> | 149:156823d33999 | 78 | * |
<> | 149:156823d33999 | 79 | * \param ctx context to be initialized |
<> | 149:156823d33999 | 80 | */ |
<> | 149:156823d33999 | 81 | void mbedtls_sha1_sw_starts( mbedtls_sha1_sw_context *ctx ); |
<> | 149:156823d33999 | 82 | |
<> | 149:156823d33999 | 83 | /** |
<> | 149:156823d33999 | 84 | * \brief SHA-1 process buffer |
<> | 149:156823d33999 | 85 | * |
<> | 149:156823d33999 | 86 | * \param ctx SHA-1 context |
<> | 149:156823d33999 | 87 | * \param input buffer holding the data |
<> | 149:156823d33999 | 88 | * \param ilen length of the input data |
<> | 149:156823d33999 | 89 | */ |
<> | 149:156823d33999 | 90 | void mbedtls_sha1_sw_update( mbedtls_sha1_sw_context *ctx, const unsigned char *input, size_t ilen ); |
<> | 149:156823d33999 | 91 | |
<> | 149:156823d33999 | 92 | /** |
<> | 149:156823d33999 | 93 | * \brief SHA-1 final digest |
<> | 149:156823d33999 | 94 | * |
<> | 149:156823d33999 | 95 | * \param ctx SHA-1 context |
<> | 149:156823d33999 | 96 | * \param output SHA-1 checksum result |
<> | 149:156823d33999 | 97 | */ |
<> | 149:156823d33999 | 98 | void mbedtls_sha1_sw_finish( mbedtls_sha1_sw_context *ctx, unsigned char output[20] ); |
<> | 149:156823d33999 | 99 | |
<> | 149:156823d33999 | 100 | /* Internal use */ |
<> | 149:156823d33999 | 101 | void mbedtls_sha1_sw_process( mbedtls_sha1_sw_context *ctx, const unsigned char data[64] ); |
<> | 149:156823d33999 | 102 | |
<> | 149:156823d33999 | 103 | #ifdef __cplusplus |
<> | 149:156823d33999 | 104 | } |
<> | 149:156823d33999 | 105 | #endif |
<> | 149:156823d33999 | 106 | |
<> | 149:156823d33999 | 107 | #endif /* MBEDTLS_SHA1_ALT */ |
<> | 149:156823d33999 | 108 | #endif /* MBEDTLS_SHA1_C */ |
<> | 149:156823d33999 | 109 | |
<> | 149:156823d33999 | 110 | #endif /* sha1_alt_sw.h */ |