1 // natSimpleSHSStream.cc 2 3 /* Copyright (C) 2000 Free Software Foundation 4 5 This file is part of libgcj. 6 7 This software is copyrighted work licensed under the terms of the 8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for 9 details. */ 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 25 jbyteArray shsFinal(jbyteArray shs_info)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), &info->digest, SHS_DIGESTSIZE); 33 return buffer; 34 } 35 36 void shsUpdate(jbyteArray shs_info,jbyteArray buf,jint count)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 45 jbyteArray shsInit()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 56