2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
25 #include <yaca/crypto.h>
26 #include <yaca/digest.h>
27 #include <yaca/simple.h>
31 void digest_simple(void)
37 ret = yaca_digest_calc(YACA_DIGEST_SHA256,
39 1024, &digest, &digest_len);
43 dump_hex(digest, digest_len, "Message digest: ");
48 void digest_advanced(void)
53 ret = yaca_digest_init(&ctx, YACA_DIGEST_SHA256);
57 ret = yaca_digest_update(ctx, lorem1024, 1024);
61 // TODO: rename to yaca_digest_get_length??
63 digest_len = yaca_get_digest_length(ctx);
68 char digest[digest_len];
70 ret = yaca_digest_final(ctx, digest, &digest_len);
74 dump_hex(digest, digest_len, "Message digest: ");
83 int ret = yaca_init();
91 yaca_exit(); // TODO: what about handing of return value from exit??