source: trunk/gcc/libjava/gnu/gcj/io/natSimpleSHSStream.cc

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.1 KB
Line 
1// natSimpleSHSStream.cc
2
3/* Copyright (C) 2000 Free Software Foundation
4
5 This file is part of libgcj.
6
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
11#include <config.h>
12
13#include <string.h>
14#include <stdlib.h>
15
16#include <gnu/gcj/io/SimpleSHSStream.h>
17
18#include <gcj/cni.h>
19#include <jvm.h>
20
21#define PROTO
22#include "shs.h"
23
24
25jbyteArray
26gnu::gcj::io::SimpleSHSStream::shsFinal (jbyteArray shs_info)
27{
28 SHS_INFO *info = (SHS_INFO *)elements(shs_info);
29 ::shsFinal (info);
30
31 jbyteArray buffer = JvNewByteArray (SHS_DIGESTSIZE);
32 memcpy (elements (buffer), (jbyte *)&info->digest, SHS_DIGESTSIZE);
33 return buffer;
34}
35
36void
37gnu::gcj::io::SimpleSHSStream::shsUpdate (jbyteArray shs_info, jbyteArray buf, jint count)
38{
39 SHS_INFO *info = (SHS_INFO *)elements(shs_info);
40 uint8_t *buffer = (uint8_t *)elements(buf);
41
42 ::shsUpdate (info, buffer, count);
43}
44
45jbyteArray
46gnu::gcj::io::SimpleSHSStream::shsInit ()
47{
48 jbyteArray result = JvNewByteArray (sizeof (SHS_INFO));
49 SHS_INFO *info = (SHS_INFO *)elements(result);
50
51 ::shsInit (info);
52 return result;
53}
54
55
Note: See TracBrowser for help on using the repository browser.