summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-06 09:22:29 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-06 09:22:29 +0000
commit4c84bbcb921b58b847a57395958dc812db99c67e (patch)
treebf812d4f0248cfdd8975cc584c8ab339ad69ba04
parentecfefb70ee92eb56b3e3cc52134b06e05a423c42 (diff)
downloadppe42-gcc-4c84bbcb921b58b847a57395958dc812db99c67e.tar.gz
ppe42-gcc-4c84bbcb921b58b847a57395958dc812db99c67e.zip
2007-04-06 Thomas Quinot <quinot@adacore.com>
* g-md5.ads, g-md5.adb (Digest): Fix off-by-one error in padding computation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123574 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/g-md5.adb7
-rw-r--r--gcc/ada/g-md5.ads4
2 files changed, 6 insertions, 5 deletions
diff --git a/gcc/ada/g-md5.adb b/gcc/ada/g-md5.adb
index 2146c19773e..158c9c7bfef 100644
--- a/gcc/ada/g-md5.adb
+++ b/gcc/ada/g-md5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005, AdaCore --
+-- Copyright (C) 2002-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -187,7 +187,6 @@ package body GNAT.MD5 is
procedure Convert (X : Unsigned_32) is
Y : Unsigned_32 := X;
-
begin
for J in 1 .. 4 loop
Result (Cur + 1) := Hex_Digit (Y and Unsigned_32'(16#0F#));
@@ -205,7 +204,9 @@ package body GNAT.MD5 is
Last_Block (1 .. C.Last) := C.Buffer (1 .. C.Last);
- if C.Last > 56 then
+ -- Too many magic literals below, should be defined as constants ???
+
+ if C.Last > 55 then
Last_Block (C.Last + 1 .. 64) := Padding (1 .. 64 - C.Last);
Transform (C1, Last_Block);
Last_Block := (others => ASCII.NUL);
diff --git a/gcc/ada/g-md5.ads b/gcc/ada/g-md5.ads
index 2fff917efba..b744cdfaa7f 100644
--- a/gcc/ada/g-md5.ads
+++ b/gcc/ada/g-md5.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005, AdaCore --
+-- Copyright (C) 2002-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -46,7 +46,7 @@ package GNAT.MD5 is
type Context is private;
-- This type is the four-word (16 byte) MD buffer, as described in
- -- RFC 1321 (3.3). It initial value is Initial_Context below.
+ -- RFC 1321 (3.3). Its initial value is Initial_Context below.
Initial_Context : constant Context;
-- Initial value of a Context object. May be used to reinitialize
OpenPOWER on IntegriCloud